Blog

View Blog

Aug 20

Written by: Rainer Stropek
8/20/2007

A few days ago a customer told me that he has a problem when updating an Oracle table through a linked server in SQL 2005. The error message was:

Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server "..."

The statement that caused the error was:

UPDATE [MyOraLinkedServer]..[XYZ].[TABLE]
SET [DAT_COL] = cast (getdate() as smalldatetime)

The destination table contained just one single row. The update should change the column DAT_COL to the current date and time.

A solution for that problem is to use EXEC('...') AT MyOraLinkedServer instead of the UPDATE-statement I showed above:

declare @NewValue smalldatetime
set @NewValue = cast(getdate() as smalldatetime)
exec( 'update XYZ.TABLE set DAT_COL = ?', @NewValue ) at MyOraLinkedServer

To make this possible you have to enable RPC on the linked server:

Tags:

14 comments so far...

AW: Error 'Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server "..."'

super. danke für den tip. werde ich morgen gleich ausprobieren
lg, wilfried

By Anonymous on   3/7/2008

Re: Error 'Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server "..."'

this page has just saved my arse. i was having the exact same problem using sql server 2005 64 bit updating a table in oracle 8i and kept getting random bookmark errors. testing this code was a maddening process, because it would work about 1/2 the time. recoding the proc using the EXEC(sql, params) at linked server is not only stable but fast and saved this project from having to revert the database to sql server 2000.

By Anonymous on   3/7/2008

Re: Error 'Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server "..."'

Cool. Thanks.

By SJL on   4/23/2008

Re: Error 'Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server "..."'

I love you

By Mike Katchourine on   4/29/2008

Re: Error 'Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server "..."'

I changed Rpc and Rpc Out both to TRUE and now my update staement is working without having to wrap it in exec().

By Matt Ostrand on   10/17/2008

Re: Error 'Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server "..."'

False alarm. I still get the same error. Nuts.

By matt ostrand on   10/17/2008

Re: Error 'Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server "..."'

i love you so much!!!!!!!!!!!!!!!!!!!

By hamlock on   1/6/2009

Re: Error 'Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server "..."'

great thing.... you are my man of the week... thx

By pollux on   2/18/2009

Re: Error 'Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server "..."'

This is a simple and great solution. Avoids reinstalls of ole/odbc drivers. The sql seems to execute faster too. Thanks so much.

By Thillai on   6/22/2009

Re: Error 'Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server "..."'

Thanks,very nice solution

By Baruch Lvovsky on   8/10/2009

Re: Error 'Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server "..."'

You are awesome... I love you too!

By SMDF on   9/29/2009

Re: Error 'Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server "..."'

aaah your a godsend, accidentally oracle certification training over wrote my child nodes settings when i was installing php into iis.
struggled for like under security analyst training duress to see the difference.

the answer t all my problems:
"By the way, make sure, that “Verifx that file exists” is not checked, because Reporting Services generated the *.axd files on the fly. After commiting my server+ changes, all errors disappeared also in the Report Viewer control of asp.net"

didnt know that :)

By jhonydep on   2/1/2010

Re: Error 'Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server "..."'

I am currently having much difficulty setting up a linked server from a MS SQL 2005 64-bit on a Windows 2003 server.If you could specify how you did it, it would be of great help to me. I managed to establish a connection to my oracle from a ms sql 32 bit on another windows server, however this was using the msdaora provider wich to my knowledge is not available in the x64 windows 2003.
In the create new linked server i cannot choose oraoledb - how do I gain access to that provider?

http://www.bingo-training.de/

By Bingocard on   2/13/2010

Re: Error 'Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server "..."'

I am currently having much difficulty setting up a linked server from a MS SQL 2005 64-bit on a Windows 2003 server.If you could specify how you did it, it would be of great help to me. I managed to establish a connection to my oracle from a ms sql 32 bit on another windows server, however this was using the msdaora provider wich to my knowledge is not available in the x64 windows 2003.
In the create new linked server i cannot choose oraoledb - how do I gain access to that provider?

By Bingocard on   2/13/2010

Your name:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment    Cancel  

Newsletter

Sie möchten im Newsletter über aktuelle technische Entwicklungen und Neuigkeiten rund um cubido informiert werden?

Newsletter abonnieren ...

Blog