11gR2 RAC GoldenGate的HA配置
生活随笔
收集整理的這篇文章主要介紹了
11gR2 RAC GoldenGate的HA配置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
第一步 Add VIP resource for OGG
1. Create new VIP resource, use IP address 10.245.48.47 as example, login as root and run:
# /u01/app/11.2.0/grid/bin/appvipcfg create -network=1 -ip=10.245.48.47 -vipname=ggatevip -user=root
?
NOTE 1: '/u01/app/11.2.0/grid' is the default Oracle GRID infrastructure software directory.
NOTE 2: The example VIP resource name is 'ggatevip' and will be used in the rest of this document.
NOTE 3: -network refers to the network number, default value is '1'.
?
And you can find the network number using this command:
?
# /u01/app/11.2.0/grid/bin/crsctl stat res -p |grep -ie .network -ie
subnet |grep -ie name -ie subnet
NAME=ora.net1.network
USR_ORA_SUBNET=10.245.48.0
net1 indicates this is network 1, and the second line indicates the subnet on which the VIP will be created.
?
2. Allow oracle user to start the VIP, run this command as root:
# /u01/app/11.2.0/grid/bin/crsctl setperm resource ggatevip -u user:oracle:r-x
?
3. Log on as oracle user, start the VIP resource:
$ /u01/app/11.2.0/grid/bin/crsctl start resource ggatevip
?
4. Validate VIP is running:
$ /u01/app/11.2.0/grid/bin/crsctl status resource ggatevip
NAME=ggatevip
TYPE=app.appvip.type
TARGET=ONLINE
STATE=ONLINE on node452
?
?
NOTE: The TARGET and STATE should both be ONLINE.
?
5. Ping the VIP's IP address(10.245.48.47) and make sure it's reachable.
NOTE: If you also prefer to set up HA on target system, follow the same steps, and make necessary changes to directory, VIP resource name, IP address, etc.
第二步 Develop an agent script
1. Save the script in a file 11gr2_gg_action.scr and copy it to OGG directory.
NOTE: Make necessary changes to GGS_HOME(OGG directory) and ORACLE_HOME.
?
2. Make sure the script is executable:
$ chmod +x 11gr2_gg_action.scr
NOTE: If you also prefer to set up HA on target system, follow the same steps, and make necessary changes to GGS_HOME, ORACLE_HOME in this file.
第三步 Register OGG resource in Oracle Clusterware
1. Register OGG as a resource in Oracle Clusterware:
$ /u01/app/11.2.0/grid/bin/crsctl add resource ggateapp -type cluster_resource -attr "ACTION_SCRIPT=/cloudfs/goldengate/11gr2_gg_action.scr, \
CHECK_INTERVAL=30, START_DEPENDENCIES='hard(ggatevip,ora.ggdb.db) \
pullup(ggatevip)', STOP_DEPENDENCIES='hard(ggatevip)'"
?
NOTE 1: 'ggateapp' is the example OGG resource name and will be used in the rest of this document.
NOTE 2: 'ora.ggdb.db' is the resource name for database 'ggdb'.
?
2. Check the ggateapp resource is available as Oracle Clusterware resource:
$ /u01/app/11.2.0/grid/bin/crsctl status resource ggateapp
NAME=ggateapp
TYPE=cluster_resource
TARGET=OFFLINE
STATE=OFFLINE
NOTE: If you also prefer to set up HA on target system, follow the same steps, and make necessary changes to directory, VIP and database resource
name, etc.
第四步 Start the OGG resource
1. Start the resource, from now on you should always use Oracle Clusterware to start OGG:
?
$ /u01/app/11.2.0/grid/bin/crsctl start resource ggateapp
?
2. Check the status of OGG resource:
$ /u01/app/11.2.0/grid/bin/crsctl status resource ggateapp
NAME=ggateapp
TYPE=cluster_resource
TARGET=ONLINE
STATE=ONLINE on node452
NOTE: TARGET and STATE should both be ONLINE.
?
3. Check status of OGG processes:
GGSCI > info all
Program Status Group Lag
Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING MYEXT 00:00:07
00:00:04
EXTRACT RUNNING MYPUMP 00:00:00 0
0:00:05
NOTE: If you also prefer to set up HA on target system, follow the same steps.
第五步. Test OGG resource failover
1. Log on to node source node as oracle user:
$ /u01/app/11.2.0/grid/bin/crsctl relocate resource ggateapp -f
CRS-2673: Attempting to stop 'ggateapp' on 'node452'
CRS-2677: Stop of 'ggateapp' on 'node452' succeeded
CRS-2673: Attempting to stop 'ggatevip' on 'node452'
CRS-2677: Stop of 'ggatevip' on 'node452' succeeded
CRS-2672: Attempting to start 'ggatevip' on 'node453'
CRS-2676: Start of 'ggatevip' on 'node453' succeeded
CRS-2672: Attempting to start 'ggateapp' on 'node453'
CRS-2676: Start of 'ggateapp' on 'node453' succeeded
?
2. Check the status of OGG resource:
$ /u01/app/11.2.0/grid/bin/crsctl status resource ggateapp
NAME=ggateapp
TYPE=cluster_resource
TARGET=ONLINE
STATE=ONLINE on node453
?
NOTE: TARGET and STATE should both be ONLINE on node453.
?
3. Log on to another node 'node453' in this example as oracle user, go to OGG directory.
?
4. Set up LD_LIBRARY_PATH as described in Section 1, start GGSCI program:
$ ggsci
?
5. Check status of OGG processes:
GGSCI > info all
Program Status Group Lag
Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING MYEXT 00:00:09 0
0:00:04
EXTRACT RUNNING MYPUMP 00:00:00 0
0:00:05
NOTE: If you also prefer to set up HA on target system, follow the same steps, and make necessary changes to directory, etc.
如下是script的詳細代碼
#!/bin/sh
#set the Oracle Goldengate installation directory
export GGS_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
export ORACLE_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
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
1. Create new VIP resource, use IP address 10.245.48.47 as example, login as root and run:
# /u01/app/11.2.0/grid/bin/appvipcfg create -network=1 -ip=10.245.48.47 -vipname=ggatevip -user=root
?
NOTE 1: '/u01/app/11.2.0/grid' is the default Oracle GRID infrastructure software directory.
NOTE 2: The example VIP resource name is 'ggatevip' and will be used in the rest of this document.
NOTE 3: -network refers to the network number, default value is '1'.
?
And you can find the network number using this command:
?
# /u01/app/11.2.0/grid/bin/crsctl stat res -p |grep -ie .network -ie
subnet |grep -ie name -ie subnet
NAME=ora.net1.network
USR_ORA_SUBNET=10.245.48.0
net1 indicates this is network 1, and the second line indicates the subnet on which the VIP will be created.
?
2. Allow oracle user to start the VIP, run this command as root:
# /u01/app/11.2.0/grid/bin/crsctl setperm resource ggatevip -u user:oracle:r-x
?
3. Log on as oracle user, start the VIP resource:
$ /u01/app/11.2.0/grid/bin/crsctl start resource ggatevip
?
4. Validate VIP is running:
$ /u01/app/11.2.0/grid/bin/crsctl status resource ggatevip
NAME=ggatevip
TYPE=app.appvip.type
TARGET=ONLINE
STATE=ONLINE on node452
?
?
NOTE: The TARGET and STATE should both be ONLINE.
?
5. Ping the VIP's IP address(10.245.48.47) and make sure it's reachable.
NOTE: If you also prefer to set up HA on target system, follow the same steps, and make necessary changes to directory, VIP resource name, IP address, etc.
第二步 Develop an agent script
1. Save the script in a file 11gr2_gg_action.scr and copy it to OGG directory.
NOTE: Make necessary changes to GGS_HOME(OGG directory) and ORACLE_HOME.
?
2. Make sure the script is executable:
$ chmod +x 11gr2_gg_action.scr
NOTE: If you also prefer to set up HA on target system, follow the same steps, and make necessary changes to GGS_HOME, ORACLE_HOME in this file.
第三步 Register OGG resource in Oracle Clusterware
1. Register OGG as a resource in Oracle Clusterware:
$ /u01/app/11.2.0/grid/bin/crsctl add resource ggateapp -type cluster_resource -attr "ACTION_SCRIPT=/cloudfs/goldengate/11gr2_gg_action.scr, \
CHECK_INTERVAL=30, START_DEPENDENCIES='hard(ggatevip,ora.ggdb.db) \
pullup(ggatevip)', STOP_DEPENDENCIES='hard(ggatevip)'"
?
NOTE 1: 'ggateapp' is the example OGG resource name and will be used in the rest of this document.
NOTE 2: 'ora.ggdb.db' is the resource name for database 'ggdb'.
?
2. Check the ggateapp resource is available as Oracle Clusterware resource:
$ /u01/app/11.2.0/grid/bin/crsctl status resource ggateapp
NAME=ggateapp
TYPE=cluster_resource
TARGET=OFFLINE
STATE=OFFLINE
NOTE: If you also prefer to set up HA on target system, follow the same steps, and make necessary changes to directory, VIP and database resource
name, etc.
第四步 Start the OGG resource
1. Start the resource, from now on you should always use Oracle Clusterware to start OGG:
?
$ /u01/app/11.2.0/grid/bin/crsctl start resource ggateapp
?
2. Check the status of OGG resource:
$ /u01/app/11.2.0/grid/bin/crsctl status resource ggateapp
NAME=ggateapp
TYPE=cluster_resource
TARGET=ONLINE
STATE=ONLINE on node452
NOTE: TARGET and STATE should both be ONLINE.
?
3. Check status of OGG processes:
GGSCI > info all
Program Status Group Lag
Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING MYEXT 00:00:07
00:00:04
EXTRACT RUNNING MYPUMP 00:00:00 0
0:00:05
NOTE: If you also prefer to set up HA on target system, follow the same steps.
第五步. Test OGG resource failover
1. Log on to node source node as oracle user:
$ /u01/app/11.2.0/grid/bin/crsctl relocate resource ggateapp -f
CRS-2673: Attempting to stop 'ggateapp' on 'node452'
CRS-2677: Stop of 'ggateapp' on 'node452' succeeded
CRS-2673: Attempting to stop 'ggatevip' on 'node452'
CRS-2677: Stop of 'ggatevip' on 'node452' succeeded
CRS-2672: Attempting to start 'ggatevip' on 'node453'
CRS-2676: Start of 'ggatevip' on 'node453' succeeded
CRS-2672: Attempting to start 'ggateapp' on 'node453'
CRS-2676: Start of 'ggateapp' on 'node453' succeeded
?
2. Check the status of OGG resource:
$ /u01/app/11.2.0/grid/bin/crsctl status resource ggateapp
NAME=ggateapp
TYPE=cluster_resource
TARGET=ONLINE
STATE=ONLINE on node453
?
NOTE: TARGET and STATE should both be ONLINE on node453.
?
3. Log on to another node 'node453' in this example as oracle user, go to OGG directory.
?
4. Set up LD_LIBRARY_PATH as described in Section 1, start GGSCI program:
$ ggsci
?
5. Check status of OGG processes:
GGSCI > info all
Program Status Group Lag
Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING MYEXT 00:00:09 0
0:00:04
EXTRACT RUNNING MYPUMP 00:00:00 0
0:00:05
NOTE: If you also prefer to set up HA on target system, follow the same steps, and make necessary changes to directory, etc.
如下是script的詳細代碼
#!/bin/sh
#set the Oracle Goldengate installation directory
export GGS_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
export ORACLE_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
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
總結
以上是生活随笔為你收集整理的11gR2 RAC GoldenGate的HA配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何解决AIX的文件系统故障
- 下一篇: 索引unusable|disable|e