Document Type | Technical Information
Category | Administration
Applicable Product Version | 6FS07
Document Number | TADTI027
Overview
This guide explains how to create and connect two Oracle instance DB LINKs with different versions from Tibero.
Below is the method to configure a 2 NODE DBLINK setup.
Tibero
(gateway 1) โ Oracle node 1
(gateway 2) โ Oracle node 2
Method
CautionThis is written based on Tibero 6 FS07 CS_2005 build 267039 version.Configuration methods may vary depending on the Tibero version.
Since all gateways run on the Tibero server, you need to check the IP, Port, DB NAME, and Service Name on the Oracle server.
1. Install and configure the client matching each Oracle version
The example below is based on versions 11g and 12c.
Download the Oracle instant client and extract it on the Tibero server.
The extraction path will be used as the $ORACLE_HOME path.
2. Create profiles to set environment variables for each version
Set TBGW_HOME, ORACLE_HOME, and PATH for each version.
Example profile for Oracle 11g version
vi ~/.11g_profile export TB_HOME=/home/test/tibero6 export TBGW_HOME=/home/test/tibero_test/tbgateway_11g export ORACLE_HOME=/home/test/tibero_test/instantclient_11_2 export LD_LIBRARY_PATH=.:$TB_HOME/lib:$TB_HOME/client/lib:$ORACLE_HOME:$LD_LIBRARY_PATH export PATH=.:$TB_HOME/bin:$TB_HOME/client/bin:$ORACLE_HOME:$PATH
Example profile for Oracle 12c version
vi ~/.12c_profile export TB_HOME=/home/test/tibero6 export TBGW_HOME=/home/test/tibero_test/tbgateway_12c export ORACLE_HOME=/home/test/tibero_test/instantclient_12_2 export LD_LIBRARY_PATH=.:$TB_HOME/lib:$TB_HOME/client/lib:$ORACLE_HOME:$LD_LIBRARY_PATH export PATH=.:$TB_HOME/bin:$TB_HOME/client/bin:$ORACLE_HOME:$PATH
3. Create TBGW_HOME directories and start the gateway
Be careful to set ports so they do not conflict when starting the gateway. The gateway uses the LISTENER_PORT and LISTENER_PORT+1 ports specified in the config when starting.
(ex. If LISTENER_PORT=8910 is set, ports 8910 and 8911 are used)
(ex. If LISTENER_PORT=8910 is set, ports 8910 and 8911 are used)
Start the gateway after applying the profile matching each version.
The gateway file exists in the $TB_HOME/client/bin directory. Copy it to the TBGW_HOME path according to the version, check with the ldd command whether the libraries are correctly linked, then start it.
The gateway file exists in the $TB_HOME/client/bin directory. Copy it to the TBGW_HOME path according to the version, check with the ldd command whether the libraries are correctly linked, then start it.
Oracle 11g version setup
#. Apply 11g profile source ~/.11g_profile #. Set gateway home directory (TBGW_HOME as specified in profile) mkdir -p /home/test/tibero_test/tbgateway_11g #. Copy the 11g version gateway to the gateway home cp $TB_HOME/client/bin/gw4orcl_11g $TBGW_HOME/ cd $TBGW_HOME ldd gw4orcl_11g => Check that no "not found" occurs mkdir -p $TBGW_HOME/oracle/log mkdir -p $TBGW_HOME/oracle/config #. Configure 11g gateway config vi $TBGW_HOME/oracle/config/tbgw.cfg LISTENER_PORT=8910 LOG_DIR=/home/test/tibero_test/tbgateway_11g/oracle/log #. The log path must be an absolute path for the gateway to start #. Start gateway ./gw4orcl_11g
Oracle 12c version setup
#. Apply 12c profile source ~/.12c_profile #. Set gateway home directory (TBGW_HOME as specified in profile) mkdir -p /home/test/tibero_test/tbgateway_12c #. Copy the 12c version gateway to the gateway home cp $TB_HOME/client/bin/gw4orcl_12c $TBGW_HOME/ cd $TBGW_HOME ldd gw4orcl_12c => Check that no "not found" occurs mkdir -p $TBGW_HOME/oracle/log mkdir -p $TBGW_HOME/oracle/config #. Configure 12c gateway config vi $TBGW_HOME/oracle/config/tbgw.cfg LISTENER_PORT=8900 LOG_DIR=/home/test/tibero_test/tbgateway_12c/oracle/log #. The log path must be an absolute path for the gateway to start #. Start gateway ./gw4orcl_12c
4. Configure tbdsn.tbr file
Since the gateways run on the Tibero server in this example, set HOST to localhost in tbdsn.tbr and PORT to the LISTENER_PORT set in each gateway config.
vi $TB_HOME/client/config/tbdsn.tbr oracle_11g=( (GATEWAY= (LISTENER=(HOST=localhost) (PORT=8910)) #. Specify the gateway for each version (TARGET=ORCL) (TX_MODE=GLOBAL) ) ) oracle_12c=( (GATEWAY= (LISTENER=(HOST=localhost) (PORT=8900)) #. Specify the gateway for each version (TARGET=ORCL) (TX_MODE=GLOBAL) ) )
5. Configure tnsnames.ora
Create $ORACLE_HOME/network/admin/tnsnames.ora file.
This file must include the Oracle server IP, port, and service name.
Example of IP / port / service name entries for each Oracle instance
[DB NAME] = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = [ORACLE IP])(PORT = [LISTENER PORT])) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = [SERVICE_NAME]) ) )
Oracle 11g version setup
source ~/.11g_profile vi $ORACLE_HOME/network/admin/tnsnames.ora ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.XX.XX)(PORT = xxxxx)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )
Oracle 12c version setup
source ~/.12c_profile vi $ORACLE_HOME/network/admin/tnsnames.ora ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.XX.XX)(PORT = xxxxx)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )
6. Create dblink
$ tbsql tibero/tmax SQL create database link ora11 connect to [remote db user name] identified by '[user password]' using 'oracle_11g'; Database Link 'ORA11' created. SQL select * from dual@ora11; DUMMY ----- X 1 row selected. SQL create database link ora12 connect to [remote db user name] identified by '[user password]' using 'oracle_12c'; Database Link 'ORA12' created. SQL select * from dual@ora12; DUMMY ----- X 1 row selected.