您好,登錄后才能下訂單哦!
本篇文章給大家分享的是有關怎么進行ogg配置,小編覺得挺實用的,因此分享給大家學習,希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。
Ogg配置
源庫端 首先要是歸檔模式, 要開啟數(shù)據(jù)庫最小附加日志模式,和所需同步表的補全日志
命令如下
Sql > select supplemental_log_data_min from v$database;
--顯示為no 表示未開啟
Sql> alter database add supplemental log data;
--開啟數(shù)據(jù)庫級別的最小附加日志模式
Sql >select force_logging from v$database;
--查看是否開啟了強制日志模式,以免丟失數(shù)據(jù)
Sql> Alter database force logging;
--開啟日志強制模式
Sql> alter table <tablename> add supplemental log data (primary key) columns;
節(jié)點一:
alter database force logging;
alter database add supplemental log data;
alter table scott.t1 add supplemental log data (primary key) columns;
節(jié)點2:
alter database force logging;
alter database add supplemental log data;
alter table scott.t2 add supplemental log data (primary key) columns;
alter table scott.t3 add supplemental log data (primary key) columns;
create directory dp_dir as '/home/oracle/expdp/';
創(chuàng)建goldengate用戶并賦予權限:
create user goldengate identified by goldengate;
grant connect,resource to goldengate;
grant delete any table to goldengate;
grant update any table to goldengate;
grant insert any table to goldengate;
grant select any table to goldengate;
grant SELECT ANY DICTIONARY to goldengate;
--開啟基于檢查點的復制
Ggsic>dblogin userid goldengate,password goldengate
edit param ./GLOBALS
checkpointtable goldengate.checkpoint
然后保存退出,
add checkpointtable goldengate.checkpoint
ogg:
主進程配置
edit param mgr
PORT 7801
DYNAMICPORTLIST 7802-7820
Purgeoldextracts /home/oracle/ogg/dirdat/*/* USECHECKPOINTS,MINKEEPHOURS 10
AUTORESTART EXTRACT *,WAITMINUTES 2,RETRIES 5
節(jié)點一:
新增抽取進程:
edit param ext-t1
extract ext-t1
userid goldengate,password goldengate
exttrail /home/oracle/ogg/dirdat/scott/es
dynamicresolution
WARNLONGTRANS 1h,CHECKINTERVAL 3m
table scott.t1;
添加進程
add extract ext-t1,tranlog,begin now
添加本地隊列
add exttrail /home/oracle/ogg/dirdat/scott/es,extract ext-t1, megabytes 1000
新增投遞進程:
edit param pp-t1
extract pp-t1
userid goldengate ,password goldengate
RMTHOST 172.18.0.139, MGRPORT 7801,COMPRESS
rmttrail /home/oracle/ogg/dirdat/scott/t1
dynamicresolution
table scott.t1;
添加進程
add extract pp-t1,exttrailsource /home/oracle/ogg/dirdat/scott/es ,begin now
--添加遠端隊列
add rmttrail /home/oracle/ogg/dirdat/scott/t1, extract pp-t1,megabytes 1000
節(jié)點二:
新增抽取進程:
edit param ext-t2
extract ext-t2
userid goldengate,password goldengate
exttrail /home/oracle/ogg/dirdat/scott/es
dynamicresolution
WARNLONGTRANS 1h,CHECKINTERVAL 3m
table scott.t2;
table scott.t3;
添加進程
add extract ext-t2,tranlog,begin now
添加本地隊列
add exttrail /home/oracle/ogg/dirdat/scott/es,extract ext-t2, megabytes 1000
新增投遞進程:
edit param pp-t2
extract pp-t2
userid goldengate ,password goldengate
RMTHOST 172.18.0.139, MGRPORT 7801,COMPRESS
rmttrail /home/oracle/ogg/dirdat/scott/t2
dynamicresolution
table scott.t2;
table scott.t3;
添加進程
add extract pp-t2,exttrailsource /home/oracle/ogg/dirdat/scott/es ,begin now
--添加遠端隊列
add rmttrail /home/oracle/ogg/dirdat/scott/t2, extract pp-t2,megabytes 1000
目標端:
新增復制進程1:
edit param rp-t1
replicat rp-t1
userid goldengate,password goldengate
assumetargetdefs
HANDLECOLLISIONS
reperror default,discard
discardfile /home/oracle/ogg/dirdat/scott/t1.dsc,append,megabytes 1000
map scott.t1, target scott.t1;
新增復制進程:
add replicat rp-t1,exttrail /home/oracle/ogg/dirdat/scott/t1,begin now,checkpointtable goldengate.checkpoint
新增復制進程2:
edit param rp-t2
replicat rp-t2
userid goldengate,password goldengate
assumetargetdefs
HANDLECOLLISIONS
reperror default,discard
discardfile /home/oracle/ogg/dirdat/scott/t2.dsc,append,megabytes 1000
map scott.t2, target scott.t2;
map scott.t3, target scott.t3;
新增復制進程:
add replicat rp-t2,exttrail /home/oracle/ogg/dirdat/tbs01/t2,begin now,checkpointtable goldengate.checkpoint
創(chuàng)建測試表:
create table scott.t1 as select * from scott.emp;
alter table scott.t1 add constraint t1_pk primary key(empno)
create table scott.t2 as select * from scott.emp;
alter table scott.t2 add constraint t2_pk primary key(empno);
create table scott.t3 as select * from scott.emp;
alter table scott.t3 add constraint t3_pk primary key(empno);
目標庫建立相應表結構:
create table scott.t1 as select * from scott.emp where 1=2;
alter table scott.t1 add constraint t1_pk primary key(empno)
create table scott.t2 as select * from scott.emp where 1=2;
alter table scott.t2 add constraint t2_pk primary key(empno);
create table scott.t3 as select * from scott.emp where 1=2;
alter table scott.t3 add constraint t3_pk primary key(empno);
expdp/impdp導出導入測試表數(shù)據(jù)。
啟動進程:
1、 分別在各個源端和目標端啟動start mgr
2、 啟動各個源端抽取和投遞進程
3、 數(shù)據(jù)導入目標端后,啟動目標端復制進程
4、 使用info all查看各個進程狀態(tài),正常為running
5、 若出錯,使用view report + 進程名查看報錯并解決之。
測試:在源端表進行dml操作,觀察目標端相應表數(shù)據(jù)變化。若兩端一致,則ogg搭建成功
以上就是怎么進行ogg配置,小編相信有部分知識點可能是我們?nèi)粘9ぷ鲿姷交蛴玫降?。希望你能通過這篇文章學到更多知識。更多詳情敬請關注億速云行業(yè)資訊頻道。
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。