This topic describes how to view the error logs of an ApsaraDB RDS for SQL Server instance in the ApsaraDB RDS console or by using SQL statements. You can use the error logs to troubleshoot issues. After a primary/secondary switchover is complete, you can view the primary/secondary switchover logs of an RDS instance in the ApsaraDB RDS console.

Prerequisites

Your RDS instance runs RDS High-availability Edition or RDS Cluster Edition. For more information about how to switch workloads over between primary and secondary RDS instances, see Switch workloads over between primary and secondary ApsaraDB RDS for SQL Server instances.

Precautions

The first logs in this topic refer to error logs. For more information about how to view transaction logs, see Back up an ApsaraDB RDS for SQL Server instance and Download the data backup files and log backup files of an ApsaraDB RDS for SQL Server instance.

Limits

If your RDS instance runs SQL Server 2008 R2 with standard SSDs or enhanced SSDs (ESSDs), you cannot view primary/secondary switchover logs on the Logs page of the ApsaraDB RDS console.

View error logs in the ApsaraDB RDS console

  1. Access RDS Instances, select a region at the top, and then click the ID of the target RDS instance.
  2. In the left-side navigation pane, click Logs.
  3. On the Logs page, click the Error 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.

View primary/secondary switchover logs in the ApsaraDB RDS console

  1. Access RDS Instances, select a region at the top, and then click the ID of the target RDS instance.
  2. In the left-side navigation pane, click Service Availability.
  3. In the Primary/Secondary Switching Logs section of the page that appears, select a time range and view the primary/secondary switchover logs that are generated over the selected time range.
    Primary/Secondary Switching Logs

View error 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.
    • Example 1:
      EXEC sp_rds_read_error_logs
    • Example 2:
      EXEC sp_rds_read_error_logs 0,1 ,'error'
  • If your RDS instance runs SQL Server 2017 or SQL Server 2019, run the sp_readerrorlog stored procedure to read error logs.

    Example:

    EXEC sp_readerrorlog