【正文】
add exttrail ./dirdat/nd,extract extnd,megabytes 100 EXTTRAIL added. GGSCI (node1) 8 edit params extnd (粘貼下面這段配置) EXTRACT extnd SETENV (NLS_LANG = ) SETENV (ORACLE_HOME = /u01/app/oracle/product/) USERID oggRAC, PASSWORD oracle GETTRUNCATES REPORTCOUNT EVERY 1 MINUTES, RATE DISCARDFILE ./dirrpt/,APPEND,MEGABYTES 1024 THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 60000 IOLATENS 60000 DBOPTIONS ALLOWUNUSEDCOLUMN WARNLONGTRANS 2h,CHECKINTERVAL 3m EXTTRAIL ./dirdat/nd TRANLOGOPTIONS EXCLUDEUSER USERNAME FETCHOPTIONS NOUSESNAPSHOT 版權(quán)所有 2021 15 TRANLOGOPTIONS CONVERTUCS2CLOBS TABLE 。 注意: threads與 RAC節(jié)點(diǎn)數(shù)相同即可 , RAC中不再使用 ORACLE_SID設(shè)置, 而使用 USERID oggRAC,注意兩個(gè)節(jié)點(diǎn)均可連接數(shù)據(jù)庫 。 TABLE 。 grant connect,resource,unlimited tablespace to ogg。 grant select any dictionary,select any table to ogg。 grant flashback any table to ogg。 grant insert any table to ogg。 grant update any table to ogg。 啟動(dòng) 進(jìn)程 進(jìn)行數(shù)據(jù)同步 啟動(dòng)源端進(jìn)程 組 啟動(dòng)抽取進(jìn)程和傳輸進(jìn)程: start extnd start dpend 啟動(dòng)后使用 info all 查看進(jìn)程狀態(tài),正常 status 應(yīng)該 RUNNING,顯示如下: GGSCI (node1) 19 info all 版權(quán)所有 2021 17 Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING EXTRACT RUNNING DPEND 00:00:00 00:00:09 EXTRACT RUNNING EXTND 00:00:00 00:00:04 啟動(dòng)目標(biāo)端進(jìn)程 start repnd 顯示如下: GGSCI () 2 info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING REPLICAT RUNNING REPND 00:00:00 00:00:03 到此 RAC 到單點(diǎn) OGG 的安裝配置就完成了,可以進(jìn)行數(shù)據(jù)同步測試了。如果其中一個(gè)節(jié)點(diǎn)失敗,導(dǎo)致 GoldenGate 進(jìn)程中止,可 以 直接 手工 在另外一個(gè)節(jié)點(diǎn) 啟動(dòng) 進(jìn)程組即可 。 添加一個(gè)應(yīng)用程序 VIP 資源 為 GoldenGate vip 資源創(chuàng)建一個(gè) profile [oraclenode1 ggate]$ cd $ORA_CRS_HOME/bin [oraclenode1 bin]$ pwd /u01/app/oracle/product/[oraclenode1 bin]$ crs_profile –create ggvip –t application \ –a /u01/app/oracle/product/\ o oi=eth0,ov=,on= 其中: ggvip 為創(chuàng)建的應(yīng)用程序 vip 的名字 把這個(gè)資源注冊到 CRS: 需求規(guī)格說明書 18 版權(quán)所有 2021 [oraclenode1 bin]$ crs_register ggvip 把 vip 的所有權(quán)給 root,在 root 用戶下執(zhí)行: [rootnode1 bin] ./crs_setperm ggvip –o root 為 oracle 用戶分配啟動(dòng)這個(gè)資源的權(quán)限: [rootnode1 bin] ./crs_setperm ggvip –u user:oracle:rx 通過 oracle 用戶啟動(dòng)這個(gè)資源: [oraclenode1 bin]$ crs_start ggvip Attempting to start `ggvip` on member `node1` Start of `ggvip` on member `node1` succeeded. 查看資源狀態(tài)顯示如下: [oraclenode1 bin]$ crs_stat ggvip t Name Type Target State Host ggvip application ONLINE ONLINE node1 創(chuàng)建一個(gè) action 程序 action 程序我們這里放到共享磁盤上, action 程序最少需要可以接受三個(gè)參數(shù) : start,stop,check start 和 stop:返回 0 成功, 1 失??; check : 返回 0 表示 GoldenGate 在運(yùn)行 , 1 表示不運(yùn)行 ; 下面為示例程序 的內(nèi)容: !/bin/sh set the Oracle Goldengate installation directory export GGS_HOME=/ggate 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/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/ ] ) then pid=`cut f8 ${GGS_HOME}/dirpcs/` 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` ] 版權(quán)所有 2021 19 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 mand call_ggsci () { ggsci_mand=$1 ggsci_output=`${GGS_HOME}/ggsci EOF ${ggsci_mand} exit EOF` } case $1 in 39。) start manager call_ggsci 39。 there is a small delay between issuing the start manager mand 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 。stop39。stop er *39。stop er *!39。kill er *39。stop manager!39。 39。) check_process 。clean39。stop er *39。stop er *!39。kill er *39。stop manager!39。 39。) ensure everything is stopped call_ggsci 39。 in case there are lingering processes call_ggsci 39。 stop manager without (y/n) confirmation call_ggsci 39。 exit success exit 0 。 6 常見錯(cuò)誤 及解決方法 OGG00446 啟動(dòng)源端抽取進(jìn)程 extnd, 錯(cuò)誤顯示如下: 20210817 11:11:38 ERROR OGG00446 Oracle GoldenGate Capture for Oracle, : Could not find archived log for sequence 45835 thread 1 under default destinations SQL SELECT name FROM v$archived_log WHERE sequence = :ora_seq_no AND thread = :ora_thread AND resetlogs_id = :ora_resetlog_id AND archived = 39。 AND deleted = 39。 AND name not like 39。 AND standby_dest = 39。 , error retrieving redo file name for sequence 45835, archived = 1, use_alternate = 0Not able to establish initial position for begin time 20210815 17: