create Linked Server to Oracle DB - Is this TSQL Script correct? - Novice

  • Installed the Oracle 11g client on the SQL Server 2010 server. Using the Select Directory Server - the dengs.eo.com with the port xxxx shows Available = Yes

    PLMKR5 is the service name

    Quetion - is the script to use to create a linked table? It receives an error when trying to expand the Tables.

    USE [master]

    GO

    --Create the Oracle Linked Server:

    EXEC sp_addlinkedserver 'FinderFile14', 'Oracle', 'OraOLEDB.Oracle', 'PLMKR5.eo.com:1521/dengs'

    -- Actual names / un/ pw modified

    EXEC sp_addlinkedsrvlogin 'FinderFile14', 'FALSE', NULL, 'rm', 'rmX'

    The Oracle DBA sent this script to me:

    PLMKR5.DEN.EO.COM =

    (DESCRIPTION =

    (ADDRESS_LIST =

    (ADDRESS = (PROTOCOL = TCP)(HOST = dengs.eo.com)(PORT = 1521))

    )

    (CONNECT_DATA =

    (SERVICE_NAME = PLMKR5.DEN.EO.COM)

    )

    In SQL Server SSMS -the Providers list OraOLEDB.Oracle

    (this is a a new server, we didn't quite get the last one connected because it was an oracle verson 6)

    This server is Oracle 11g

  • i've edited my working oracle linked server connection with your info, so it seems to match how i've got mine set up:

    --#################################################################################################

    --Linked server Syntax for Oracle 10G

    --#################################################################################################

    DECLARE @server sysname,

    @srvproduct nvarchar(256),

    @provider nvarchar(256),

    @datasrc nvarchar(100),

    @location nvarchar(100),

    @provstr nvarchar(100),

    @catalog sysname,

    @sql varchar(1000)

    --add an access Database as a linked server

    SET @server = N'FinderFile14' --this is your ALias

    SET @srvproduct = N'Oracle'

    SET @provider = N'ORAOLEDB.Oracle' --optionally 'MSDAORA' to use the MS driver

    SET @datasrc = N'PLMKR5.DEN.EOGRESOURCES.COM' --this is the SID

    set @provstr = ''

    EXEC sp_addlinkedserver @server,@srvproduct,@provider,@datasrc,NULL,@provstr

    -- exec sp_dropserver AccessDb

    exec sp_addlinkedsrvlogin @rmtsrvname='FinderFile14',

    @useself = N'FALSE',

    @locallogin = 'sa',

    @rmtuser = N'CHANGE_ME',--oracle username

    @rmtpassword = 'NotARealOraclePassword' --oracle password

    /*

    exec sp_addlinkedsrvlogin @rmtsrvname='AccessDb',

    @useself='false',

    @rmtuser='Admin',

    @rmtpassword=''

    */

    --list all the tables and their names

    EXEC sp_tables_ex 'FinderFile14'

    GO

    EXEC dbo.sp_DropServer 'FinderFile14', 'DropLogins'

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Thank you! I changed it to FinderFile20 at each location.

    This is the error received. Was the non standard port number needed?

    OLE DB provider "ORAOLEDB.Oracle" for linked server "FinderFile20" returned message "ORA-12154: TNS:could not resolve the connect identifier specified".

    Msg 7303, Level 16, State 1, Procedure sp_tables_ex, Line 41

    Cannot initialize the data source object of OLE DB provider "ORAOLEDB.Oracle" for linked server "FinderFile20".

    Of interest, I have installed the Oracle Directory Manager on the SQL Server 2010 server.

    The Select Directory Server with the servername and port - shows the Available to be YES

    The Oracle Directory Manager Connect uses the server/port information and ask for user password

    Apply the UN / PW. The error is Bind Failed. Host = ' server info' Details: host;port socket closed

    The oracle admin claims he can log in as me (using different software to log in).

  • I am back and struggling again. Suspecting there is a step missing before the script is run?

    They dropped the server before I could connect. Now, have a new server.

    Have uninstalled and re-installed Oracle ODBC Driver Release 11.2.01.0 on the SQL Server to match the new 11g.

    Tried to use the Oracle Internet Directory with the User ID, Password, the Port number, and the server name (ServerName.Company.com) they provided. The error is Server is not up and running (server name/port)

    Oracle.ldap.admin.common.saveChanggeException

    Searching on the internet, it indicates that some type of 'Listener" must be installed?

    This is what they sent (with PW, UserID, port)

    See if these tnsnames help.

    PN.coname.COM =

    (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = scanpr04)(PORT = xxx))

    (LOAD_BALANCE = YES)

    (CONNECT_DATA =

    (SERVER = DEDICATED)

    (SERVICE_NAME = PO_TAF.coname.COM)

    (FAILOVER_MODE =

    (TYPE = SELECT)(METHOD = BASIC)(RETRIES = 180)(DELAY = 5)

    )

    )

    )

    The script above returns

    The server 'PN.coname.COM' does not exist. as indicated by the Oracle Internet Directory

    My Linked Servers - Providers show OraOLEDB.Oracle 10.50.2500 SP1 I think the new server is 11g, so I might be behind one version.

    DECLARE @server sysname,

    @srvproduct nvarchar(256),

    @provider nvarchar(256),

    @datasrc nvarchar(100),

    @location nvarchar(100),

    @provstr nvarchar(100),

    @catalog sysname,

    @sql varchar(1000)

    --add an access Database as a linked server

    SET @server = N'Na1' --this is your ALias

    SET @srvproduct = N'Oracle'

    SET @provider = N'MSDAORA.Oracle' --Tried both 'MSDAORA' to use the MS driver or N'ORAOLEDB.Oracle

    SET @datasrc = N'PN.CoNAME.COM' --this is the SID

    set @provstr = ''

    EXEC sp_addlinkedserver @server,@srvproduct,@provider,@datasrc,NULL,@provstr

    -- exec sp_dropserver AccessDb

    exec sp_addlinkedsrvlogin @rmtsrvname='PN.CoName.COM',

    @useself = N'FALSE',

    @locallogin = 'MyUNOnsql',

    @rmtuser = N'UserNameHere',--oracle username

    @rmtpassword = 'PasswordHere' --oracle password

    /*

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply