This topic describes how to view the logs of an ApsaraDB RDS for SQL Server instance by using the ApsaraDB RDS console or SQL statements. These logs include error logs and primary/secondary switchover logs. You can use these logs to troubleshoot issues on your RDS instance.

Precautions

View logs by using the ApsaraDB RDS console

  1. Visit the RDS instance list, select a region above, and click the target instance ID.
  2. In the left-side navigation pane, click Logs.
  3. On the Logs page, click the Error Logs or Primary/Secondary Switching Logs tab, select a time range, and then click OK.
    Tab Description
    Error Logs Provides logs on events that occurred over the last month. The events include custom events and specific system events.
    Primary/Secondary Switching Logs Provides logs on primary/secondary switchovers that occurred over the last month.
    Note If you cannot find the Primary/Secondary Switching Logs tab, check whether your RDS instance meets the requirements in the " Precautions" section of this topic.

View logs by using SQL statements

  • If your RDS instance runs SQL Server 2016 or an earlier version, run the sp_rds_read_error_logs stored procedure to read error logs. The method that is used to run this stored procedure is similar to the method that is used to run the sp_readerrorlog stored procedure.
    • Example1:
      EXEC sp_rds_read_error_logs
    • Example2:
      EXEC sp_rds_read_error_logs 0,1 ,'error'
  • If your RDS instance runs SQL Server 2017 or 2019, run the sp_readerrorlog stored procedure to read error logs.

    Example:

    EXEC sp_readerrorlog