This topic describes how to manage the error logs, slow query logs, and primary/secondary instance switching logs of an ApsaraDB for RDS SQL Server instance through the ApsaraDB for RDS console or by using SQL statements. The logs help you locate faults.
View logs through the ApsaraDB for RDS console
Your RDS instance runs SQL Server 2008 R2.
- Log on to the ApsaraDB for RDS console.
- In the upper-left corner of the console, select the region where the target RDS instance resides.
- Find the target RDS instance and click its ID.
- In the left-side navigation pane, click Logs.
- On the Logs page that appears, click the Error Log, Slow Query Log Summary, or Primary/Secondary
Instance Switching Log tab, select a time range, and click Search.
Tab Description Error Log Records database running errors that occurred within the last month. Slow Query Log Summary Provides statistics and analysis reports on SQL statements that each took more than 1 second to run within the last month. You can change this 1-second threshold by reconfiguring the long_query_time parameter. Primary/Secondary Instance Switching Log Records switchovers between the primary and secondary instances triggered within the last month.
View logs by using SQL statements
Your RDS instance runs one of the following three SQL Server versions:
- SQL Server 2012
- SQL Server 2016
- SQL Server 2017
If your RDS instance runs SQL Server 2012 or SQL Server 2016, execute the
sp_rds_read_error_logs stored procedure to read error logs. This stored procedure operates in a way similar
sp_readerrorlog stored procedure.
EXEC sp_rds_read_error_logs 0,1 ,'error'
If your RDS instance runs SQL Server 2017, execute the
sp_readerrorlog stored procedure to read error logs.