0% found this document useful (0 votes)
710 views

Installation and Configuration of Oracle Database Gateway For Heterogeneous Databases (MSSQL, MySql & DB2)

Installation and configuration of Oracle Gateway for Heterogeneous databases (MSSQL, MySql & DB2).docx

Uploaded by

qazianeel5156
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
710 views

Installation and Configuration of Oracle Database Gateway For Heterogeneous Databases (MSSQL, MySql & DB2)

Installation and configuration of Oracle Gateway for Heterogeneous databases (MSSQL, MySql & DB2).docx

Uploaded by

qazianeel5156
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Installation and configuration

of Oracle Gateway for


Heterogeneous databases
(MSSQL, MySql & DB2)

Contents
1

Overview................................................................................................................. 3

Introduction to Oracle Database Gateway..............................................................3

Installation and configuring Oracle Gateway for MS SQL........................................3

3.1

Setup Overview................................................................................................... 3

3.2

Gateway Download link....................................................................................... 3

3.3

Installing Oracle Database Gateway for Microsoft SQL server.............................3

Coniguring Oracle Database Gateway..................................................................10

Configuring Oracle Database Gateway for MySQL................................................12

5.1

Setup Overview................................................................................................. 12

5.2

Set drivers & connectivity.................................................................................12

5.3

Configure Oracle Net Listener for the gateway:.................................................13

5.4

Configure the Gateway Initialization Parameter File:.........................................14

5.5

Create a database link in Oracle database to connect to MySQL database:......15

Configuring Oracle Database Gateway for IBM DB2.............................................16

6.1

Setup Overview................................................................................................. 16

6.2

Set drivers & connectivity.................................................................................16

6.3

Configure Oracle Net Listener for the gateway:.................................................18

6.4

Configure the Gateway Initialization Parameter File:.........................................18

6.5

Create a database link in Oracle database to connect to DB2 database:..........19

2 | Page

1 Overview
In this document the steps to install and configure Oracle Database Gateway for
MS SQL server are demonstrated.

2 Introduction to Oracle Database Gateway


Oracle Database Gateways address the needs of disparate data access. In a
heterogeneously distributed environment, Gateways make it possible to integrate
with any number of non-Oracle systems from an Oracle application. They enable
integration with data stores such as IBM DB2, Microsoft SQL Server and Excel,
transaction managers like IBM CICS and message queuing systems like IBM
WebSphere MQ.

3 Installation and configuring Oracle Gateway for MS SQL


3.1

Setup Overview

Parameters
Database
DB version
Operating
System
Host Name
IP Address
Instance name
Database
Name

3.2

Source System
MS SQL Server
SQL Server 2008

Target System
Oracle Database
11.2.0.3

Windows

Linux 64 bit

SCS-Windows
192.168.1.227
MSSQLSERVER

SCS-Linux
192.168.1.89
orcl

scs

orcl

Gateway Download link

The Oracle Database Gateway can be downloaded from following link:

https://updates.oracle.com/Orion/PatchDetails/process_form?
patch_num=10404530&aru=14255124&release=80112030&plat_lang=23
3P&patch_num_id=1432597&
3.3
Installing Oracle Database Gateway for Microsoft SQL
server
Copy the downloaded zip file into /opt and unzip it.
Unzip the downloaded zip file. It will create
named gateways
Change the directory to gateways and start installer.

directory

cd /opt
unzip p10404530_112030_Linux-x86-64_5of7.zip
cd gateways

3 | Page

./runInstaller

Click next to proceed

4 | Page

Click next

Provide/check ORACLE_HOME information and click next to proceed

5 | Page

Click next

Check Oracle database gateway for MS SQL and click next

6 | Page

Provide MS SQL Server information (host, port, instance, database)

Click Install to start installation

7 | Page

Execute the scripts as root user to set proper permissions on


directories and click OK

8 | Page

# /opt/oraInventory/orainstRoot.sh
Changing permissions of /opt/oraInventory.
Adding read, write permissions for group.
Removing read, write, execute permissions for world.
Changing groupname of /opt/oraInventory to oinstall.
The execution of the script is complete.

# /opt/oracle/product/11.2.0/db_1/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /opt/oracle/product/11.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Finished product-specific root actions.

Click Exit to finish the instllation

9 | Page

4 Coniguring Oracle Database Gateway


