Friday, July 20, 2007

Configuring Connection from MS SQL 2005 (x64) to Oracle 10g (x64) on Windows 2003 Server (x64)

These 3 links have helped me to configure access to Oracle from MS SQL on Windows 2003 Server (x64):
Troubleshooting Oracle Publishers
Linked server from MSSQL2005 64 bit to Oracle (in Russian)
SSIS & Oracle (in Russian)

Now, here are the steps:

1. Download and install Oracle Data Access Components (ODAC) x64.
2. Place correct sqlnet.ora and tnsnames.ora to the network\admin folder of the ODAC home.
3. Run Oracle Universal Installer, select Installed Products->Environment and place the ODAC home to the top.
4. Restart the computer.
5. Open SQL Server Management Studio
- Provide the Server Name, Authentication, Username and Password to connect to your SQL Server at the dialog box. This will authenticate you and log you into Management Studio.
- Expand the Server Objects folder by clicking on the + sign
- Now, expand the Linked Servers folder and you will see Providers folder. Expand the Providers folder. You will see Oracle Provider for OLEDB. Right click on it and go to Properties. Check the check boxes for "Dynamic Parameters" and "Allow InProcess". Click OK and the dialogue box will close.
- Next, right click on the Linked Servers folder and choose New Linked Server
- In the New Linked Server Properties dialogue box, do the following:
----- Type in a Linked Server Name, for this example, we will call it 'Tiger'
----- Under Server Type, select Other Data Sources - for the provider name, select Oracle Provider for OLEDB
----- In the Data Source field, type in the Oracle Service name (SQL Net Alias)
----- In the Product Name field, type in "Oracle"
----- Leave Provider String blank.
- Now, click on the "Security option" on the left pane.
----- Select the radio button "Be made using this security context" at the bottom of the box.
----- Type in the User ID (your Oracle login), ie. Scott in the "Remote login" field and your Password, ie. Tiger in the "With Password" field.
- Go to the "Server Options" tab in the Linked Server Properties.
----- While leaving the default selections selected, also click on "Collation Compatible". Select "true" from the drop down button.
----- Click OK. This will create your Linked Server named Tiger.
6. Verify that the registry settings at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC\MTxOCI and
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSDTC\MTxOCI
are correct:
OracleOciLib = oci.dll
OracleSqlLib = orasql10.dll
OracleXaLib = oraclient10.dll
7. If the Oracle OLEDB provider is installed, make sure that it is registered. To register the provider DLL, execute the following command from the directory in which the DLL is installed, and then stop and restart the SQL Server instance:
regsvr32 OraOLEDB10.dll or regsvr32 OraOLEDB.dll.

Now we are able to work with Oracle from MS SQL, and it's fine, but... on one of my hosts I've got the next problem: the Oracle linked server in MS SQL Database Engine works ok, connection from SSAS to Oracle works ok, but Oracle connection in SSIS packages doesn't work! So, let's do the next steps:

as the x64 ODAC driver doesn't work with SSIS in x64, I've tried to make ODAC working with SSIS in x32 subsystem.

Steps:
1. Download and install by default ODTwithODAC1020221 (x32).
2. BIDS, DTExecUI, DTExec are started with next command files:

set path=C:\oracle\product\10.2.0\client_odac_2_x32\BIN;%path%;
"C:\Progra~2\Microsoft Visual Studio 8\Common7\IDE\devenv.exe"

set path=C:\oracle\product\10.2.0\client_odac_2_x32\BIN;%path%;
"C:\Progra~2\Microsoft SQL Server\90\Tools\binn\VSShell\Common7\IDE\DTExecUI.exe"

set path=C:\oracle\product\10.2.0\client_odac_2_x32\BIN;%path%;
c:
cd \
cd "C:\PROGRA~2\Microsoft SQL Server\90\DTS\Binn"
DTExec /Server SERVERNAME /SQL "Test Oracle Driver Package" /Reporting E

In x32 subsystem all works.