Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Share
Starting with 11g Oracle now provides a Database Gateway for MS SQL Server and various other databases.
The gateway is certified with Oracle database release 10.1.0.5, 10.2.0.3 after applying the gateway
compatibility patch bug or you can directly use it with Oracle RDBMS 10.2.0.4, 10.2.0.5, 11.1 and 11.2
Following steps are involved. Please note that this steps are shown for Linux/Unix platform but for Windows
also similar steps are to be followed.
Unzip the downloaded zip file. It will create a directory named “gateways”
http://www.oratraining.com/blog/2014/01/steps-by-step-connecting-to-microsoft-sql-database-from-oracle-database-using-database-gateway-for-… 1/11
13/2/2018 Steps-by-step: Connecting to Microsoft SQL Server database from Oracle using Database Gateway for SQL Server | Ora Training Blog
-bash-3.00$ cd /software/11gR2-Gateways/gateways/
-bash-3.00$ ./runInstaller
Click Next
http://www.oratraining.com/blog/2014/01/steps-by-step-connecting-to-microsoft-sql-database-from-oracle-database-using-database-gateway-for-… 2/11
13/2/2018 Steps-by-step: Connecting to Microsoft SQL Server database from Oracle using Database Gateway for SQL Server | Ora Training Blog
Select name for the Oracle Home. The Path defaults to Oracle Home. No need to change the same.
http://www.oratraining.com/blog/2014/01/steps-by-step-connecting-to-microsoft-sql-database-from-oracle-database-using-database-gateway-for-… 3/11
13/2/2018 Steps-by-step: Connecting to Microsoft SQL Server database from Oracle using Database Gateway for SQL Server | Ora Training Blog
Select Oracle Database Gateway for Microsoft SQL Server and click Next
http://www.oratraining.com/blog/2014/01/steps-by-step-connecting-to-microsoft-sql-database-from-oracle-database-using-database-gateway-for-… 4/11
13/2/2018 Steps-by-step: Connecting to Microsoft SQL Server database from Oracle using Database Gateway for SQL Server | Ora Training Blog
Provide any existing Microsoft SQL Server details where you are planning to connect. It actually writes this in a
config file and does not really verify.
This can be changed later also in the configuration file. Click Next
http://www.oratraining.com/blog/2014/01/steps-by-step-connecting-to-microsoft-sql-database-from-oracle-database-using-database-gateway-for-… 5/11
13/2/2018 Steps-by-step: Connecting to Microsoft SQL Server database from Oracle using Database Gateway for SQL Server | Ora Training Blog
Click Install
http://www.oratraining.com/blog/2014/01/steps-by-step-connecting-to-microsoft-sql-database-from-oracle-database-using-database-gateway-for-… 6/11
13/2/2018 Steps-by-step: Connecting to Microsoft SQL Server database from Oracle using Database Gateway for SQL Server | Ora Training Blog
Once it prompts with above screen, open another shell and run the script as root
root@host # /app/oracle/product/11.2.0/dbhome_1/root.sh
http://www.oratraining.com/blog/2014/01/steps-by-step-connecting-to-microsoft-sql-database-from-oracle-database-using-database-gateway-for-… 7/11
13/2/2018 Steps-by-step: Connecting to Microsoft SQL Server database from Oracle using Database Gateway for SQL Server | Ora Training Blog
ORACLE_OWNER= ora11g
ORACLE_HOME= /app/oracle/product/11.2.0/dbhome_1
The file “dbhome” already exists in /usr/local/bin. Overwrite it? (y/n) [n]: y
The file “oraenv” already exists in /usr/local/bin. Overwrite it? (y/n) [n]: y
The file “coraenv” already exists in /usr/local/bin. Overwrite it? (y/n) [n]: y
http://www.oratraining.com/blog/2014/01/steps-by-step-connecting-to-microsoft-sql-database-from-oracle-database-using-database-gateway-for-… 8/11
13/2/2018 Steps-by-step: Connecting to Microsoft SQL Server database from Oracle using Database Gateway for SQL Server | Ora Training Blog
Make sure that the MS SQL database details are correct in the dg4msql parameter file.
# that are needed for the Database Gateway for Microsoft SQL Server
# HS init parameters
HS_FDS_CONNECT_INFO=[SERVER127]:4076//NewCDP16
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_RECOVERY_ACCOUNT=RECOVER
HS_FDS_RECOVERY_PWD=RECOVER
-bash-3.00$ cd $ORACLE_HOME/network/admin
Append following in existing listener.ora. Change the name, path and port as required.
LISTENER_dg4mssql=
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = <oracle host or IP>) (PORT = <any unused port>))
SID_LIST_LISTENER_dg4mssql=
(SID_LIST=
(SID_DESC=
(SID_NAME=dg4msql)
(ORACLE_HOME=/app/oracle/product/11.2.0/dbhome_1)
(ENV=”LD_LIBRARY_PATH=/app/oracle/product/11.2.0/dbhome_1/dg4msql/driver/lib:/app/oracle/product/11.2.0
(PROGRAM=dg4msql)
)
http://www.oratraining.com/blog/2014/01/steps-by-step-connecting-to-microsoft-sql-database-from-oracle-database-using-database-gateway-for-… 9/11
13/2/2018 Steps-by-step: Connecting to Microsoft SQL Server database from Oracle using Database Gateway for SQL Server | Ora Training Blog
Services Summary…
dg4msql =
(DESCRIPTION=
(CONNECT_DATA=(SID=dg4msql))
(HS=OK)
TNS Ping Utility for Solaris: Version 11.2.0.1.0 – Production on 07-JAN-2014 12:30:08
/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
OK (0 msec)
http://www.oratraining.com/blog/2014/01/steps-by-step-connecting-to-microsoft-sql-database-from-oracle-database-using-database-gateway-for… 10/11
13/2/2018 Steps-by-step: Connecting to Microsoft SQL Server database from Oracle using Database Gateway for SQL Server | Ora Training Blog
Create a new database link pointing to this TNS using SQL Server login credentials. This username must be
already created in the Microsoft SQL Server database.
SQL> CREATE DATABASE LINK sqlserver CONNECT TO “SQLUser” IDENTIFIED BY “SQLPass” USING
‘dg4msql';
COUNT(1)
———-
24592
This concludes setup steps to Read data of Microsoft SQL server table from Oracle database.
http://www.oratraining.com/blog/2014/01/steps-by-step-connecting-to-microsoft-sql-database-from-oracle-database-using-database-gateway-for… 11/11