During the installation, the following initialization parameter file is
created:
/opt/oracle/product/11.2.0/db_1/dg4msql/admin/initdg4msql.ora

Copy initdg4msql.ora to a new file initMSSCS.ora.


cd /opt/oracle/product/11.2.0/db_1/dg4msql/admin
cp initdg4msql.ora initMSSCS.ora

Modify newly created file initMSSCS.ora and modify or add the MS SQL
server & database name.
HS_FDS_CONNECT_INFO=[192.168.1.227]/MSSQLSERVER/scs

Append existing listener.ora and add following lines to add new listener:
LISTENER_DG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = SCS-Linux)(PORT = 1511))
)
SID_LIST_LISTENER_DG =
(SID_DESC =
(SID_NAME =MSSCS)
(ORACLE_HOME =/opt/oracle/product/11.2.0/db_1)
(ENVS
=LD_LIBRARY_PATH=/opt/oracle/product/11.2.0/db_1/dg4msql/driver/lib:/opt/oracle/product/11.
2.0/db_1/lib)
(PROGRAM=/opt/oracle/product/11.2.0/db_1/bin/dg4msql)
)
)
ADR_BASE_LISTENER_DG = /opt/oracle

Start the newly created listener.


lsnrctl start listerner_dg

Verify that the MSSCS service is registered with the listener


lsnrctl status listerner_dg

Append following in tnsnames.ora


MSSCS =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST= SCS-Linux)(PORT=1511))
(CONNECT_DATA=(SID=MSSCS))
(HS=OK)
)

Check service ping using tnsping utility:


10 | P a g e

tnsping MSSCS
TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 07-JAN-2016 10:56:49
Copyright (c) 1997, 2011, Oracle.

All rights reserved.

Used parameter files:


/opt/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST= SCS-Linux)(PORT=1511))
(CONNECT_DATA=(SID=MSSCS)) (HS=OK))
OK (10 msec)

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 public database link scs_db connect to "ja" identified by
"ja" using 'MSSCS';

Query any table to check if the db link is working


SQL> select * from t1@ scs_db;
col
---------1
2

11 | P a g e

5 Configuring Oracle Database Gateway for MySQL


This document assumes that ODBC gateway is already installed using
installation steps mentioned above.
5.1

Setup Overview

Parameters
Database
DB version
Operating
System
Host Name
IP Address
Instance name
Database
Name

5.2

Source System
MySQL
5.1.66

Target System
Oracle Database
11.2.0.3

Linux 64 bit

Linux 64 bit

Msqlhost
192.168.1.96
-

SCS-Linux
192.168.1.89
orcl

mvrdb

orcl

Set drivers & connectivity

Create a new directory for both ODBC driver manager and ODBC driver:
$ cd $ORACLE_HOME
$ mkdir app

Download and install UnixODBC, or ODBC driver manager and copy it to


$ORACLE_HOME/app directory:
Download unixODBC-2.3.4.tar.gz from
http://sourceforge.net/projects/unixodbc/files/unixODBC/

Install ODBC driver manager:


$ cd $ORACLE_HOME/app
$ tar xvzf unixODBC-2.3.4.tar.gz
$ cd unixODBC-2.3.4
$./configure
$ make
$ make install

Download and install ODBC driver, also called MySQL Connector:


http://dev.mysql.com/downloads/file/?id=453018

Copy
the
downloaded
mysql-connector-odbc-5.3.4-linux-el6-x8664bit.tar.gz file to $ORACLE_HOME/app
Install the ODBC driver:
$ cd $ORACLE_HOME/app
$ tar xvzf mysql-connector-odbc-5.3.4-linux-el6-x86-64bit.tar.gz
$ mv mysql-connector-odbc-5.3.4-linux-el6-x86-64bit odbc-5.3.4

12 | P a g e

Create the etc directory under the $ORACLE_HOME:


$ cd $ORACLE_HOME
$ mkdir etc

Create the odbc.ini file in etc directory:


$ cd $ORACLE_HOME/etc
$ vi odbc.ini
[mysql_srv]
Driver = /opt/oracle/product/11.2.0/db_1/app/odbc-5.3.4/lib/libmyodbc5a.so
Description = Connector/ODBC 5.1 Driver DSN
SERVER =192.168.1.96
PORT = 3306
USER = mvr_dev
PASSWORD = AllahIs1
DATABASE = mvrdb
OPTION = 0
TRACE = OFF

