ogg由普通模式转换成集成捕捉模式实验

转换条件查看上篇:将ogg捕捉模式由普通模式转换成集成捕捉


客户有一个数据库需要将源端抽取由普通模式转换成集成模式,详细诊断转换成集成模式的原因查看:ogg-00723 ogg-00715

具体步骤:

打开虚拟机

GGSCI (og1) > info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
EXTRACT     ABENDED     DPEMO       00:00:00      2493:42:21  
EXTRACT     ABENDED     DPETS       00:00:00      2493:42:21  
EXTRACT     ABENDED     EXTMO       00:00:00      2234:51:05  
EXTRACT     ABENDED     EXTTS       00:00:00      2234:51:05  
发现进程都abended,数据库未配置开机自启动

[oracle@og1 ogg]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jul 19 06:25:01 2017

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 1252663296 bytes
Fixed Size                  2252824 bytes
Variable Size             402657256 bytes
Database Buffers          838860800 bytes
Redo Buffers                8892416 bytes
Database mounted.
Database opened.
执行脚本,给ogg用户授权(我的ogg用户是ogg_ts)

SQL> exec dbms_goldengate_auth.grant_admin_privilege('OGG_TS');

查询视图

SQL> SELECT TABLE_NAME FROM DBA_TABLES WHERE OWNER='OGG_TS';

TABLE_NAME
------------------------------
GGS_DDL_RULES
GGS_DDL_RULES_LOG
OGG$Q_TAB_EXTTS
AQ$_OGG$Q_TAB_EXTTS_S
AQ$_OGG$Q_TAB_EXTTS_L
SYS_IOT_OVER_87751
AQ$_OGG$Q_TAB_EXTTS_P  ----------------------------------这些AQ$开头的表应该是脚本产生的
SYS_IOT_OVER_87774
OGG$Q_TAB_EXTMO
AQ$_OGG$Q_TAB_EXTMO_S
AQ$_OGG$Q_TAB_EXTMO_L

TABLE_NAME
------------------------------
SYS_IOT_OVER_88027
AQ$_OGG$Q_TAB_EXTMO_P
SYS_IOT_OVER_88050
AQ$_OGG$Q_TAB_EXTTS_D
AQ$_OGG$Q_TAB_EXTTS_T
AQ$_OGG$Q_TAB_EXTTS_H
AQ$_OGG$Q_TAB_EXTTS_G
AQ$_OGG$Q_TAB_EXTTS_I
AQ$_OGG$Q_TAB_EXTTS_C
AQ$_OGG$Q_TAB_EXTMO_T
AQ$_OGG$Q_TAB_EXTMO_H

TABLE_NAME
------------------------------
AQ$_OGG$Q_TAB_EXTMO_G
AQ$_OGG$Q_TAB_EXTMO_I
AQ$_OGG$Q_TAB_EXTMO_C
AQ$_OGG$Q_TAB_EXTMO_D


SCI (og1) > start *

Sending START request to MANAGER ...
EXTRACT DPEMO starting

Sending START request to MANAGER ...
EXTRACT DPETS starting

Sending START request to MANAGER ...
EXTRACT EXTMO starting

Sending START request to MANAGER ...
EXTRACT EXTTS starting

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
EXTRACT     ABENDED     DPEMO       00:00:00      2493:42:35  
EXTRACT     ABENDED     DPETS       00:00:00      2493:42:36  
EXTRACT     RUNNING     EXTMO       00:00:00      00:00:00    
EXTRACT     RUNNING     EXTTS       2234:51:11    00:00:10   

抽取正常,投递都abended,因为目标端未开启。

GGSCI (og1) > dblogin userid ogg_ts password ogg_ts
Successfully logged into database.
登陆ogg

GGSCI (og1) > info extts upgrade
ERROR: REGISTER EXTRACT EXTTS DATABASE must be performed before upgrading to integrated capture..
报错:需要注册抽取进程,需要重启抽取进程

Sending STOP request to EXTRACT EXTTS ...
Request processed.
GGSCI (og1) > dblogin userid ogg_ts password ogg_ts
Successfully logged into database.


GGSCI (og1) > register extract extts database


2017-07-19 06:30:34  INFO    OGG-02003  Extract EXTTS successfully registered with database at SCN 1570236.
此时抽取进程在scn 1570236处成功注册

GGSCI (og1) > alter extract extts ,upgrade integrated tranlog
ERROR: Extract EXTTS is not ready to be upgraded because recovery SCN 1570104 has not reached SCN 1570236.
升级成集成模式出错,抽取进程未走到1570236处。

GGSCI (og1) > info extts

EXTRACT    EXTTS     Last Started 2017-07-19 06:25   Status STOPPED
Checkpoint Lag       00:00:00 (updated 00:02:36 ago)
Log Read Checkpoint  Oracle Redo Logs
                     2017-07-19 06:29:04  Seqno 68, RBA 1083392
                     SCN 0.1570155 (1570155)
                     

GGSCI (og1) > start extts

Sending START request to MANAGER ...
EXTRACT EXTTS starting

观察scn变化 

GGSCI (og1) > info extts

EXTRACT    EXTTS     Last Started 2017-07-19 06:31   Status RUNNING
Checkpoint Lag       00:02:47 (updated 00:00:04 ago)
Log Read Checkpoint  Oracle Redo Logs
                     2017-07-19 06:29:04  Seqno 68, RBA 1083392    -----注意68
                     SCN 0.1570155 (1570155)
GGSCI (og1) > !
info extts

EXTRACT    EXTTS     Last Started 2017-07-19 06:31   Status RUNNING
Checkpoint Lag       00:00:00 (updated 00:00:00 ago)
Log Read Checkpoint  Oracle Redo Logs
                     2017-07-19 06:31:58  Seqno 69, RBA 6496768    -------注意69
                     SCN 0.1587948 (1587948)
日志号由68到69 所提到的scn应该已经达到
GGSCI (og1) > alter extract extts ,upgrade integrated tranlog
ERROR: EXTRACT EXTTS is running and cannot be altered (1,11,Resource temporarily unavailable).
开启集成模式tranlog报错,提示抽取进程running
GGSCI (og1) > stop extts

Sending STOP request to EXTRACT EXTTS ...
Request processed.
GGSCI (og1) > alter extract extts ,upgrade integrated tranlog
Extract EXTTS successfully upgraded to integrated capture.
提示修改成功

GGSCI (og1) > start extract extts

Sending START request to MANAGER ...
EXTRACT EXTTS starting
GGSCI (og1) > info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING                                           
EXTRACT     ABENDED     DPEMO       00:00:00      2493:49:50  
EXTRACT     ABENDED     DPETS       00:00:00      2493:49:51  
EXTRACT     RUNNING     EXTMO       00:00:00      00:00:01    
EXTRACT     RUNNING     EXTTS       00:00:33      00:00:00    
此时,如果观察本地的trail文件发现自动增长一个文件号

总结:

三个步骤:

1.运行授权脚本

 exec dbms_goldengate_auth.grant_admin_privilege('OGG_TS');

2.注册数据库

register extract extts database

3.升级为集成模式

alter extract extts ,upgrade integrated tranlog

你可能感兴趣的:(ogg)