- Newest
- Most votes
- Most comments
The issue you're experiencing with the linked server connection to your Multi-AZ RDS SQL Server instance is likely related to the use of the DNS name, which resolves to multiple IP addresses in a Multi-AZ setup. While using the DNS name is generally recommended to protect against IP address changes, it can sometimes cause intermittent connectivity issues in linked server configurations.
When you use the Multi-AZ DNS name in your linked server script, SQL Server may attempt to connect to either the primary or secondary instance, depending on how the DNS resolves at that moment. This can lead to inconsistent behavior, where the test connection works sometimes and fails at other times.
The fact that your test linked server using the specific IP address of the Multi-AZ RDS instance works consistently supports this theory. However, it's important to note that using an IP address directly is not recommended for long-term use with RDS instances, as the IP address can change during maintenance events or instance modifications without notice.
To address this issue, you have a few options:
-
Use the instance-specific endpoint (DNS name) of the primary instance in your Multi-AZ setup for the linked server configuration. This endpoint always points to the current primary instance, even after a failover.
-
Implement a custom solution that periodically checks and updates the linked server configuration to ensure it's pointing to the current primary instance.
-
If possible, consider using alternative methods for data access between your SQL Server instances, such as replication or ETL processes, which may be more resilient to Multi-AZ failovers.
It's also worth noting that in a Multi-AZ deployment, linked servers are not automatically replicated to the secondary instance. If you need linked servers on both instances, you'll need to create them manually on the primary, fail over to the secondary, and then create them again on the new primary to ensure they exist on both instances.
Remember to monitor your linked server connections closely and implement appropriate error handling in your applications to manage potential connectivity issues.
Sources
Implement Linked Servers with Amazon RDS for Microsoft SQL Server | AWS Database Blog
answered 2 years ago
Can we add the MultiSubnetFailover=Yes in linked server script for RDS.
answered 2 years ago
Relevant content
asked 4 years ago
asked 3 years ago
