Troubleshooting Guide: SQL Server Error 7212 — “Could Not Execute Procedure on Remote Server”
Why This Error Happens
Error 7212 typically occurs when SQL Server 2025 attempts to execute a remote stored procedure call (RPC) through a linked server, but the connection fails due to misconfigured linked server authentication, insufficient permissions on the remote instance, or the “RPC” and “RPC Out” options not being enabled on the linked server definition. This can also surface when the remote server name cannot be resolved, the remote SQL Server service is unreachable due to firewall restrictions on Windows Server 2025, or the login mapping between the local and remote instances is broken or uses mismatched credentials.
Step-by-Step Resolution Guide
Step 1: Verify Linked Server RPC Configuration
- Open SQL Server Management Studio (SSMS) and navigate to Server Objects > Linked Servers.
- Right-click the linked server, select Properties, and go to the Server Options page.
- Ensure both “RPC” and “RPC Out” are set to True.
- Alternatively, run the following T-SQL command:
EXEC sp_serveroption 'RemoteServerName', 'rpc', 'true';
EXEC sp_serveroption 'RemoteServerName', 'rpc out', 'true';
Step 2: Validate Login and Security Mapping
- Go to the Security page under Linked Server Properties.
- Confirm that “Be made using this security context” is configured with a valid remote login and password, or that “Impersonate” is checked if using matching Windows credentials.
- Test the mapped login manually on the remote server to confirm it has
EXECUTEpermissions on the target stored procedure. - Re-create the linked server login mapping if credentials appear stale:
EXEC sp_addlinkedsrvlogin 'RemoteServerName', 'false', 'LocalLogin', 'RemoteLogin', 'RemotePassword';
Step 3: Check Network Connectivity and Firewall Rules
- On Windows Server 2025, open Windows Defender Firewall with Advanced Security.
- Verify that inbound/outbound rules allow traffic on the SQL Server port (default 1433, or the custom port if configured).
- Test connectivity using:
Test-NetConnection -ComputerName RemoteServerName -Port 1433
- If using named instances, ensure the SQL Server Browser service is running on the remote machine.
Step 4: Confirm Remote Procedure Exists and Permissions Align
- Log directly into the remote SQL Server instance and confirm the stored procedure exists in the expected database/schema.
- Run
sp_helprotect 'ProcedureName'on the remote server to confirm the mapped login has EXECUTE rights. - Grant permissions if missing:
GRANT EXECUTE ON dbo.ProcedureName TO [RemoteLogin];
Step 5: Review SQL Server Error Logs for Underlying Cause
- Open SQL Server Configuration Manager or check
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG. - Look for authentication failures, timeout errors, or provider-specific messages tied to the linked server call.
- Cross-reference any OLE DB provider errors (e.g., Msg 7399) that may indicate the true root cause behind the 7212 failure.
Alternative or Verification Steps
- Run a manual test of the remote procedure call using
EXEC RemoteServerName.DatabaseName.dbo.ProcedureName;directly in SSMS to confirm the fix resolved the execution failure. - If the issue persists, drop and recreate the linked server entirely using
sp_dropserverfollowed bysp_addlinkedserver, ensuring the provider (e.g., MSOLEDBSQL) is up to date on Windows Server 2025.