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 identify 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.
Usage notes
The first logs in this topic refer to error logs. For more information about transaction logs, see Back up an ApsaraDB RDS for SQL Server instance and Download data backup files and log backup files.
View error logs in the ApsaraDB RDS console
- Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
In the left-side navigation pane, click Logs.
On the Error Logs tab, select a time range to search for error logs.
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
- Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
- In the left-side navigation pane, click Service Availability.
- 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.
View error logs by using SQL statements
If your RDS instance runs SQL Server 2016 or earlier, 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 thesp_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