- Install either the 10g or 11g Oracle client on your Microsoft SQL Server, make sure you do an Administration installation, not just the run-time or instant client.
- I used the Net Configuration wizard to setup the TNSNAMES.ORA file with a reference to our primary Oracle server
- Restart your SQL Server, this confirms that all of the Oracle software can be found in the system path and by your SQL Server
- I opened Microsoft SQL Server Management Studio and then a New Query Window
- I executed the following T-SQL statement: EXEC sp_addlinkedserver 'APP_ABC', 'Oracle', 'OraOLEDB.Oracle', 'BIGDADDY'
- APP_ABC = the name I want to reference this connection as
- Oracle = name of the product I'm connecting to
- OraOLEDB.Oracle = This is the Oracle OLE DB provider, I wasn't able to get the Microsoft one to work correctly, but this one worked straight-away
- BIGDADDY = the TNS name that's setup to reference my Oracle server
- In my case, we wanted to have the Linked Server connection use a specifically created Oracle login account for the connection. I setup this account for my linked server by executing the following T-SQL statement: EXEC sp_addlinkedsrvlogin 'APP_ABC', false, NULL, 'APP_USER_ACCOUNT ', 'jDUEhdt73ndhD37dU'
- APP_ABC = name of the linked server connection
- false = tells the connection not to use the SQL Server login account to try and authenticate against the Oracle server
- NULL = sorry, I forget what this one is for
- APP_USER_ACCOUNT = Oracle user account for the Linked Server connection
- jDUEhdt73ndhD37dU = Oracle user account password for the Linked Server connection
- At this point you should be able to perform a SELECT query using something like: SELECT NAME FROM APP_ABC..SCOTT.TEAMS ORDER BY NAME;
- NAME = fields to select from the table
- APP_ABC = Linked Server connection
- .. = two dots to skip the catalog reference
- SCOTT = schema that has the table or view
- TEAMS = table to retrieve the data from
This how I configured the connection. Took me about an hour to figure out and setup, hopefully this will get you running much faster then that!
2 comments:
great ! it helped me a lot, I got it configured in a couple of minutes
If I dont come back to say thank you very much, am appreciative.
Thanks a bunch.
Post a Comment