Wednesday, November 13, 2019

Oracle to MS Sql Server Heterogeneous DB link

Below are the steps we have to take care to achieve it:

1) Install ODBC driver or Gateway ( we used gateway )
2) Configure Listener and TNSNAMES .ora files
3) $ORACLE_HOME/hs/admin configuration
4) Create DB Link and test it

1) Gateway installation:










2)  Configure Listener and TNSNAMES.ora file as below:

Listener.ora 

dg4msql =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.58.10)(PORT = 1521))
    )
  )

SID_LIST_DG4MSQL =
  (SID_LIST =
    (SID_DESC =
      (ORACLE_HOME = /u01/app/12c/database/dbhome_1)
      (ENV = "LD_LIBRARY_PATH=/u01/app/12c/database/dbhome_1/dg4msql/driver/lib:/u01/app/12c/database/dbhome_1/lib")
      (SID_NAME = dg4msql)
      (PROGRAM = dg4msql)
    )
  )

tnsnames.ora file:

DG4MSQL =
  (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.58.10)(PORT=1521))
      (CONNECT_DATA=(SID=dg4msql))
      (HS=OK)
  )


[oracle@prod admin]$ tnsping dg4msql

TNS Ping Utility for Linux: Version 12.1.0.2.0 - Production on 18-NOV-2017 17:40:47

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

Used parameter files:
/u01/app/12c/database/dbhome_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.58.10)(PORT=1521)) (CONNECT_DATA=(SID=dg4msql)) (HS=OK))
OK (10 msec)

3) HS/admin configuration:

[oracle@prod admin]$ cat initdg4msql.ora
# This is a customized agent init file that contains the HS parameters
# that are needed for the Database Gateway for Microsoft SQL Server

#
# HS init parameters
#
HS_FDS_CONNECT_INFO=[192.168.58.10]:1433//testing
# alternate connect format is hostname/serverinstance/databasename
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_RECOVERY_ACCOUNT=RECOVER
HS_FDS_RECOVERY_PWD=RECOVER

4) Create db link as mentioned :

create public database link db_link_name connect to username_of_sqlserver identified by password_of_sqlserver using 'dg4msql';

select * from dual@db_link_name;

Regards,





No comments:

Post a Comment