OLE DB provider for linked server reported a chang

2019-04-16 16:42发布

问题:

I have a nightly job which is updates table by executing stored procedure but it keeps failing every 2-3 days.

DECLARE @return_value int

EXEC    @return_value = [dbo].[sp_SRA_Analysis_Union]

SELECT  'Return Value' = @return_value

Below is the error message:

Step Name       update table
Duration        00:00:30
Sql Severity        16
Sql Message ID      7359
Operator Emailed        
Operator Net sent       
Operator Paged      
Retries Attempted       0



      Message
Executed as user: NT AUTHORITY\SYSTEM. 
The OLE DB provider "SQLNCLI10" for linked server "SQL05" 
reported a change in schema version between 
compile time ("182390105529348") and 
run time ("182402990418943") for table "dbo"."CL_Midpoint"". 
[SQLSTATE 42000] (Error 7359).  The step failed.

Any idea/suggestions how to avoid this?

Thanks, AR

回答1:

Got the exact same error today. Did some research and found this: https://support.microsoft.com/en-us/kb/2498818

It appears to be a bug while using a linked server and synonym/aliases and/or views that refer to the linked server. In our case we had a linked server from SQL Server 2014 to SQL Server 2008R2. A reindex operation was run on a table that was being accessed using linked server (and the query was using a table alias for the linked server asset), we got this error.

Two things worked for me: 1. Just re-ran the SP and it worked fine. 2. Removed the table alias in the SP query and that resolved the issue for future too.



回答2:

Got it fixed with following sql query inside problem db:

DBCC FREEPROCCACHE WITH NO_INFOMSGS;  

where you delete the cache for the query that is causing the issue.