1 下载OGG相关版本
使用metalink帐号,下载OGG对应的版本
2 源端停止相关的应用,确认无任何数据延迟时,停止OGG进程及MGR进程(建议升级的顺序为:灾备端->生产端)
源端:
GGSCI (nxerpxip1) 6> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING DPEXX 00:00:00 00:00:06
EXTRACT RUNNING EXTXX 00:00:00 00:00:06
目标端:
GGSCI (xr_nx_axip_db1) 6> info all
Program Status Group Lag Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING REPXX 00:00:00 00:00:09
首先停止源端的抽取进程:
stop EXTXX
info EXTXX
等待投递进程将所有抽取trail文件投递完成后,停止投递进程
stop DPEXX
等待目标端将所有trail文件复制完成后,停止复制进程:
stop REPXX
info REPXX
最后停止源端和目标端的MGR:
stop mgr
$ ps -ef|grep mgr
ogg 8323104 5898456 0 22:03:52 pts/0 0:00 grep mgr
$ ps -ef|grep ggs
ogg 8323106 5898456 0 22:03:58 pts/0 0:00 grep ggs
停止完成后,使用ps -ef|grep ggs 进行进程查看
3 备份源端和目标端的OGG目录(在生产环境,由于生成的trail文件数据量比较大,故建议在备份前清理所有无用的trail文件,以减少备份的目录空间)
根据info 信息,清理trail文件
目标端:
/goldengate
xr_nx_aecc_db1#[/]cd /oradata
xr_nx_aecc_db1#[/oradata]mkdir ogg_upgrade
xr_nx_aecc_db1#[/oradata]chown ogg:oinstall ogg_upgrade
xr_nx_aecc_db1#[/oradata]ls -ltr
.........................................
drwxr-xr-x 2 ogg oinstall 96 Aug 16 15:46 ogg_upgrade
mkdir ogg_upgrade
tar -cvf /oradata/ogg_upgrade/ogg818.tar /goldengate
源端:
/goldengate
备份目录:
nxerpprd2#[/]cd /dsg
nxerpprd2#[/dsg]mkdir ogg_upgrade
nxerpprd2#[/dsg]chown ogg:dba ogg_upgrade
nxerpprd2#[/dsg]ls -ltr
...................................
drwxr-xr-x 2 ogg dba 96 Aug 16 14:43 ogg_upgrade
tar -cvf /dsg/ogg_upgrade/ogg811_1.tar /goldengate
4 解压新版本的OGG到原始目录
首先解压补丁包到/tmp/ogg
重命名/goldengate目录下的ggs_HPUX_ia64_ora10g_64bit.tar
mv ggs_HPUX_ia64_ora10g_64bit.tar ggs_HPUX_ia64_ora10g_64bit.tar.bak20160818
建议:在解压前,查看OGG目录的权限,如果没有读写权限,解压的部分文件不能覆盖原始文件,提示如下:
tar: 0511-188 Cannot create ./libicuuc38.a: Cannot open or remove a file containing a running program.
tar: 0511-188 Cannot create ./libicudata38.a: Cannot open or remove a file containing a running program.
解决方法:
修改权限后再次解压
chmod -R 775 /goldengate
chown -R ogg:oinstall /goldengate
复制/tmp/ogg目录下的ggs_HPUX_ia64_ora10g_64bit.tar 文件到/goldengate下,并使用tar -xvf 进程解压:
tar -xvf ggs_HPUX_ia64_ora10g_64bit.tar
5 更改源端的抽取进程及投递进程,让其重新生成trail文件。
INFO *
alter EXTXX etrollover
alter DPEXX etrollover
6 查看源端的抽取进程及投递进程的信息
info EXTXX detail
info DPEXX detail
7 指定投递进程和复制进程从新的trail文件开始读取
info DPEXX
alter DPEXX extseqno 39331 extrba 0
info DPEXX
目标端
ALTER REPLICAT REPXX, EXTSEQNO 39324, EXTRBA 0
8 如果使用DDL,还需要执行9-14步,否则直接启动OGG进程即可(生产管理在源端已经开启DDL语句,故需要执行如下语句)。
9 生成端停止任何的DDL操作(此步骤需要生产库停止应用),并执行ddl_disable脚本
sqlplus / as sysdba
@ddl_disable.sql
10 断开所有的会话连接
ps -ef|grep ora |grep $ORACLE_SID|grep LOCAL=NO |grep -v grep|awk '{print $2}'|xargs -i kill -9 {}
ps -ef|grep ora|grep $ORACLE_SID|grep j00|grep -v grep|awk '{print $2}'|xargs -i kill -9 {}
ps -ef|grep ora |grep $ORACLE_SID|grep LOCAL=YES |grep -v grep|awk '{print $2}'|xargs -i kill -9 {}
11 执行ddl_setup脚本
sqlplus / as sysdba
@ddl_setup.sql
12 执行role_setup脚本
@role_setup.sql
13 授权
GRANT GGS_GGSUSER_ROLE TO goldengate;
14 执行ddl_enable脚本
@ddl_enable.sql
15 升级检查点(检查是否有检查表),负责启动程序,会报错:OGG-00446
UPGRADE CHECKPOINTTABLE goldengate.CHKTAB
16 启动OGG进程
17 注意事项
Note: Steps 5 to 7 is needed if upgrading from pre-v11.2.1.0.13 to (11.2.1.0.14 through 11.2.1.0.17) due to bug 17790908 (the bug got introduced in v11.2.1.0.14).
Also if upgrading only the source and target remains with a version older than 11.2.1.0.18 then ETROLLOVER related steps are still needed.
If not doing ETROLLOVER "OGG-05500? Detected database metadata mismatch" error would be hit. Bug 17790908 fix is in 11.2.1.0.18 and above versions.
So if upgrading from pre-v11.2.1.0.13 to 11.2.1.0.18+ versions then steps 5 to 7 is optional
有可能的问题:
1 OGG无法启动,报如下错误:
2016-08-04 12:12:20 INFO OGG-02095 Oracle GoldenGate Delivery for Oracle, repda.prm: Successfully set environment variable NLS_LANG=American_America.ZHS16GBK.
2016-08-04 12:12:20 INFO OGG-00893 Oracle GoldenGate Delivery for Oracle, repda.prm: SQL statement executed successfully.
2016-08-04 12:12:20 INFO OGG-01815 Oracle GoldenGate Delivery for Oracle, repda.prm: Virtual Memory Facilities for: COM
anon alloc: mmap(MAP_ANON) anon free: munmap
file alloc: mmap(MAP_SHARED) file free: munmap
target directories:
/goldengate/dirtmp.
2016-08-04 12:12:20 ERROR OGG-00446 Oracle GoldenGate Delivery for Oracle, repda.prm: Supplemental Checkpoint table does not exist. Create a supplemental checkpoint table with the UPGRADE CHECKPOINTTABLE command in GGSCI if you have upgraded from release 11.2.1.0.0 or earlier.
2016-08-04 12:12:20 ERROR OGG-01668 Oracle GoldenGate Delivery for Oracle, repda.prm: PROCESS ABENDING.
1.1 首先使用如下方法查看检查点的表:
GGSCI (nx_apms_db1) 3> info repsa detail
REPLICAT REPSA Last Started 2016-07-22 23:43 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:01 ago)
Log Read Checkpoint File ./dirdat/sa012586
2016-08-11 10:11:03.903289 RBA 33461709
Extract Source Begin End
./dirdat/sa012586 2016-07-22 18:40 2016-08-11 10:11
./dirdat/sa012579 2016-06-23 18:43 2016-07-22 18:40
./dirdat/sa012570 2016-03-29 22:43 2016-06-23 18:43
./dirdat/sa012541 2016-03-29 22:08 2016-03-29 22:43
..................................
./dirdat/sa000000 * Initialized * First Record
Current directory /goldengate
Report file /goldengate/dirrpt/REPSA.rpt
Parameter file /goldengate/dirprm/repsa.prm
Checkpoint file /goldengate/dirchk/REPSA.cpr
Checkpoint table goldengate.ckpt
Process file /goldengate/dirpcs/REPSA.pcr
Stdout file /goldengate/dirout/REPSA.out
Error log /goldengate/ggserr.log
1.2 更新检查点表
UPGRADE CHECKPOINTTABLE GOLDENGATE.ckpt
1.3 启动进程,一切OK