My Oracle Support Banner

ORA-12560 Attempting to Query the Oracle Database From Microsoft SQL Server's SQL Query Analyzer Using the Oracle Provider for OLE DB (Doc ID 260775.1)

Last updated on FEBRUARY 17, 2019

Applies to:

Oracle Provider for OLE DB - Version 9.2.0.8 and later
Microsoft Windows (32-bit)
***Checked for relevance on 10-Oct-2013***

Symptoms

NOTE: In the images and/or the document content below, the user information and data used represents fictitious data from the Oracle sample schema(s) or Public Documentation delivered with an Oracle database product. Any similarity to actual persons, living or dead, is purely coincidental and not intended in any manner.

You are using Microsoft's SQL Server to retrieve information from Oracle using SQL Server's "OpenRowset" Transact-SQL function in SQL Query Analyzer.  You are using the Oracle Provider for OLE DB to connect to Oracle.  You are attempting to execute the following SELECT statement:

     SELECT * FROM OpenRowset('OraOLEDB.Oracle','orcl';'scott';'tiger',SCOTT.EMP) WHERE ename='MILLER' AND sal>0

and receive one of the these errors:

     Server: Msg 7320, Level 16, State 2, Line 3
     Could not execute query against OLE DB provider 'OraOLEDB.Oracle'.
     OLE DB error trace [OLE/DB Provider 'OraOLEDB.Oracle' ICommandText::Execute
       returned 0x80040155].

or

     Server: Msg 7399, Level 16, State 1, Line 1
     OLE DB provider 'ORAOLEDB.Oracle' reported an error.  
     [OLE/DB provider returned message: ORA-12560: TNS:protocol adapter error]
     OLE DB error trace [OLE/DB Provider 'ORAOLEDB.Oracle'
       IDBInitialize::Initialize returned 0x80004005:   ].


The query works when executed through SQL Server's Linked Server in the following form:

     SELECT * FROM [linked_server_name]..[SCOTT].[EMP] WHERE ename='MILLER' AND sal>0

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.