一、环境描述 切换前:
|
D G 生产端 |
D G 目标端 | |
|
IP |
1 92.168.238.56 |
1 92.168.238.57 |
|
S ID |
o ra |
o radg |
|
O GG |
12.2.0.2.2 |
/ |
切换后
|
D G 目标端 |
D G 生产端 | |
|
IP |
1 92.168.238.56 |
1 92.168.238.57 |
|
S ID |
o ra |
o radg |
|
O GG |
12.2.0.2.2 |
/ |
二、 D G 正常切换 DG 切换前,会停止业务,我们在停止业务后检查 O GG 的状态,确保已经挖掘到最新的
2 .1 OGG 进程检查并停止 查看 O GG 挖掘进程是否挖掘到最新,如果为 E OF 则是最新的,则可以停止进程,否则需要等待挖掘到最新时才能停。
GGSCI (oradb) 2> send xjm_ext status
Sending STATUS request to EXTRACT XJM_EXT ...
EXTRACT XJM_EXT (PID 26888)
Current status: Recovery complete: At EOF
Current read position:
Redo thread #: 1
Sequence #: 4
RBA: 1426944
Timestamp: 2021-12-22 11:08:46.000000
SCN: 2979.1786729399 (12796494304183)
Current write position:
Sequence #: 37
RBA: 1433
Timestamp: 2021-12-22 11:08:43.350762
Extract Trail: ./dirdat/xj
停止挖掘和传输进程
GGSCI (oradb) 26> stop xjm_ext
Sending STOP request to EXTRACT XJM_EXT ...
Request processed.
GGSCI (oradb) 27> stop xjm_dmp
Sending STOP request to EXTRACT XJM_DMP ...
Request processed.
GGSCI (oradb) 29> stop mgr
2 .2NFS 挂载 OGG 目录 安装并配置 nfs 检查是否安装 N FS
rpm -qa|grep nfs
rpm -qa|grep portmap
若没安装,则手工安装
rpm -ivh nfs-
rpm -ivh portmap 服务器端配置
vi /etc/exports
添加:
/ o gg12 192.168.238.57(rw,sync,no_root_squash,no_all_squash,no_subtree_check) 启动 NFS 服务器
# service portmap start
# service nfs start
若已经启动则重启:
# service portmap restart
# service nfs restart 查看共享的服务
[root@oradb ~]# showmount -e
Export list for oradb:
/ogg12 192.168.238.57 客户端挂载共享目录
创建目录
m kdir /ogg12
mount -t nfs -o nolock,rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,actimeo=0,noac,nfsvers=3,timeo=600 192.168.238.56:/ogg 12 /ogg 12
2 .3 现生产端启动 OGG
GGSCI (ogg) 2> start mgr
Manager started.
GGSCI (ogg) 3> start xjm_ext
Sending START request to MANAGER ...
EXTRACT XJM_EXT starting
GGSCI (ogg) 4> start xjm_dmp
Sending START request to MANAGER ...
EXTRACT XJM_DMP starting
2 .4 OGG 报错查看 OGG 在生产库启动后,查看挖掘进程的信息
GGSCI (ogg) 3> info xjm_ext
EXTRACT XJM_EXT Last Started 2021-12-22 10:42 Status ABENDED
Checkpoint Lag 00:00:00 (updated 00:01:10 ago)
Log Read Checkpoint Oracle Redo Logs
2021-12-22 10:13:02 Seqno 31, RBA 3136512
SCN 2979.1786705102 (12796494279886) 查看报错信息
2021-12-22 10:42:40 ERROR OGG-02803 Oracle GoldenGate Capture for Oracle, xjm_ext.prm: Encountered a Data Guard role transition. Alter Extract to SCN 12,796,494,300,848 and restart Extract, or recreate Extract with the correct number of threads at SCN 12,796,494,300,848.
2 .2 重新指定 S CN 我们可以看到报错信息里提示:因为数据库的角色进行转换,需要重新指定 scn 号。
GGSCI (ogg) 4> alter xjm_ext,scn 12796494300848
EXTRACT altered.
GGSCI (ogg) 5> info xjm_ext
EXTRACT XJM_EXT Initialized 2021-12-22 10:45 Status STOPPED
Checkpoint Lag 00:00:00 (updated 00:00:09 ago)
Log Read Checkpoint Oracle Redo Logs
First Record Seqno 0, RBA 0
SCN 2979.1786726064 (12796494300848)
2 .4 启动挖掘进程 启动挖掘进程
GGSCI (oradb) 22> start xjm_ext
