RAC环境下管理OGG-HA
RAC环境下管理OGG-HA
在本文中将介绍在Oracle 11g r2 rac环境下使用grid infrastructure来管理ogg服务,在开始之前,请先按照前文的步骤配置好rac(source)同单实例(target)数据库之间的ogg单向同步,同时确保rac数据库各项服务运行正常,同时启动target端的数据库实例和ogg的mgr,replicat进程,source端ogg的mgr,extract,extract dump进程可以关闭!
一:查看rac各服务是否online,这里3个gsd服务offline属于正常情况!
- [root@rac1 bin]# ./crs_stat -t -v
- Name Type R/RA F/FT Target State Host
- ----------------------------------------------------------------------
- ora.ACFS.dg ora....up.type 0/5 0/ ONLINE ONLINE rac1
- ora.CRS.dg ora....up.type 0/5 0/ ONLINE ONLINE rac1
- ora.DATA.dg ora....up.type 0/5 0/ ONLINE ONLINE rac1
- ora.FRA.dg ora....up.type 0/5 0/ ONLINE ONLINE rac1
- ora....ER.lsnr ora....er.type 0/5 0/ ONLINE ONLINE rac1
- ora....N1.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE rac2
- ora....N2.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE rac1
- ora....N3.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE rac1
- ora.asm ora.asm.type 0/5 0/ ONLINE ONLINE rac1
- ora.cvu ora.cvu.type 0/5 0/0 ONLINE ONLINE rac1
- ora.gsd ora.gsd.type 0/5 0/ OFFLINE OFFLINE
- ora....network ora....rk.type 1/5 0/ ONLINE ONLINE rac1
- ora.oc4j ora.oc4j.type 0/1 0/2 ONLINE ONLINE rac1
- ora.ons ora.ons.type 0/3 0/ ONLINE ONLINE rac1
- ora.rac.db ora....se.type 0/1 0/1 ONLINE ONLINE rac1
- ora....SM1.asm application 0/5 0/0 ONLINE ONLINE rac1
- ora....C1.lsnr application 0/5 0/0 ONLINE ONLINE rac1
- ora.rac1.gsd application 0/5 0/0 OFFLINE OFFLINE
- ora.rac1.ons application 0/3 0/0 ONLINE ONLINE rac1
- ora.rac1.vip ora....t1.type 0/0 0/0 ONLINE ONLINE rac1
- ora....SM2.asm application 0/5 0/0 ONLINE ONLINE rac2
- ora....C2.lsnr application 0/5 0/0 ONLINE ONLINE rac2
- ora.rac2.gsd application 0/5 0/0 OFFLINE OFFLINE
- ora.rac2.ons application 0/3 0/0 ONLINE ONLINE rac2
- ora.rac2.vip ora....t1.type 0/0 0/0 ONLINE ONLINE rac2
- ora....ry.acfs ora....fs.type 0/5 0/ ONLINE ONLINE rac1
- ora.scan1.vip ora....ip.type 0/0 0/0 ONLINE ONLINE rac2
- ora.scan2.vip ora....ip.type 0/0 0/0 ONLINE ONLINE rac1
- ora.scan3.vip ora....ip.type 0/0 0/0 ONLINE ONLINE rac1
二:在source端添加VIP,并赋权限,检查vip是否能正常启动,在本例中运行grid infrastructure的操作系统用户为grid,运行ogg的操作系统用户为oracle
- [root@rac1 bin]# ./crsctl stat res -p |grep -ie .network -ie subnet |grep -ie name -ie subnet
- NAME=ora.net1.network
- USR_ORA_SUBNET=192.168.1.0
- [root@rac1 bin]# ./appvipcfg create -network=1 \
- -ip=192.168.1.150 \
- -vipname=oggvip \
- -user=root
- [root@rac1 bin]# ./crsctl setperm resource oggvip -u user:oracle:r-x
- [root@rac1 bin]# ./crsctl status resource oggvip
- NAME=oggvip
- TYPE=app.appvip_net1.type
- TARGET=OFFLINE
- STATE=OFFLINE
- [root@rac1 bin]# ./crsctl start resource oggvip
- CRS-2672: Attempting to start 'oggvip' on 'rac1'
- CRS-2676: Start of 'oggvip' on 'rac1' succeeded
- [root@rac1 bin]# ip a |grep 192.168.1.150
- inet 192.168.1.150/24 brd 192.168.1.255 scope global secondary eth0:2
- [root@rac1 bin]# ./crsctl status resource oggvip
- NAME=oggvip
- TYPE=app.appvip_net1.type
- TARGET=ONLINE
- STATE=ONLINE on rac1
三:配置action脚本,该脚本必须包含start,stop,check,clean,abort几个函数,才能用于后续的grid infrastructure调用,这里把脚本直接放在acfs文件系统上,以便节点间共享
- [root@rac1 bin]# chmod +x /vol2/ogg/11gr2_ogg_action.scr
- [root@rac1 bin]# ll /vol2/ogg/11gr2_ogg_action.scr
- -rwxr-xr-x 1 oracle oinstall 2483 Jul 17 21:01 /vol2/ogg/11gr2_ogg_action.scr
- [root@rac1 bin]# cat /vol2/ogg/11gr2_ogg_action.scr
- #!/bin/sh
- #set the Oracle Goldengate installation directory
- export GGS_HOME=/vol2/ogg
- #set the oracle home to the database to ensure GoldenGate will get the
- #right environment settings to be able to connect to the database
- export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db1
- #specify delay after start before checking for successful start
- start_delay_secs=5
- #Include the GoldenGate home in the library path to start GGSCI
- export LD_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} |grep mgr |cut -d " " -f2` ]
- then
- #manager process is running on the PID exit success
- exit 0
- else
- if [ ${pid} = `ps -e |grep ${pid} |grep mgr |cut -d " " -f1` ]
- then
- #manager process is running on the PID exit success
- exit 0
- else
- #manager process is not running on the PID
- exit 1
- fi
- fi
- else
- #manager is not running because there is no PID file
- exit 1
- 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
- exit 0
- ;;
- '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
- exit 0
- ;;
- '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
- exit 0
- ;;
- esac
|
评论暂时关闭