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.
- You can view primary/secondary switchover logs only if your RDS instance runs SQL Server 2008 R2 with local solid-state drives (SSDs).
- Logs in this topic refer to error logs and primary/secondary switchover logs. For more information about transaction logs, see Back up an ApsaraDB RDS for SQL Server instance and Download the data and log backup files of an ApsaraDB RDS for SQL Server instance.
View logs by using the ApsaraDB RDS console
- Visit the RDS instance list, select a region above, and click the target instance 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 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_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
EXEC sp_rds_read_error_logs 0,1 ,'error'
- If your RDS instance runs SQL Server 2017 or 2019, run the
sp_readerrorlogstored procedure to read error logs.