SQL Server Linked Servers
Section titled “ SQL Server Linked Servers”Master SQL Server Linked Server configuration for Nodinite distributed environments. This comprehensive guide covers linked server setup, RPC configuration, Always On Availability Groups (AOAG), failover clusters, security contexts, and troubleshooting common connectivity issues.
What you'll learn on this page:
✅ When linked servers are required for Nodinite deployments
✅ Configure linked servers for default instances, named instances, clusters, and AOAG
✅ Enable RPC and RPC Out for distributed transactions
✅ Set up security contexts for Windows authentication
✅ Troubleshoot common linked server connectivity and authentication issues
Overview
Section titled “ Overview”SQL Server Linked Servers enable Nodinite to query databases across multiple SQL Server instances. The Configuration Database uses linked servers to access Log Databases, BizTalk tracking databases, and other remote SQL resources. Even when databases reside on the same SQL Server instance, linked servers must be configured for Nodinite to function correctly.
Which Nodinite Services Use Linked Servers?
Section titled “Which Nodinite Services Use Linked Servers?”Only specific Nodinite services access databases through linked servers:
- ✅ Logging Service — Fetches log data from Log Databases and BizTalk tracking databases
- ✅ Monitoring Service — Retrieves monitoring data from Log Databases
- ✅ Log API — Accesses log data through linked servers
- ✅ Web API — Queries databases through linked servers
What Is a Linked Server?
Section titled “What Is a Linked Server?”A linked server is a SQL Server object that allows you to execute queries against remote SQL Server instances (or other OLE DB data sources) as if they were local. Nodinite relies on linked servers to maintain a consistent architecture regardless of database distribution.
Architecture Overview
Section titled “Architecture Overview”Diagram: the Nodinite Configuration Database connects to local and historical ("SQL Server Hotel") Log Databases, and to the BizTalk databases read by the BizTalk Server Logging Agent, through Linked Servers configured with RPC and RPC Out.
When Are Linked Servers Required?
Section titled “When Are Linked Servers Required?”- ✅ Always — Even when Configuration Database and Log Databases are on the same SQL Server instance
- ✅ Configuration Database accessing Log Databases on remote SQL Server instances
- ✅ Configuration Database accessing BizTalk databases (BizTalkMGMTDb, BizTalkDTADb) for logging agents
- ✅ Configuration Database accessing Dynamics 365 databases for monitoring
- ✅ Any scenario where Nodinite Core Services query databases across SQL instances
When Are Linked Servers Not Required?
Section titled “When Are Linked Servers Not Required?”- ❌ Never — Linked servers are always required for Nodinite to function, regardless of database distribution
Configuration Requirements
Section titled “ Configuration Requirements”Core Linked Server Settings
Section titled “Core Linked Server Settings”All linked server configurations for Nodinite must have:
- Server name — Exact name of the SQL Server instance (see Naming Conventions below)
- Security context — "Be made using the login's current security context" (passthrough authentication)
- RPC enabled —
rpc = true - RPC Out enabled —
rpc out = true
Security Context: Passthrough Authentication
Section titled “Security Context: Passthrough Authentication”Nodinite uses passthrough authentication where the Logging Service, Monitoring Service, and other Core Services maintain the identity of their service account when traversing linked servers.
Configuration: "Be made using the login's current security context"
Benefits
Section titled “Benefits”- ✅ Consistent security model across all linked servers
- ✅ Windows Integrated Security with Kerberos authentication
- ✅ No need to store SQL credentials in linked server definitions
- ✅ Centralized service account management
Requirements
Section titled “Requirements”- ✅ Service accounts must have SQL Server login rights on all linked instances
- ✅ Trusted for delegation configured for multi-hop authentication
- ✅ Service Principal Names (SPN) registered for Kerberos
- ✅ Firewall ports open (see SQL Server Firewall Configuration)
Creating Linked Servers
Section titled “ Creating Linked Servers”SQL Script Template
Section titled “SQL Script Template”Use the following template to create a linked server (replace %SERVER\INSTANCE% with your actual server name):
-- Add the linked serverEXEC sp_addlinkedserver @server = '%SERVER\INSTANCE%';
-- Enable RPCEXEC sp_serveroption '%SERVER\INSTANCE%', 'rpc', true;
-- Enable RPC OutEXEC sp_serveroption '%SERVER\INSTANCE%', 'rpc out', true;Examples
Section titled “Examples”Default Instance (localhost)
Section titled “Default Instance (localhost)”EXEC sp_addlinkedserver @server = 'LOCALHOST';EXEC sp_serveroption 'LOCALHOST', 'rpc', true;EXEC sp_serveroption 'LOCALHOST', 'rpc out', true;Named Instance (localhost)
Section titled “Named Instance (localhost)”EXEC sp_addlinkedserver @server = 'LOCALHOST\BIZTALK';EXEC sp_serveroption 'LOCALHOST\BIZTALK', 'rpc', true;EXEC sp_serveroption 'LOCALHOST\BIZTALK', 'rpc out', true;Remote Server (Default Instance)
Section titled “Remote Server (Default Instance)”EXEC sp_addlinkedserver @server = 'SQL-PROD-01';EXEC sp_serveroption 'SQL-PROD-01', 'rpc', true;EXEC sp_serveroption 'SQL-PROD-01', 'rpc out', true;Remote Server (Named Instance)
Section titled “Remote Server (Named Instance)”EXEC sp_addlinkedserver @server = 'SQL-PROD-01\BIZTALK';EXEC sp_serveroption 'SQL-PROD-01\BIZTALK', 'rpc', true;EXEC sp_serveroption 'SQL-PROD-01\BIZTALK', 'rpc out', true;
Example of a linked server in SSMS, expanded to list the databases on the remote instance.
Naming Conventions
Section titled “ Naming Conventions”The linked server name must match the SQL Server instance name format. Use the following conventions based on your environment:
Nodinite reads the Linked Server name it uses from the LinkedServerName property of the SqlServer System Parameter, so the Linked Server you create must have exactly that name.
Default Instance
Section titled “Default Instance”| Environment | Linked Server Name |
|---|---|
| Stand Alone | localhost OR ServerName |
| Fail-Over Cluster | localhost OR ClusterName |
| Always On (AOAG) | ListenerName |
Named Instance
Section titled “Named Instance”| Environment | Linked Server Name |
|---|---|
| Stand Alone | localhost\instancename OR ServerName\instancename |
| Fail-Over Cluster | localhost\instancename OR ClusterName\instancename |
| Always On (AOAG) | ListenerName\instancename |
Always On Availability Groups (AOAG)
Section titled “ Always On Availability Groups (AOAG)”If your SQL Server environment is configured with Always On Availability Groups, additional configuration is required for linked servers.
Listener Names
Section titled “Listener Names”Always use the AOAG listener name when creating linked servers for availability group databases. This ensures connections automatically fail over to the active replica without manual intervention.
Example
Section titled “Example”-- Correct: Use listener nameEXEC sp_addlinkedserver @server = 'SQL-AOAG-Listener';
-- Incorrect: Don't use individual node names-- EXEC sp_addlinkedserver @server = 'SQL-Node-01';SQL Accounts Are Not Replicated
Section titled “SQL Accounts Are Not Replicated”SPN Configuration for AOAG
Section titled “SPN Configuration for AOAG”Proper Service Principal Names (SPN) registration is critical for Always On Availability Groups. You must register SPNs for:
- ✅ AOAG listener name (with and without port)
- ✅ Each physical node name (with instance port)
- ✅ Each instance name on each node
DNS Suffix Considerations
Section titled “DNS Suffix Considerations”Failover Clusters
Section titled “ Failover Clusters”If your SQL Server environment is configured with failover clustering, you need to review the following additional requirements:
Cluster Name vs. Node Names
Section titled “Cluster Name vs. Node Names”Use the cluster virtual network name when creating linked servers, not individual node names. This ensures connections work regardless of which node currently owns the SQL Server resource.
Example
Section titled “Example”-- Correct: Use cluster nameEXEC sp_addlinkedserver @server = 'SQL-Cluster';
-- Incorrect: Don't use individual node names-- EXEC sp_addlinkedserver @server = 'SQL-Node-01';MSDTC Configuration
Section titled “MSDTC Configuration”Failover clusters require special Microsoft Distributed Transaction Coordinator (MSDTC) configuration to support distributed transactions across cluster nodes.
Linked Servers on Each Node
Section titled “Linked Servers on Each Node”Required Linked Servers for Nodinite
Section titled “ Required Linked Servers for Nodinite”Before installing Nodinite, a SQL DBA must create the following linked servers on the Configuration Database SQL instance:
Core Services (Always Required)
Section titled “Core Services (Always Required)”- Configuration Database → Local Log Databases — Even when on same instance
- Configuration Database → Remote Log Databases — If Log Databases on different SQL instance(s)
BizTalk Logging Agents
Section titled “BizTalk Logging Agents”If using the Nodinite BizTalk Server Logging Agent to log BizTalk Server events:
- Configuration Database → BizTalk Management Database (BizTalkMGMTDb)
- Configuration Database → BizTalk Tracking Database (BizTalkDTADb)
Dynamics 365 Monitoring
Section titled “Dynamics 365 Monitoring”If using the Nodinite Dynamics 365 Monitoring Agent to monitor Dynamics 365:
- Configuration Database → Dynamics 365 Database(s)
Custom Integrations
Section titled “Custom Integrations”If using Nodinite to monitor custom databases:
- Configuration Database → Custom Application Databases (as needed)
Troubleshooting
Section titled “ Troubleshooting”Common Issues
Section titled “Common Issues”| Issue | Cause | Solution |
|---|---|---|
| "RPC remote procedure call" error | RPC or RPC Out not enabled | Verify sp_serveroption for both rpc and rpc out set to true |
| "Cannot generate SSPI context" | Missing or duplicate SPNs | See SPN troubleshooting guide |
| "Anonymous login" errors | Delegation not configured | See Trusted for delegation guide |
| Linked server fails after AOAG failover | Using node name instead of listener | Recreate linked server using AOAG listener name |
| Timeout connecting to linked server | Firewall blocking ports | See SQL Server Firewall Configuration |
| "The certificate chain was issued by an authority that is not trusted", or linked server fails after a SQL Server upgrade | Old provider or options, or encryption without a trusted certificate | Recreate the linked server with encryption |
| "Login failed for user" | Service account lacks SQL rights | Grant appropriate database roles on remote instance |
Testing Linked Server Connectivity
Section titled “Testing Linked Server Connectivity”Test a linked server query:
-- Test basic connectivitySELECT @@SERVERNAME AS LinkedServerName;
-- Test through linked server (replace LINKEDSERVERNAME)SELECT * FROM [LINKEDSERVERNAME].[master].[sys].[databases];
-- Test RPC is enabledEXEC sp_helpserver;Expected output for sp_helpserver:
The rpc and rpc out columns should show true for the linked server.
Validation Checklist
Section titled “Validation Checklist”After creating linked servers, verify:
- ✅ Linked server appears in SSMS under Server Objects → Linked Servers
- ✅ Can expand linked server to see remote database list
- ✅
sp_helpservershowsrpcandrpc out=true - ✅ Test query returns results without errors
- ✅ Service account has login rights on remote SQL instance
- ✅ Trusted for delegation configured (for distributed environments)
- ✅ SPNs registered (for distributed environments)
- ✅ Firewall ports open between SQL instances
Data Flow Architecture
Section titled “ Data Flow Architecture”Understanding how Nodinite uses linked servers helps troubleshoot connectivity issues. The Architecture Overview above shows the linked servers between the databases; this diagram adds the Core Services that call the Configuration Database:
Diagram: the Nodinite Log API, Web API, Logging Service, and Monitoring Service (each its own IIS web site on Windows Server) access the Configuration Database, which uses Linked Servers to query the Log Databases. The ports for each hop are on the SQL Server Firewall Configuration page.
Related Guides
Section titled “ Related Guides”Prerequisites and Configuration
Section titled “Prerequisites and Configuration”- Configuration Database Prerequisites
- Log Database Prerequisites
- SQL Server Connection Strings
- SQL Server Firewall Configuration
Security and Authentication
Section titled “Security and Authentication”- Service Principal Names (SPN) — Kerberos authentication for linked servers
- Trusted for delegation — Multi-hop authentication configuration
- MSDTC — Distributed transaction coordinator
Advanced Scenarios
Section titled “Advanced Scenarios”- Always On Availability Groups — AOAG-specific configuration
- Linked Server RPC and RPC OUT option — Deep dive into RPC settings
Next Steps
Section titled “ Next Steps”- Service Principal Names (SPN)
- Trusted for delegation
- Always On Availability Groups
- Linked Server RPC and RPC OUT option
Related Topics
Section titled “ Related Topics”- SQL Server Troubleshooting
- SQL Server Database Migration — Recreate linked servers after a move or SQL Server upgrade
- Configuration Database
- Log Databases
- SQL Server Connection Strings
- SQL Server Firewall Configuration
- MSDTC
- Nodinite Installation
- SqlServer System Parameter