OGG新增表及修改表定義

新增表

1、停止源端抽取及投遞進程

stop ext_01

stop pump_01

2、停止目標端複製進程

stop rep_01

3、修改抽取進程及投遞進程參數文件

3.1、edit params ext_01

加入以下內容

table scott.emp_ogg

3.2、edit params pump_01

加入以下內容

table scott.emp_ogg

4、源端增加表附加日誌

dblogin userid ogg,password ogg

alter trandata scott.emp_ogg

5、啓動抽取及投遞進程

start ext_01

start pump_01

6、初始化數據

6.1獲取最小SCN

select current_scn from v$database;

6.2根據scn導出初始化數據

expdp “’/ as sysdba’” directory=dp dumpfile=scott0918.dmp logfile=scott0918.log tables=scott.emp_ogg flashback_scn=xxxxxxxxx

6.3導入數據

impdp “’/ as sysdba’” directory=dp dumpfile=scott0918.dmp logfile=scott0918.log

7、修改複製進程參數文件

edit params rep_01

加入以下內容

map scott.emp_ogg, TARGET scott.emp_ogg;

8、啓動複製進程

start rep_01

同構表新增字段

如果未配置DDL同步,通過以下步驟處理

1、停止相關進程

源端

stop ext_02

stop pump_02

目標端

stop rep_02

2、新增字段

源端

alter table test_yg add age int;

目標端

alter table test_yg add age int;

3、啓動ogg進程

源端

start ext_02

start pump_02

目標端

Start rep_02

4、查看進程狀態

Stats rep_02,total

異構表新增字段

1、停止相關進程

源端

stop ext_02

stop pump_02

目標端

stop rep_02

2、新增字段,修改表結構

源端

alter table test_yg add dept varchar2(20);

目標端

alter table test_yg add remark varchar2(20);

alter table test_yg add dept varchar2(20);

查看當前結構

3、源端編輯配置文件 --這是第一次生成defgen參數文件,以後修改字段不需要再次編輯

edit params defgen

加入以下內容

DEFSFILE /ogg/dirdef/ao.def

userid ogg,password ogg

table scott.test_yg

4、生成參數文件

cd /ogg/

./defgen paramfile /ogg/dirprm/defgen.prm

5、將/ogg/dirdef目錄下的ao.def傳至目標端

Scp ao.def [email protected]:/ogg/dirdef/

6、編輯複製進程  --這是第一次添加需要加入sourcedefs參數,以後不必添加,除非修改def文件名

edit params rep_02

加入以下內容

SOURCEDEFS /ogg/dirdef/ao.def

註釋:

異構情況下ASSUMETARGETDEFS參數應該註釋掉

7、啓用各進程

源端

start ext_02

start pump_02

目標端

start rep_02

8、檢查同步狀態

stats rep_02,total

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章