Tibero Database Link
Database Link는 데이터베이스 내의 object 중의 하나로서 네트워크 상의 다른 데이터베이스에 접근하기 위해 사용
Tibero <-> Oracle 이기종 RDBMS 간의 접근을 위한 매개체(Gateway)가 필요
Tibero to Oracle (Local 방식)
Gateway를 미리 기동하지 않고 DB Link 가 호출될 때마다 Gateway가 기동되는 방식.
Tibero 프로세스가 Gateway 설정 정보를 알고있어야 하므로 DB가 이미 실행되고 있는 경우, 재기동이 필요
Local 방식 Tibero to Oracle DB Link 생성 절차
1. Install Oracle instantclient
2. Tibero 시스템 계정 profile 설정
vi ~/.bash_profile
# Tibero Gateway ENV
export TBGW_HOME=/tibero/gateway
export ORACLE_HOME=/tibero/instantclient_12_2
export ORACLE_SID=diora12c
export LD_LIBRARY_PATH=$ORACLE_HOME:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME:$PATH
3. tbdsn.tbr 설정
vi $TB_HOME/client/config/tbdsn.tbr
diora12c=(
(GATEWAY=
(PROGRAM=/tibero/gateway/gw4orcl)
(TARGET=diora12c)
(TX_MODE=GLOBAL)
)
)
4. gateway 위치
cp $TB_HOME/client/bin/gw4orcl_11g $TBGW_HOME/gw4orcl
5. tnsnames.ora 설정
vi $ORACLE_HOME/network/admin/tnsnames.ora
diora12c =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.244.45)(PORT=1521))
(CONNECT_DATA=(SID=diora12c))
(HS=OK)
)
6. DB Link 생성
create database link olink connect to scott identified by 'tiger' using 'diora12c';
Tibero to Oracle (Listener 방식)
별도의 Gateway 프로세스가 먼저 실행되어 있어야 한다.
Listener 방식 Tibero to Oracle DB Link 생성 절차
1. Install Oracle instantclient
2. Tibero 시스템 계정 profile 설정
vi ~/.bash_profile
# Tibero Gateway ENV
export TBGW_HOME=/tibero/gateway
export ORACLE_HOME=/tibero/instantclient_12_2
export ORACLE_SID=diora12c
export LD_LIBRARY_PATH=$ORACLE_HOME:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME:$PATH
tbdsn.tbr 설정
vi $TB_HOME/client/config/tbdsn.tbr
diora12c_lsnr=(
(GATEWAY=
(LISTENER=(HOST=localhost)(PORT=9998))
(TARGET=diora12c)
(TX_MODE=GLOBAL)
)
4. gateway 위치
cp $TB_HOME/client/bin/gw4orcl_11g $TBGW_HOME/gw4orcl
5. tbgw.cfg 설정
mkdir -p $TBGW_HOME/oracle
mkdir -p $TBGW_HOME/oracle/config
mkdir -p $TBGW_HOME/oracle/log
vi $TBGW_HOME/oracle/config/tbgw.cfg
LISTENER_PORT=9998
LOG_DIR=/tibero/gateway/oracle/log
LOG_LVL=2
6. tnsnames.ora 설정
vi $ORACLE_HOME/network/admin/tnsnames.ora
diora12c =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.244.45)(PORT=1521))
(CONNECT_DATA=(SID=diora12c))
(HS=OK)
)
7. DB Link 생성
create database link olink connect to scott identified by 'tiger' using 'diora12c_lsnr';
Oracle to Tibero
Install Tibero client
tnsnames.ora
tibero =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=didb.localdomain)(PORT=8686))
(CONNECT_DATA=(SID=tibero))
(HS=OK)
)
listener.ora
tibero =
(DESCRIPTION=
(ADDRESS = (PROTOCOL = TCP)
(HOST = didb.localdomain)
(PORT = 8686)
)
)
SID_LIST_tibero=
(SID_LIST =
(SID_DESC =
(SID_NAME = tibero)
(ORACLE_HOME = /oracle/product/12.2.0.1/diora)
(PROGRAM = dg4odbc)
)
)
inittibero.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 = tibero
HS_FDS_TRACE_LEVEL = OFF
HS_FDS_SHAREABLE_NAME = /oracle/tibero6/client/lib/libtbodbc.so
#
# ODBC specific environment variables
#
#set ODBCINI=<full path name of the odbc initilization file>
#
# Environment variables required for the non-Oracle system
#
HS_NLS_NCHAR=UCS2
set TBCLI_WCHAR_TYPE=ucs2
tbdsn.tbr
#-------------------------------------------------
# /oracle/tibero6/client/config/tbdsn.tbr
# Network Configuration File.
# Generated by gen_tip.sh at Mon Apr 10 17:08:28 KST 2017
tibero=(
(INSTANCE=(HOST=$TIBERO_HOST)
(PORT=8629)
(DB_NAME=tibero)
)
)
TBCLI_LOG_LVL=TRACE
TBCLI_LOG_DIR=/oracle/tibero6/client/log