ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 在RAC下安装配置OGG

在RAC下安装配置OGG

原创 Linux操作系统 作者:myownstars 时间:2013-06-02 17:51:54 0 删除 编辑

有多种方案

1

共享磁盘—ACFS/DBFS/OCFS2

可由任何一个节点启动OGG,若该节点crash,可由其他节点重启managerOGG进程;若本地节点的DB crash,则先停止其manager进程然后在其他节点启动

2

本地磁盘

不支持failover,如果本地节点失效则无法获取checkpoint信息

3

异机安装

GG通过tnsname连接到RACoracle日志文件必须位于共享磁盘以便extract读取

 

一般选项安装于共享磁盘,/u02ACFS文件系统,安装步骤与单实例类似,添加extract进程时应指定thread数量;

 

连接ASM

如果RAC使用ASM存储文件,则配置Extract时连接应指向ASM

对于10205/11202同时OGG版本>=11,采用DBLOGREADER API可直接连通数据库,其他版本则通过SQLNETSYS ASM用户登录;

--通过ASMUSER连接ASM时,extrat进程的buffer28672字节,而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

 

使用BEQDBLOGREADER时配置如下

--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)'"

如果OGGGRID分属不同用户,须将该应用属主设置为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

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

 

 

 

增删RAC节点需重新配置extract  1267901.1

增加节点, 需修改extractthread

1 增加新日志 alter database add logfile thread#

2 停止extract进程,获取当前检查点信息info ext , showch,然后删除该extractdelete 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 threadRAC thread的映射关系可能发生变动1342635.1

RAC thread的顺序遵从select distinct thread# from v$log的输出,而OGG thread永远从1N递增

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#60号日志

 

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15480802/viewspace-762758/,如需转载,请注明出处,否则将追究法律责任。

下一篇: stap监控IO脚本
请登录后发表评论 登录
全部评论

注册时间:2010-03-18

  • 博文量
    375
  • 访问量
    3046287