선행 작업으로 Tibero가 설치된 서버에 Oracle Client 설치필요(같은 서버에 이미 오라클이 설치 되어 있으면 불필요)
1. Tibero 계정 .bash_profile파일 내용에 Oracle Client 환경변수 추가
export TB_HOME=/home/tibero/tibero6
export TB_SID=nextbsc
export LD_LIBRARY_PATH=$TB_HOME/lib:$TB_HOME/client/lib
export LANG=ko_KR.UTF-8
export TBGW_HOME=$TB_HOME/client/gateway
export ORACLE_BASE=/oracle11
export ORACLE_HOME=/oracle11/opt
export ORACLE_SID=orcl949
export ORACLE_OWNER=oracle11
export ORA_NLS10=$ORACLE_HOME/nls/data
export TMPDIR=$ORACLE_BASE/tmp
export NLS_DATE_FORMAT=YYYYMMDD
export TMP=$ORACLE_BASE/tmp
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG=KOREAN_KOREA.KO16MSWIN949
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:$ORACLE_HOME/lib32:/usr/lib
export SHLIB_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32:/usr/lib
export PATH=$PATH:$TB_HOME/bin:$TB_HOME/client/bin:$ORACLE_HOME/bin:/usr/sbin:$PATH
alias tblog='cd ${TB_HOME}/instance/$TB_SID/log'
alias tbcfg='cd $TB_HOME/config'
alias tbcfgv='vi $TB_HOME/config/$TB_SID.tip'
alias tbi='cd ~/tbinary'
2. Oracle Client 권한변경
chmod o+rx $ORACLE_HOME
chmod o+rx $ORACLE_HOME/lib
chmod o+r $ORACLE_HOME/lib/*
chmod o+x $ORACLE_HOME/network
chmod o+x $ORACLE_HOME/network/admin
chmod o+r $ORACLE_HOME/network/admin/tnsnames.ora
chmod -R o+rx $ORACLE_HOME/nls
chmod -R o+rx $ORACLE_HOME/oracore
chmod o+x $ORACLE_HOME/sqlplus
chmod o+x $ORACLE_HOME/sqlplus/mesg
chmod o+rx $ORACLE_HOME/sqlplus/mesg/*
3. Gateway Binary 복사
cp $TB_HOME/client/bin/gw4orcl_11g $TBGW_HOME/gw4orcl
(Oracle Client가 10g면 gw4orcl_10g)
ldd $TBGW_HOME/gw4orcl
(Not found 여부 확인)
4. Network Alias 설정
vi $TB_HOME/client/config/tbdsn.tbr
orcl10=(
(GATEWAY=
(LISTENER=
(HOST=192.168.0.242) # Tibero서버 IP(Host명 불가, 꼭 IP만 기록해야됨)
(PORT=9999) # 로그 기록포트
)
(TARGET=NEXTBSC_10g) # Oracle Client에 tnsnames.ora 접속하고자 하는 타켓명(Alias명)하고 같아야함
(TX_MODE=GLOBAL)
)
)
5. Gateway 환경설정
vi ${TB_HOME}/client/config/tbgw.cfg
LOG_DIR=$TBGW_HOME/oracle/log
LOG_LVL=2
LSNR_PORT=9999 # 위 4번에서 설정한 같은 port
MAX_LOG_SIZE=1000
MAX_LOG_CNT=5
FETCH_SIZE=32000
6. Database Link 생성 및 Test
CREATE DATABASE LINK <DB LINK명> CONNECT TO <USER명> IDENTIFIED BY '<PASSWORD>' USING '<NETWORK ALIAS명>';
SELECT COUNT(*) FROM NG02_MEMBER_INFO@<DB LINK명>;