ApsaraDB RDS for SQL Server keeps a secondary instance synchronized with the primary in real time. If the primary instance fails, the system automatically promotes the secondary to primary and your application reconnects using the same endpoint — no changes to connection strings required. For planned maintenance, upgrades, or disaster recovery drills, you can also trigger a switchover manually.
Prerequisites
Before you begin, ensure that you have a primary RDS instance running RDS High-availability Edition or RDS Cluster Edition.
Edition-specific limitations apply:
RDS Cluster Edition: only automatic switchovers are supported. To perform a manual switchover, contact Alibaba Cloud technical support.
RDS Basic Edition: no secondary instance is provided, so the primary/secondary switchover feature is not supported.
How it works
The primary instance handles all read and write traffic. The secondary instance runs in standby and continuously replicates data from the primary. You cannot access the secondary instance directly.
When a switchover occurs — automatically or manually — the secondary is promoted to primary. The endpoint used to connect to your database does not change, though the IP addresses associated with the endpoint may change. If your application connects using the endpoint, it continues to work after the switchover.
Edition behavior
Edition | Automatic switchover | Manual switchover |
High-availability Edition | Supported (enabled by default) | Supported |
Cluster Edition | Supported (enabled by default) | Not supported — contact Alibaba Cloud technical support |
Basic Edition | Not supported | Not supported |
What triggers an automatic switchover
If the primary instance fails, the system automatically switches your workloads over to the secondary instance. For a complete list of causes, see Reasons for primary/secondary switchovers.
Limitations
Serverless instances: Serverless RDS instances do not support manual switchovers. The system automatically handles failover for serverless instances. For details, see Overview.
ALTER LOGIN synchronization: The primary/secondary synchronization mechanism does not replicate all parameters in the
ALTER LOGINstatement. OnlySID,login_name, andpasswordare synchronized. All otherALTER LOGINparameters revert to their default values on the secondary instance. For the full parameter reference, see ALTER LOGIN (Transact-SQL).
Impacts of a switchover
Before performing a switchover, be aware of the following:
Service interruption: A switchover causes approximately 30 seconds of downtime. Configure your application to automatically reconnect to the database after a disconnection. If your application uses the Druid connection pool, upgrade Druid to version 1.1.16 or later. Earlier versions may fail to reconnect automatically after a disconnection.
Read-only instance replication lag: After a switchover, read-only instances re-establish their replication connections to the new primary. Expect a replication lag of a few minutes during this period.
Restricted operations during switchover: While a switchover is in progress, you cannot manage databases and accounts or change the network type.
Longer switchover during failures: A switchover triggered by an instance failure may take longer than a planned manual switchover.
IP address changes: The endpoint remains the same, but the IP addresses associated with the endpoint may change. Applications that connect using the endpoint are not affected.
When to perform a manual switchover
Consider a manual switchover in the following situations:
Maintenance and upgrades: Control when a switchover occurs to minimize the impact of planned maintenance.
Disaster recovery drills: Validate that your application handles failover correctly before an actual failure occurs.
Multi-zone proximity: If your instance uses multi-zone deployment and you want your application to connect to the zone closest to it, switch the primary to that zone.
Perform a manual switchover
Go to the Instances page. In the top navigation bar, select the region where your RDS instance resides. Find the instance and click its ID.
In the left-side navigation pane, click Service Availability.
In the Availability Information section, click Switch Primary/Secondary Instance.
Specify when to perform the switchover, then click OK.
NoteSelect Within Specified Time Range to avoid triggering the switchover during peak hours. During the switchover, operations such as managing databases and accounts or changing the network type are unavailable.
Temporarily disable automatic switchovers
By default, automatic switchovers are enabled. If the primary instance fails, the system switches over immediately. In some situations, you may want to suppress automatic switchovers for a limited period — for example, during a large-scale sales promotion, a major application upgrade, or a critical event window where an unexpected switchover could disrupt availability.
Go to the Instances page. In the top navigation bar, select the region where your RDS instance resides. Find the instance and click its ID.
In the left-side navigation pane, click Service Availability.
In the Availability Information section, click Automatic Primary/Secondary Switchover.
NoteIf Automatic Primary/Secondary Switchover is not visible, verify that your instance meets all prerequisites.
Select Temporarily Disable, set the Deadline, and click OK.
NoteWhen the deadline is reached, automatic switchovers are re-enabled automatically. If you leave the Deadline blank, the feature is disabled for one day. The maximum deadline is 23:59:59, seven days from now.
After saving, the Service Availability page shows the deadline after which automatic switchovers resume.
View primary/secondary switchover logs
Switchover logs are only available for instances running SQL Server 2008 R2 with Premium Local SSDs.
Go to the Instances page. In the top navigation bar, select the region where your RDS instance resides. Find the instance and click its ID.
In the left-side navigation pane, click Service Availability.
In the Primary/Secondary Switching Logs section, select a time range to view the switchover logs generated during that period.

FAQ
Do I need to switch back to the original primary instance after a switchover?
No. After a switchover, the secondary instance becomes the new primary and serves all traffic. Both instances maintain identical data through real-time synchronization, so no manual switch-back is needed.
My application runs slowly for about 10 minutes after a switchover. What causes this?
This typically happens because your application holds persistent connections that are not automatically closed when the switchover occurs. Without a socket timeout configured, your application waits indefinitely for the database to respond — connections appear open but cannot serve requests. Most applications disconnect after several minutes, during which SQL statements fail.
To reduce recovery time, configure the connectTimeout and socketTimeout parameters. For online transaction workloads, set connectTimeout to 1–2 seconds and socketTimeout to 60–90 seconds. Adjust these values based on your workload characteristics.
API reference
Operation | Description |
Switches workloads between primary and secondary nodes | |
Enables or disables automatic primary/secondary switchovers for an instance | |
Queries the automatic primary/secondary switchover settings for an instance |