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.
View logs by using the ApsaraDB RDS console
Before you perform the following steps, make sure that your RDS instance runs SQL Server 2008 R2.
- Log on to the ApsaraDB for RDS console.
- In the left-side navigation pane, click Instances. In the top navigation bar, select the region where your RDS instance resides.
- Find your RDS instance and click its ID.
- In the left-side navigation pane, click Logs.
- On the Logs page, click the Error Logs or Primary/Secondary Switching Logs tab, select a time
range, and then click Search.
Tab Description Error Logs Provides database running errors that occurred over the last month. Primary/Secondary Switching Logs Provides information about primary/secondary switchovers that occurred over the last month.
View logs by using SQL statements
Before you perform the following operations, make sure that your RDS instance runs an SQL Server version other than SQL Server 2008 R2:
- If your RDS instance runs SQL Server 2016 or an earlier version, run the
sp_rds_read_error_logsstored 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
- Example 1:
- Example 2:
EXEC sp_rds_read_error_logs 0,1 ,'error'
- Example 1:
- If your RDS instance runs SQL Server 2017, run the
sp_readerrorlogstored procedure to read error logs.