Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1352
  • Last Modified:

Problem creating oracle to sqlserver database link using intermediate server

Objective:  
Create database link from Oracle (database=PDASH) to SQLServer dev-sqlva (database=WAREPORT) using  intermediate SQLServer stag-bobj.  I have been told by our DBAs that the Oracle listener needs to reside on a separate server than the target SQLServer database, hence the need for an ‘intermediate’ server.  We have gotten this configuration to work previously, but something is preventing us from succeeding this time.

Setup / Configuration:
+++++++++++   On intermediate server (stag-bobj) ++++++++++++++++++++++
1. Installed Oracle 11g database server software for Windows 64bit.
2. Using $ORACLE_HOME\bin\netca - created listener configuration and started listener service.  
3. Configured HS (Heterogeneous Services)
4. Create System DSN entry in ODBC config manager 'dev_wareport' pointing to dev-sqlva,
using SQL server driver (6.01.) and user PDASH/PDASH for login

+++++++++++   On dev-sqlva  (WAREPORT)  server+++++++++++++++++++++++++++++++++
5. Create user PDASH/PDASH in SQL server database - WAREPORT. User should have read access to required tables.

+++++++++++   On Oracle Database (PDASH) server  +++++++++++++++++++++++++++++++++
6. Run script in Oracle database PDASH as sys to create HS Data Dictionary.
7. Add tnsnames.ora entry on PDASH database server pointing to stag-bobj.
8. Login as user pdash/pdash to PDASH database  and create db link.
-- use the same userid (PDASH) as in SQL server (step #5) and ODBC entry (step #4)

Problem:  
The DbLink is not working.  After going through the steps above and doing a tnsping from stag-bobj I get this….
C:\OracleDB64\product\11.2.0\dbhome_1\BIN>tnsping dev-sqlva

TNS Ping Utility for 64-bit Windows: Version 11.2.0.1.0 - Production on 19-AUG-2
014 11:39:34

Copyright (c) 1997, 2010, Oracle.  All rights reserved.

Used parameter files:
c:\OracleDB64\product\11.2.0\dbhome_1\network\admin\sqlnet.ora

Used HOSTNAME adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTO
COL=TCP)(HOST=172.23.40.23)(PORT=1521)))
TNS-12541: TNS:no listener

.....When I check the Component Services on stag-bobj, it shows the listener as ‘Started’.  When I attempt to query the target WAREPORT database on dev-sqlva, while logged in as PDASH/PDASH in the PDASH  database,  I get this….

select count (*) from wareport.doi_stat@WAREPORT;

[1]: ORA-00942: table or view does not exist
[1]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Invalid object name 'WAREPORT.DOI_STAT'. {42S02,NativeErr = 208}[Microsoft][SQL Server Native Client 10.0][SQL Server]Statement(s) could not be prepared. {42000,NativeErr = 8180}
[1]: ORA-02063: preceding 2 lines from WAREPORT


Please see attachment for further details.  Thanks!
Problem-Description.docx
0
wscott30
Asked:
wscott30
1 Solution
 
lcohanDatabase AnalystCommented:
"Invalid object name" - can you try to run a SELECT from a different object in the WAREPORT database but make sure you include the ORACLE linked server name? Some simple select against a small table?
Like

SELECT * FROM OraLinkedServer.WAREPORT.SchemaName.TableName

I usually install ONLY the ORA client and tnsnames.ora config file  on the SQL Server and create a linked server from there to ORACLE and use full (four) name qualifier further on to access ORA object in SQL queries.
0
 
Sanjeev LabhCommented:
The Oracle listener need not be on a separate server. However, it needs an Oracle gateway for SQL server installed and tnsnames.ora to be configured accordingly.

Details of oracle gateways can be found in the below doc:

http://docs.oracle.com/cd/E11882_01/gateways.112/e12070.pdf
0
 
wscott30Author Commented:
Sorry about the delay. This got me what I needed in a roundabout way. When I created the ODBC on the intermediate server, I neglected to change the default database from 'master' to the database that I wanted - 'wareport'.  Thanks a bunch!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now