本篇文章給大家分享的是有關(guān)怎么進(jìn)行ogg配置,小編覺得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。
創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:做網(wǎng)站、網(wǎng)站設(shè)計(jì)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的和平網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!
Ogg配置
源庫端 首先要是歸檔模式, 要開啟數(shù)據(jù)庫最小附加日志模式,和所需同步表的補(bǔ)全日志
命令如下
Sql > select supplemental_log_data_min from v$database;
--顯示為no 表示未開啟
Sql> alter database add supplemental log data;
--開啟數(shù)據(jù)庫級(jí)別的最小附加日志模式
Sql >select force_logging from v$database;
--查看是否開啟了強(qiáng)制日志模式,以免丟失數(shù)據(jù)
Sql> Alter database force logging;
--開啟日志強(qiáng)制模式
Sql> alter table
節(jié)點(diǎn)一:
alter database force logging;
alter database add supplemental log data;
alter table scott.t1 add supplemental log data (primary key) columns;
節(jié)點(diǎn)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用戶并賦予權(quán)限:
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;
--開啟基于檢查點(diǎn)的復(fù)制
Ggsic>dblogin userid goldengate,password goldengate
edit param ./GLOBALS
checkpointtable goldengate.checkpoint
然后保存退出,
add checkpointtable goldengate.checkpoint
ogg:
主進(jìn)程配置
edit param mgr
PORT 7801
DYNAMICPORTLIST 7802-7820
Purgeoldextracts /home/oracle/ogg/dirdat/*/* USECHECKPOINTS,MINKEEPHOURS 10
AUTORESTART EXTRACT *,WAITMINUTES 2,RETRIES 5
節(jié)點(diǎn)一:
新增抽取進(jìn)程:
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;
添加進(jìn)程
add extract ext-t1,tranlog,begin now
添加本地隊(duì)列
add exttrail /home/oracle/ogg/dirdat/scott/es,extract ext-t1, megabytes 1000
新增投遞進(jìn)程:
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;
添加進(jìn)程
add extract pp-t1,exttrailsource /home/oracle/ogg/dirdat/scott/es ,begin now
--添加遠(yuǎn)端隊(duì)列
add rmttrail /home/oracle/ogg/dirdat/scott/t1, extract pp-t1,megabytes 1000
節(jié)點(diǎn)二:
新增抽取進(jìn)程:
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;
添加進(jìn)程
add extract ext-t2,tranlog,begin now
添加本地隊(duì)列
add exttrail /home/oracle/ogg/dirdat/scott/es,extract ext-t2, megabytes 1000
新增投遞進(jìn)程:
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;
添加進(jìn)程
add extract pp-t2,exttrailsource /home/oracle/ogg/dirdat/scott/es ,begin now
--添加遠(yuǎn)端隊(duì)列
add rmttrail /home/oracle/ogg/dirdat/scott/t2, extract pp-t2,megabytes 1000
目標(biāo)端:
新增復(fù)制進(jìn)程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;
新增復(fù)制進(jìn)程:
add replicat rp-t1,exttrail /home/oracle/ogg/dirdat/scott/t1,begin now,checkpointtable goldengate.checkpoint
新增復(fù)制進(jìn)程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;
新增復(fù)制進(jìn)程:
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);
目標(biāo)庫建立相應(yīng)表結(jié)構(gòu):
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導(dǎo)出導(dǎo)入測試表數(shù)據(jù)。
啟動(dòng)進(jìn)程:
1、 分別在各個(gè)源端和目標(biāo)端啟動(dòng)start mgr
2、 啟動(dòng)各個(gè)源端抽取和投遞進(jìn)程
3、 數(shù)據(jù)導(dǎo)入目標(biāo)端后,啟動(dòng)目標(biāo)端復(fù)制進(jìn)程
4、 使用info all查看各個(gè)進(jìn)程狀態(tài),正常為running
5、 若出錯(cuò),使用view report + 進(jìn)程名查看報(bào)錯(cuò)并解決之。
測試:在源端表進(jìn)行dml操作,觀察目標(biāo)端相應(yīng)表數(shù)據(jù)變化。若兩端一致,則ogg搭建成功
以上就是怎么進(jìn)行ogg配置,小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見到或用到的。希望你能通過這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。