Creating a database link from oracle to oracle database is easy. But setting up db_link from oracle to mssql server isn’t straight forward. We need to do odbc setup. Its knows as heterogeneous db_link.  We can achive this either by using third party odbc drivers or using oracle provided gateways utility.

Here in this article i will show how to create db_link using oracle gateway.

Download the gateway file from OTN.

ms_down1
unzip the file in oracle database server and execute runInstaller

 

msql1

 

Select the oracle_home same as that of the oracle database.

msql2

 

msql3

 

 

 

 

Here we are connecting to microsoft sql server. So select that sql server gateway option.

 

msql4
Enter the sql server details  to which we are creating the database link.

msql5

 

 

msql6

 

msql7

Run the root.sh file from root user . Now the gateway installation is done.

 

Now add the below entry in listener.ora file and start the listener

( HOST=13.129.101.40)(PORT=1521) — This is the oracle database server ip

Now add the tns entry in tnsnames.ora file

 

Lets create the database link and test it.