OPENROWSET From SQL to Oracle - sql-server

i'm trying to connect from sql server to oracle server with OPENROWSET for fetch data.
this is my query:
SELECT a.*
FROM OPENROWSET(N'OraOLEDB.Oracle', N'Data Source=Myip:Port/dbname';'User Id=user';'Password=pass;',
'select * FROM view WHERE value = ''102030'' ') AS a;
sql return below error:
OLE DB provider "OraOLEDB.Oracle" for linked server "(null)" returned
message "ORA-12154: TNS:could not resolve the connect identifier
specified". Msg 7303, Level 16, State 1, Line 23 Cannot initialize the
data source object of OLE DB provider "OraOLEDB.Oracle" for linked
server "(null)".
how can i fix this ?
I used Linked Server for fetch data but oracle table not small and it takes a long time to execute.

Related

SQLNCLI syntax error when using OPENROWSET in SQL Server 2019

SQLNCLI syntax when using OPENROWSET
We have been using this syntax when using OpenRowset to collect data from other SQL Server instances.
SELECT a.* FROM OPENROWSET('SQLNCLI', 'Server=MyServer;Database=Tasks; User Id=sa;Password=myPassword;','SELECT * FROM Patients') As a;
I am facing following some errors.
OLE DB provider "SQLNCLI" for linked server "(null)" returned message "Invalid authorization specification".
OLE DB provider "SQLNCLI" for linked server "(null)" returned message "Invalid connection string attribute".
The OLE DB provider "SQLNCLI" for linked server "(null)" reported an error. Authentication failed.
Cannot initialize the data source object of OLE DB provider "SQLNCLI11" for linked server "(null)".
I resolved my error using following query.
I replaced SQLCLI with MSDASQL and wrote driver name as SQL Server.
select a.* from openrowset('MSDASQL', 'Driver={SQL SERVER}; Server=MYINSTANCE;UID=mySQLUser; PWD=*******;', 'select * from sys.databases') as a

INSERT data From IBM i-series database table into SNOWFLAKE database table using Linked server connection

INSERT data From IBM i-series database (Created Linked server connection -SOFT) table into SNOWFLAKE database table (Created Linked server connection -SF_64)
Linked server connection(Created in One of the SQL server)
SOFT - linked server connection with IBM Iseries Database
SF_64 - linked server connection with IBM Iseries Database
INSERT INTO [SF_64].[PROD].[REPORTING].[DPMPPHY_SSIS_TESTING]
SELECT * FROM OPENQUERY(SOFT, 'SELECT * FROM ABC.DPMPPHY')
Getting below error wile executing above query in SQL server
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "MSDASQL" for linked server "SF_64" reported an error. The provider did not give any information about the error.
Msg 7312, Level 16, State 1, Line 1
Invalid use of schema or catalog for OLE DB provider "MSDASQL" for linked server "SF_64". A four-part name was supplied, but the provider does not expose the necessary interfaces to use a catalog or schema.
INSERT INTO OPENQUERY(SF_64,'SELECT * FROM REPORTING.DPMPPHY_SSIS_TESTING') SELECT *FROM OPENQUERY(SOFT,'SELECT * FROM ABC.DPMPPHY')

OLE DB provider "OraOLEDB.Oracle" for linked server returned message "ROW-00004: Invalid column datatype"

The following SQL running in SQL Server
select *
from openquery(oracle_ls,'select xmlelement("Test") from dual')
returns the error
OLE DB provider "OraOLEDB.Oracle" for linked server "oracle_ls" returned message "ROW-00004: Invalid column datatype".
How to return Oracle XML type via linked server?
OLEDB driver complains as the data type is not supported.
However when you convert the xml to string, it should work.
select * from openquery(oracle_ls,
'select xmlelement("Test").getstringval() from dual')

Call Oracle function with ref cursor output in SQL Server linked server?

How do I need to call an Oracle function with ref cursor output in a SQL Server linked server?
I used this statement:
SELECT *
FROM OPENQUERY(oracle, 'select * from functionname(''N'',''2016-11-01'')')
but I get this error
OLE DB provider "OraOLEDB.Oracle" for linked server "oracle" returned message "ORA-00933: SQL command not properly ended".
Msg 7321, Level 16, State 2, Line 33
An error occurred while preparing the query "select * from functionname('N','2016-11-01')" for execution against OLE DB provider "OraOLEDB.Oracle" for linked server "oracle".
Any help?
Maybe this will help?
Calling an Oracle function from SQL Server Linked Server
EXECUTE (Query, Parameters) AT LinkedServerName

Connect Oracle to SQL Server

I am trying to connect Oracle 9i database using SQL Management studio 2008.
I tried this but it doesn't work
EXEC sp_addlinkedserver 'OracleLinkedServer','Oracle','OraOLEDB.Oracle','TestDB';
EXEC sp_addlinkedsrvlogin 'OracleLinkedServer','false','SA','TestUsername','TestPassword';
I am able to create the linked server and it test correctly,
But when I execute this statement:
SELECT sysdate FROM OracleLinkedServer...dual;
...it gives an error:
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "OraOLEDB.Oracle" for linked server "OracleLinkedServer" reported an error. Provider caused a server fault in an external process.
Msg 7311, Level 16, State 2, Line 1
Cannot obtain the schema rowset "DBSCHEMA_TABLES" for OLE DB provider "OraOLEDB.Oracle" for linked server "OracleLinkedServer". The provider supports the interface, but returns a failure code when it is used.
You should UNCHECKED the Allow inprocess in OraOLEDB.Oracle provider under the Linked Servers node.

Resources