Problem creating oracle to sqlserver database link using intermediate server

Posted on 2014-08-19
Last Modified: 2014-08-26
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)

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 - Production on 19-AUG-2
014 11:39:34

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

Used parameter files:

Used HOSTNAME adapter to resolve the alias
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!
Question by:wscott30
    LVL 39

    Accepted Solution

    "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?

    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.
    LVL 5

    Expert Comment

    by:Sanjeev Labh
    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:

    Author Closing Comment

    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!

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    The Need In an Active Directory enviroment, the PDC emulator provide time synchronization for the domain. This is important since Active Directory uses Kerberos for authentication.  By default, if the time difference between systems is off by more …
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    This video shows how to recover a database from a user managed backup
    Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now