Check connectivity:
$ export ODBCINI=/opt/oracle/product/11.2.0/db_1/etc/odbc.ini
$ cd /opt/oracle/product/11.2.0/db_1/app/unixODBC-2.3.4/exe
$./isql mysql_srv -v
SQL> select version()
+----------+
| version()|
+----------+
| 5.1.66
|
+----------+
SQLRowCount returns 1
1 rows fetched

SQL> select count(*) from vehicle;


+---------------------+
| count(*)
|
+---------------------+
| 509190
|
+---------------------+
SQLRowCount returns 1
1 rows fetched

SQL>quit

5.3

Configure Oracle Net Listener for the gateway:

Open listerner.ora file and add listener (if required) and service name:
cd /opt/oracle/product/11.2.0/db_1/network/admin

13 | P a g e

vi listener.ora
LISTENER_DG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = SCS-Linux)(PORT = 1511))
)
SID_LIST_LISTENER_DG =
(SID_DESC =
(SID_NAME =mvrdb)
(ORACLE_HOME =/opt/oracle/product/11.2.0/db_1)
(ENVS =LD_LIBRARY_PATH=/opt/oracle/product/11.2.0/db_1/app/odbc5.3.4/lib:/opt/oracle/product/11.2.0/db_1/lib)
(PROGRAM=/opt/oracle/product/11.2.0/db_1/bin/dg4odbc)
)
ADR_BASE_LISTENER_DG = /opt/oracle

Add an entry for mysql database to the tnsnames.ora file:


Add following lines to $ORACLE_HOME/network/admin/tnsnames.ora on
the database server:
mysql_mvrdb=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=SCS-Linux)(PORT=1511))
(CONNECT_DATA=(SID=mvrdb))
(HS=OK)
)

5.4

Configure the Gateway Initialization Parameter File:

Make a copy of sample initialization parameter file initdg4odbc.ora and


rename it to include sid of MySQL database (in our case, it is mvrdb).
$ cd /opt/oracle/product/11.2.0/db_1/hs/admin/
$ cp initdg4odbc.ora initmvrdb.ora
# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC
#
# HS init parameters
#
HS_FDS_CONNECT_INFO = mysql_srv
#HS_FDS_TRACE_LEVEL = <trace_level>
HS_FDS_SHAREABLE_NAME =/opt/oracle/product/11.2.0/db_1/app/unixODBC2.3.4/DriverManager/.libs/libodbc.so
#
# ODBC specific environment variables
#
set ODBCINI=/opt/oracle/product/11.2.0/db_1/etc/odbc.ini
#
# Environment variables required for the non-Oracle system
#
#set LD_LIBRARY_PATH=<value>

14 | P a g e

Bounce the listener


5.5
Create a database link in Oracle database to connect to
MySQL database:
SQL> create public database link mysql_mvrdb connect to "mvr_dev"
identified by "AllahIs1" using ' mysql_mvrdb';
select count(*) from "vehicle"@mysql_mvrdb;
COUNT(*)
---------509190

15 | P a g e

6 Configuring Oracle Database Gateway for IBM DB2


This document assumes that ODBC gateway is already installed using
installation steps mentioned above.
6.1

Setup Overview

Parameters
Database
DB version
Operating
System
Host Name
IP Address
Instance name
Database
Name

6.2

Source System
DB2
10.5

Target System
Oracle Database
11.2.0.3

Linux 64 bit

Linux 64 bit

db2host
192.168.1.157
-

SCS-Linux
192.168.1.89
orcl

mvrdb

orcl

Set drivers & connectivity

Create a new directory for both ODBC driver manager and ODBC driver:
$ cd $ORACLE_HOME
$ mkdir app

Download and install UnixODBC, or ODBC driver manager and copy it to


$ORACLE_HOME/app directory:
Download unixODBC-2.3.4.tar.gz from
http://sourceforge.net/projects/unixodbc/files/unixODBC/

Install ODBC driver manager:


$ cd $ORACLE_HOME/app
$ tar xvzf unixODBC-2.3.4.tar.gz
$ cd unixODBC-2.3.4
$./configure
$ make
$ make install

Download IBM DB2 ODBC CLI driver from following link:


https://www-304.ibm.com/support/docview.wss?uid=swg21418043

