goldengate112101版本p14764589_112104补丁安装
之前介绍了如何简单安装部署OGG,详见OGGoracle-golden-date简单部署本文主要介绍如何升级OGG的版本。
为了模拟在线系统OGG的升级,首先创建一个JOB,不停的修改EMP_OGG表的EMPNO字段。
SQL> conn scott/tiger SQL> declare 2 job_ogg number; 3 begin 4 dbms_job.submit(job_ogg, 5 'UPDATE EMP_OGG SET EMPNO=EMPNO+1;commit;', 6 sysdate, 7 'sysdate+1/24/60/12'); 8 commit; 9 end; 10 / PL/SQL procedure successfully completed.
查询当前OGG同步情况。
源端:
SQL> select empno from emp_ogg; EMPNO ---------- 7412 7542 7564 7609 7697 7741 7825 7831 7882 7887 7919 7943 7945 7977 14 rows selected.
目标端:
SQL> select empno from emp_ogg; EMPNO ---------- 7412 7542 7564 7609 7697 7741 7825 7831 7882 7887 7919 7943 7945 7977 14 rows selected.
可见当前OGG同步没有问题,升级OGG后,再来看下OGG的同步情况。
升级OGG首先需要停止OGG的进程,如果在配置MGR管理进程时配置由MGR管理进程管理EXTRACT捕获进程、PUMP传输进程以及REPLICAT同步进程,只需要关闭MGR进程即可,如果向之前本人搭建的OGG环境没有设置由MGR管理进程来管理这些进程,就需要单独关闭这些进程。
源端:
关闭EXTRACT捕获进程
GGSCI (dbdream) 10> stop eora_1 Sending STOP request to EXTRACT EORA_1 ... Request processed.
关闭PUMP传输进程
GGSCI (dbdream) 11> stop pora_1 Sending STOP request to EXTRACT PORA_1 ... Request processed.
关闭MGR管理进程
GGSCI (dbdream) 12> stop mgr Manager process is required by other GGS processes. Are you sure you want to stop it (y/n)? y Sending STOP request to MANAGER ... Request processed. Manager stopped.
关闭MGR管理进程时,会提示是否确认关闭,输入y确认关闭,输入n即不关闭。
目标端:
关闭REPLICAT同步进程
GGSCI (stream) 20> stop rora_1 Sending STOP request to REPLICAT RORA_1 ... Request processed.
关闭MGR管理进程
GGSCI (stream) 21> stop mgr Manager process is required by other GGS processes. Are you sure you want to stop it (y/n)? y Sending STOP request to MANAGER ... Request processed. Manager stopped.
这样OGG就关闭了,就可以对OGG软件进行升级,升级OGG软件很简单,只需要将新的OGG安装介质解压直接覆盖OGG的安装目录就可以了,但是为了谨慎,最好先备份下OGG的关键目录,也就是CREATE SUBDIRS命令创建的目录(原则上讲,不备份也是没关系的,因为新的OGG安装文件里并不包含这些目录,除了dirprm目录,但是里面只有一个只有一行信息的文件,而且OGG并不更新这个文件,没什么影响)。
GGSCI (dbdream) 1> create subdirs Creating subdirectories under current directory /ogg Parameter files /ogg/dirprm: already exists Report files /ogg/dirrpt: created Checkpoint files /ogg/dirchk: created Process status files /ogg/dirpcs: created SQL script files /ogg/dirsql: created Database definitions files /ogg/dirdef: created Extract data files /ogg/dirdat: created Temporary files /ogg/dirtmp: created Stdout files /ogg/dirout: created
创建存放备份的目录,源端和目标端都需要。
[ogg@stream ogg]$ mkdir dbdream [ogg@stream ogg]$ mv dir* dbdream/ [ogg@stream ogg]$ mv dbdream/dirjar/ .
这是dirjar目录是OGG安装程序里带的目录,不需要备份,可能升级会更新这个目录。
上传OGG安装文件到OGG的家目录,默认是/home/ogg,源端和目标端都需要。
[ogg@dbdream ~]$ ls p14764589_112104_Linux-x86-64.zip
解压OGG安装文件,解压后会看到一个以tar结尾的打包文件,这就是OGG的安装介质,源端和目标端都需要。
[ogg@dbdream ~]$ unzip p14764589_112104_Linux-x86-64.zip Archive: p14764589_112104_Linux-x86-64.zip inflating: fbo_ggs_Linux_x64_ora11g_64bit.tar inflating: Oracle-GoldenGate-11.2.1.0.4-README.doc inflating: Oracle-GoldenGate-11.2.1.0.4-README.txt inflating: OGG-WinUnix-Rel-Notes-11.2.1.0.4.pdf [ogg@dbdream ~]$ ls fbo_ggs_Linux_x64_ora11g_64bit.tar Oracle-GoldenGate-11.2.1.0.4-README.doc p14764589_112104_Linux-x86-64.zip OGG-WinUnix-Rel-Notes-11.2.1.0.4.pdf Oracle-GoldenGate-11.2.1.0.4-README.txt
解包tar文件,直接覆盖OGG安装目录(本文是/ogg),源端和目标端都需要。
[ogg@dbdream ~]$ tar -xvf fbo_ggs_Linux_x64_ora11g_64bit.tar -C /ogg/
日志部分省略,解包后,将备份的dir开头的目录还原到OGG的安装目录,源端和目标端都需要。
[ogg@dbdream ~]$ cd /ogg/ [ogg@dbdream ogg]$ mv dirprm/ dirprm_new/ [ogg@dbdream ogg]$ mv dbdream/* .
此时需要和注意,新解压的OGG文件会包含dirprm目录,而里面只有一个jagent.prm文件,而OGG并不更新这个文件,所以在恢复这些目录之前将新的dirprm目录改了名字。jagent.prm文件内容如下:
[oracle@dbdream dirprm_new]$ cat jagent.prm COMMAND java -jar -Xms64m -Xmx512m dirjar/jagent.jar
现在就可以启动OGG了。
源端:
GGSCI (dbdream) 1> start mgr Manager started. GGSCI (dbdream) 2> info mgr Manager is running (IP port dbdream.7809). GGSCI (dbdream) 3> start pora_1 Sending START request to MANAGER ... EXTRACT PORA_1 starting GGSCI (dbdream) 4> info pora_1 EXTRACT PORA_1 Last Started 2012-11-14 04:10 Status RUNNING Checkpoint Lag 00:00:00 (updated 00:09:28 ago) Log Read Checkpoint File /ogg/dirdat/aa000002 2012-11-14 04:00:27.000000 RBA 252902 GGSCI (dbdream) 5> start eora_1 Sending START request to MANAGER ... EXTRACT EORA_1 starting GGSCI (dbdream) 6> info eora_1 EXTRACT EORA_1 Last Started 2012-11-14 04:10 Status RUNNING Checkpoint Lag 00:09:47 (updated 00:00:05 ago) Log Read Checkpoint Oracle Redo Logs 2012-11-14 04:00:27 Seqno 20, RBA 6109696 SCN 0.379865 (379865)
目标端:
GGSCI (stream) 1> start mgr Manager started. GGSCI (stream) 2> info mgr Manager is running (IP port stream.7809). GGSCI (stream) 3> start rora_1 Sending START request to MANAGER ... REPLICAT RORA_1 starting GGSCI (stream) 4> info rora_1 REPLICAT RORA_1 Last Started 2012-11-15 01:52 Status RUNNING Checkpoint Lag 00:00:00 (updated 00:00:05 ago) Log Read Checkpoint File /ogg/dirdat/pa000001 First Record RBA 267058
这样OGG就启动完成了,看下数据同步情况。
源端:
SQL> select empno from emp_ogg; EMPNO ---------- 7564 7694 7716 7761 7849 7893 7977 7983 8034 8039 8071 8095 8097 8129 14 rows selected.
目标端:
SQL> select empno from emp_ogg; EMPNO ---------- 7564 7694 7716 7761 7849 7893 7977 7983 8034 8039 8071 8095 8097 8129 14 rows selected.
数据同步正常,当然这个测试不是很有说服力,因为没有INSERT和DELETE的JOB在运行,虽然没做INSERT和DELETE等操作,但是也不会有问题,否则OGG启动不会这么顺利,毕竟源端和目标端只要有一个RBA信息对应不上,OGG的进程就会起不来。有兴趣的同仁可以自己测试下。