oracle集群安装ogg,在RAC下安装配置OGG
有多種方案
1
共享磁盤—ACFS/DBFS/OCFS2
可由任何一個節點啟動OGG,若該節點crash,可由其他節點重啟manager和OGG進程;若本地節點的DB crash,則先停止其manager進程然后在其他節點啟動
2
本地磁盤
不支持failover,如果本地節點失效則無法獲取checkpoint信息
3
異機安裝
GG通過tnsname連接到RAC,oracle日志文件必須位于共享磁盤以便extract讀取
一般選項安裝于共享磁盤,/u02為ACFS文件系統,安裝步驟與單實例類似,添加extract進程時應指定thread數量;
連接ASM
如果RAC使用ASM存儲文件,則配置Extract時連接應指向ASM;
對于10205/11202同時OGG版本>=11,采用DBLOGREADER API可直接連通數據庫,其他版本則通過SQLNET以SYS ASM用戶登錄;
--通過ASMUSER連接ASM時,extrat進程的buffer為28672字節,而DBLOGREADER API默認為1024000字節,其extract相應配置為tranlogoptions dblogreader
如果數據量巨大,對于10R2或更高版本可使用BEQ協議,相比傳統的listener節省了TCP/IP開銷,OGG必須運行于db server;
使用傳統sqlnet配置
1 ASM通過db listener提供遠程連接必須顯示的加入監聽器配置文件
2 Extract參數文件必須包含連接ASM實例的配置
GGSCI (raclinux1.gj.com) 25> view params extcdc
extract extcdc
tranlogoptions asmuser sys@ASM, asmpassword sys1
userid ogg_extract, password ogg_extract
rmthost raclinux1, mgrport 7809
rmttrail ./dirdat/aa
使用BEQ和DBLOGREADER時配置如下
--tnsname
ORCL_BEQ =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = BEQ)
(PROGRAM=oracle)
(ARGV0 = oracleORCL)
(ARGS=‘(DESCRIPTION=(LOCAL=YES)(ADDRESS =(PROTOCOL=BEQ)))’)
)
(CONNECT_DATA = (SERVICE_NAME = ORCL))
)
--extract參數文件
EXTRACT EASM
EXTTRAIL ./dirdat/ea
USERID gguser@ORCL_BEQ, PASSWORD Oracle1
TRANLOGOPTIONS BUFSIZE 4096000
TRANLOGOPTIONS DBLOGREADER, DBLOGREADERBUFSIZE 4096000
TABLE amer.*;
Extract ASM Connection Methods [ID 1390268.1]
安裝完畢后,為保證OGG可以failover,須將其manager進程注冊為clusterware資源,以下適用于11R2
1
添加應用VIP
$GRID_HOME/bin/appvipcfg create -network=1 -ip=10.1.41.93 -vipname=mvggatevip -user=root
此時VIP屬主為root,賦予權限給oracle
$GRID_HOME/bin/crsctl setperm resource mvggatevip -u user:oracle:r-x
以oracle用戶啟動
$GRID_HOME/bin/crsctl start resource mvggatevip
查看VIP運行情況
GRID_HOME/bin/crsctl status resource mvggatevip
2
部署agent腳本
Clusterware通過agent運行相應資源
將腳本11gr2_gg_action.scr復制到每個節點相同目錄,其至少包含5個選項:start/stop/check/clean/abort
Chmod +X 11gr2_gg_action.scr
Oracle Clusterware runs resource-specific commands through an entity called an agent. The agent script. must be able to accept 5 parameter values: start, stop, check, clean and abort (optional).
Save the script. in a file and copy it to every node in the cluster into the same directory
3
注冊到集群
$GRID_HOME/bin/crsctl add resource ggateapp -type cluster_resource -attr "ACTION_SCRIPT=/mnt/acfs/oracle/grid/11gr2_gg_action.scr, CHECK_INTERVAL=30, START_DEPENDENCIES='hard(mvggatevip) pullup(mvggatevip)', STOP_DEPENDENCIES='hard(mvggatevip)'"
如果OGG和GRID分屬不同用戶,須將該應用屬主設置為OGG用戶(假定mvandewiel)
--以root用戶執行
$GRID_HOME/bin/crsctl setperm resource ggateapp -o mvandewiel
4
啟動應用
$GRID_HOME/bin/crsctl start resource ggateapp
$GRID_HOME/bin/crsctl status resource ggateapp
NAME=ggateapp
TYPE=cluster_resource
TARGET=ONLINE
STATE=ONLINE on coe-02
5
重定向
[oracle@coe-02 grid]$ crsctl relocate resource ggateapp -f
CRS-2673: Attempting to stop 'ggateapp' on 'coe-01'
CRS-2677: Stop of 'ggateapp' on 'coe-01' succeeded
CRS-2673: Attempting to stop 'mvggatevip' on 'coe-01'
CRS-2677: Stop of 'mvggatevip' on 'coe-01' succeeded
CRS-2672: Attempting to start 'mvggatevip' on 'coe-02'
CRS-2676: Start of 'mvggatevip' on 'coe-02' succeeded
CRS-2672: Attempting to start 'ggateapp' on 'coe-02'
CRS-2676: Start of 'ggateapp' on 'coe-02' succeeded
清空資源
先以oracle用戶停止相應資源
GRID_HOME/bin/crsctl stop resource ggateapp
GRID_HOME/bin/crsctl stop resource mvggatevip
以root用戶刪除資源
$GRID_HOME/bin/crsctl delete resource ggateapp
GRID_HOME/bin/appvipcfg delete -vipname=mvggatevip
刪除11gr2_gg_action.scr腳本
腳本
#!/bin/sh
#set the Oracle Goldengate installation directory
exportGGS_HOME=/cloudfs/goldengate
#set the oracle home to the database to ensure GoldenGate will get the
#right environment settings to be able to connect to the database
exportORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
#specify delay after start before checking for successful start
start_delay_secs=5
#Include the GoldenGate home in the library path to start GGSCI
exportLD_LIBRARY_PATH=$ORACLE_HOME/lib:${GGS_HOME}:${LD_LIBRARY_PATH}
#check_process validates that a manager process is running at the PID
#that GoldenGate specifies.
check_process () {
if( [ -f "${GGS_HOME}/dirpcs/MGR.pcm"] )
then
pid=`cut-f8 "${GGS_HOME}/dirpcs/MGR.pcm"`
if[ ${pid} = `ps-e |grep${pid} |grepmgr |cut-d " "-f2` ]
then
#manager process is running on the PID exit success
exit0
else
if[ ${pid} = `ps-e |grep${pid} |grepmgr |cut-d " "-f1` ]
then
#manager process is running on the PID exit success
exit0
else
#manager process is not running on the PID
exit1
fi
fi
else
#manager is not running because there is no PID file
exit1
fi
}
#call_ggsci is a generic routine that executes a ggsci command
call_ggsci () {
ggsci_command=$1
ggsci_output=`${GGS_HOME}/ggsci< < EOF
${ggsci_command}
exit
EOF`
}
case$1 in
'start')
#start manager
call_ggsci 'start manager'
#there is a small delay between issuing the start manager command
#and the process being spawned on the OS. wait before checking
sleep${start_delay_secs}
#check whether manager is running and exit accordingly
check_process
;;
'stop')
#attempt a clean stop for all non-manager processes
#call_ggsci 'stop er *'
#ensure everything is stopped
call_ggsci 'stop er *!'
#call_ggsci 'kill er *'
#stop manager without (y/n) confirmation
call_ggsci 'stop manager!'
#exit success
exit0
;;
'check')
check_process
;;
'clean')
#attempt a clean stop for all non-manager processes
#call_ggsci 'stop er *'
#ensure everything is stopped
#call_ggsci 'stop er *!'
#in case there are lingering processes
call_ggsci 'kill er *'
#stop manager without (y/n) confirmation
call_ggsci 'stop manager!'
#exit success
exit0
;;
'abort')
#ensure everything is stopped
call_ggsci 'stop er *!'
#in case there are lingering processes
call_ggsci 'kill er *'
#stop manager without (y/n) confirmation
call_ggsci 'stop manager!'
#exit success
exit0
;;
esac
增刪RAC節點需重新配置extract? 1267901.1
增加節點, 需修改extract的thread
1 增加新日志 alter database add logfile … thread#
2 停止extract進程,獲取當前檢查點信息info ext , showch,然后刪除該extract—delete ext
3 重新添加extract進程,add ext , begin now, tranlog, threads
4 依據step2信息修改其檢查點alter extract [thread n] extseqno <>, extrba <>/alter extract [thread n] ioextseqno <>, ioextrba <>
5 重啟extract進程
Extract進程有相應參數processthreads select/except 用于指定或排除候選log thread
增刪節點后,OGG thread和RAC thread的映射關系可能發生變動1342635.1
RAC thread的順序遵從select distinct thread# from v$log的輸出,而OGG thread永遠從1到N遞增
Before node addition:
====================
RAC THREAD# ????????????? OGG thread
-----------------? ? ? --------------
5 ? ? ? ? ? ? ?? -???????????? 1
1 ? ? ? ? ? ? ?? - ? ? ? ? ? ? 2
2??????????????? -???????????? 3
3??????????????? -???????????? 4
4??????????????? -???????????? 5
After? node addition:
====================
The corresponding thread mapping for Golden Gate is identified as given below:
RAC THREAD#??????????????? OGG thread
-----------??????????????? ----------
6 ? ? ? ? ? ? ?? - ? ? ? ? ? 1
5??????????????? -?????????? 2
1??????????????? -?????????? 3
2??????????????? -?????????? 4
3 ? ? ? ? ? ? ?? -?????????? 5
4??????????????? -?????????? 6
RAC thread 6為新增節點,其歸檔日志應從0開始,則OGG thread#1的檢查點應指向RAC thread#6的0號日志
總結
以上是生活随笔為你收集整理的oracle集群安装ogg,在RAC下安装配置OGG的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: excel导入sas卡方检验
- 下一篇: ELM极限学习实现汽油辛烷值预测(MAT