Copy the downloaded


$ORACLE_HOME/app

IBM

DB2

ODBC

CLI

driver

file

to

Install/uncompress the tar file of ODBC driver. This will create odbc_cli
folder:
$ cd $ORACLE_HOME/app

16 | P a g e

$ tar xvzf v10.5fp7_linuxx64_odbc_cli.tar.gz

Create db2cli.ini file and add following lines:


$ mkdir $ORACLE_HOME/app/odbc_cli/clidriver/trace
$ cd $ORACLE_HOME/app/odbc_cli/clidriver/cfg
$ vi db2cli.ini
[COMMON]
Trace=0
TracePathName=/opt/oracle/product/11.2.0/db_1/app/odbc_cli/clidriver/trace
TraceComm=1
TraceFlush=1
TraceTimeStamp=1
[MYDB2]
Database=mvrdb
Hostname=192.168.1.157
Port=50000
Protocol=TCPIP

Create the etc directory under the $ORACLE_HOME:


$ cd $ORACLE_HOME
$ mkdir etc

Create the odbc.ini file in etc directory:


$ cd $ORACLE_HOME/etc
$ vi odbc.ini
[ODBC Data Source]
MYDB2=IBM DB2 ODBC DRIVER
[MYDB2]
Driver=/opt/oracle/product/11.2.0/db_1/app/odbc_cli/clidriver/lib/libdb2.so
Description=MYDB2 DB2 ODBC Database

Check connectivity:
$ export ODBCINI=/opt/oracle/product/11.2.0/db_1/etc/odbc.ini
$ cd /opt/oracle/product/11.2.0/db_1/app/unixODBC-2.3.4/exe
$./isql MYDB2 v db2inist [password]
SQL> select count(*) from mvrdb.bank;
+------------+
| 1
|
+------------+
| 654
|
+------------+
SQLRowCount returns -1
1 rows fetched

17 | P a g e

SQL>quit

6.3

Configure Oracle Net Listener for the gateway:

Open listerner.ora file and add listener (if required) and service name:
cd /opt/oracle/product/11.2.0/db_1/network/admin
vi listener.ora
LISTENER_DG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = SCS-Linux)(PORT = 1511))
)
SID_LIST_LISTENER_DG =
(SID_DESC =
(SID_NAME =MYDB2)
(ORACLE_HOME =/opt/oracle/product/11.2.0/db_1)
(ENVS
=LD_LIBRARY_PATH=/opt/oracle/product/11.2.0/db_1/app/odbc_cli/clidriver/lib:/opt/oracle/pro
duct/11.2.0/db_1/lib)
(PROGRAM=/opt/oracle/product/11.2.0/db_1/bin/dg4odbc)
)
ADR_BASE_LISTENER_DG = /opt/oracle

Add an entry for DB2 database to the tnsnames.ora file:


Add following lines to $ORACLE_HOME/network/admin/tnsnames.ora on
the database server:
MYDB2=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=SCS-Linux)(PORT=1511))
(CONNECT_DATA=(SID=mvrdb))
(HS=OK)
)

6.4

Configure the Gateway Initialization Parameter File:

Make a copy of sample initialization parameter file initdg4odbc.ora and


rename it to include sid of MYDB2 database (in our case, it is mvrdb).
$ cd /opt/oracle/product/11.2.0/db_1/hs/admin/
$ cp initdg4odbc.ora initMYDB2.ora
# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC
# HS init parameters
#
HS_FDS_CONNECT_INFO = MYDB2
HS_FDS_TRACE_LEVEL = 0
HS_FDS_SHAREABLE_NAME =
/opt/oracle/product/11.2.0/db_1/app/odbc_cli/clidriver/lib/libdb2.so

18 | P a g e

HS_DB_NAME=mvrdb
#
# ODBC specific environment variables
set ODBCINI=/opt/oracle/product/11.2.0/db_1/etc/odbc.ini
#
# Environment variables required for the non-Oracle system
#set LD_LIBRARY_PATH=<value>

Bounce the listener


6.5
Create a database link in Oracle database to connect to
DB2 database:
SQL> create public database link db2_mvrdb connect to "db2inst1"
identified by "123456" using 'MYDB2';
select count(*) from mvrdb.bank@db2_mvrdb;
COUNT(*)
---------654

19 | P a g e

You might also like