Linked Server Msg 7333
If you are getting this error and are trying to resolve it. Let me give you a little background information. A bookmark in this error is a left over from SQL Server 2005 SP1 and earlier. Bookmarks after 2005 SP1 is really a referred to as a key lookup, not to be confused with primary/foreign keys. From now on I am going to refer to bookmarks as key lookups so we are uniform and using the modern terminology.
Key lookups are objects within a query that refer to a data page (where the data is actually stored in the database) from a non-clustered index.
When SQL Server is executing DML (Insert, Update, Delete) against a linked server successfully for days, months, or even years and then fails with this error:
Cannot fetch a row using a bookmark from OLE DB provider (Msg 7333, Level 16, State 2)
Something in the query execution plan is wrong. So far I have only run into this problem using linked servers and it probably has to do with resource management within SQL Server. Perhaps someone could elaborate on this that has more experience than I. But within the query’s execution plan, SQL Server decides to switch to a different index to run the query. The query then fails because it is using an index that is lacking information to complete the request.
Ultimately, you have to do the following:
- Look at your where criteria in your query that is dependent on the linked server.
- Review indices on the table, that the where criteria is referring to.
- Is your one of your criteria covered by more than one index?
If you answered yes to number 3, there is a good chance that the behavior I am describing is actually causing your problem.
To diagnose this, disable one of the indexes that is in question.
NOTE: Never disable the clustered index, you will prevent data access to the table.
Run the query again, and it should work, if not rebuild the disabled index to bring it back online and then disable the other index. If the query works you are in business. Talk with your database administrator, developer, or vendor of the application to come up with a good solution. But this will temporarily get your query to work.