ogg-ha配置



一. 使用cluster来管理OGG


1.使用安装goldengate用户来创建一个profile文件
2.为OGG vip 创建一个profile
$ORA_CRS_HOME/bin/crs_profile -create oggvip -t application -a $ORA_CRS_HOME/bin/usrvip -o oi=eth0,ov=192.168.0.24,on=255.255.255.0
3.注册资源
$ORA_CRS_HOME/bin/crs_register oggvip
4.将资源所有权给 root
./crs_setperm oggvip -o root
5.为oracle用户分配 这个资源的
./crs_setperm oggvip  -u user:oracle:r-x
6.通过oracle 启动 这个资源
$ORA_CRS_HOME/bin/crs_start oggvip
7.查看资源状态
$ORA_CRS_HOME/bin/crs_stat  oggvip




二.创建action




#!/bin/sh
#set the Oracle Goldengate installation directory
export GGS_HOME=/u01/ogg/app/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/db_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
 
 


三.创建应用profile


1.创建profile
$ORA_CRS_HOME/bin/crs_profile  -create oggvip_app -t application -r oggvip -a /u01/ogg/app/ogg/ggvip_action.scr


2.注册应用程序


$ORA_CRS_HOME/bin/crs_register oggvip_app


3.将资源所有权给 root
./crs_setperm oggvip_app -o root
4.为oracle用户分配 这个资源的
./crs_setperm oggvip_app  -u user:oracle:r-x
5.通过oracle 启动 这个资源
$ORA_CRS_HOME/bin/crs_start oggvip_app
6.查看资源状态
$ORA_CRS_HOME/bin/crs_stat  oggvip_app




















































1. add extract ext1,tranlog,begin now,threads 2


2. edit param ext1




extract ext1  
SETENV (ORACLE_HOME = "/u01/app/oracle/product/11.2.0/db_1")                        
userid goldengate,password goldengate 
tranlogoptions excludeuser goldengate
TRANLOGOPTIONS ASMUSER sys@ASM,ASMPASSWORD Cp_928584
exttrail /u01/ogg/app/ogg/ex/et 
DDL INCLUDE ALL            
dynamicresolution                        
gettruncates                      
table scott.emp;
table scott.a;  




3.add exttrail  /u01/ogg/app/ogg/ex/et extract ext1




4.add extract pump1 ,exttrailsource /u01/ogg/app/ogg/ex/et,begin now




5.edit param  pump1




extract pump1 ETROLLOVER
rmthost 192.168.0.101, mgrport 7809-7820
rmttrail /u01/ogg/app/ogg/rl/re
passthru
gettruncates
table scott.emp;
table scott.a;




6.add rmttrail /u01/ogg/app/ogg/rl/re  extract pump1






7.add replicat repl1 exttrail /u01/ogg/app/ogg/rl/re ,begin now,nodbcheckpoint


8.edit param repl1


replicat repl1
SETENV (ORACLE_HOME = "/u01/app/oracle/product/11.2.0/db_1")                              
userid goldengate@frac,password goldengate                 
assumetargetdefs 
HANDLECOLLISIONS  
DDLERROR DEFAULT DISCARD  
DDLOPTIONS REPORT                         
reperror default,discard                      
discardfile /u01/ogg/app/ogg/repl1.log,append,megabytes 100  
gettruncates                                                           
map scott.a , target scott.a ;
map scott.emp , target scott.emp ; 






9. 启动进程 有顺序:  source mgr /target mgr / source extract / replicat repl /source pump1进程




 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值