您好,登錄后才能下訂單哦!
Configure Extract(提取) Process in Source system
配置capture(捕獲)參數
Edit extract process parameter
GGSCI (gc2) 21> EDIT PARAMS EORA_1 配置capture參數文件
-- Change Capture parameter file to capture
-- EMP_OGG and DEPT_OGG changes
EXTRACT EORA_1
SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
USERID ogg, PASSWORD ogg
EXTTRAIL /u01/app/ogg/dirdat/aa 跟蹤提取文件放在/u01/app/ogg/dirdat目錄下文件名以aa為前綴的文件中:例aa000000
TABLE scott.TCUSTMER; capture(捕獲)要監視的表名,capture可以監視多張表也可以值監視一張表
TABLE scott.TCUSTORD;
Please note that “aa” is prefix for local trail file.
Execute the following commands in source system to add Primary Extract group.
GGSCI (gc2) 22> ADD EXTRACT EORA_1, TRANLOG, BEGIN NOW
EXTRACT added.
ADD EXTRACT EORA_1:添加EXTRACT進程,這就是一直運行,一段停止redo 里的日志就沒人去抓取了
TRANLOG, BEGIN NOW:現在開始同步日志,也可以用異步,那就要另外配置
Define GoldenGate local trail
GGSCI (gc2) 24> ADD EXTTRAIL /u01/app/ogg/dirdat/aa,EXTRACT EORA_1, MEGABYTES 5 添加跟蹤文件給EORA_1用,大小為5M
EXTTRAIL added.
Start primary Extract process
GGSCI (gc2) 25> START EXTRACT EORA_1 //啟動進程
Sending START request to MANAGER ...
EXTRACT EORA_1 starting
Verify extract process is running or not:
GGSCI (gc2) 26> INFO EXTRACT EORA_1
EXTRACT EORA_1 Last Started 2014-08-11 18:57 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:01 ago)
Log Read Checkpoint Oracle Redo Logs
2014-08-11 18:57:57 Seqno 9, RBA 2469888
表示現在讀取的日志系列號是 sequence 9,RBA 2469888 發生檢查點的位置,檢查的發生時間和MTTR設置有關,發生檢查點
就是將這個檢查點之前的臟數據塊通過DBWn寫入數據文件中,發生檢查點的位置就是RBA,一個新的紀元又開始了,這個檢查點以前的都保留了
SQL> select group#,sequence#,status from v$log;
GROUP# SEQUENCE# STATUS
---------- ---------- ----------------
1 8 INACTIVE
2 9 CURRENT
3 7 INACTIVE
[oracle@gc2 ~]$ ps -ef | grep ogg 查看EORA_1進程
oracle 3843 3554 0 18:57 ? 00:00:00 /u01/app/ogg/extract PARAMFILE /u01/app/ogg/dirprm/eora_1.prm REPORTFILE /u01/app/ogg/dirrpt/EORA_1.rpt PROCESSID EORA_1 USESUBDIRS
Now Goldengate will generate local tail file “aa000000” under dirdat in Source system:
[oracle@gc2 ~]$ ll /u01/app/ogg/dirdat/ 查看要跟蹤的日志信息,捕獲(capture)的日志信息就放在這個跟蹤文件里面
total 4
-rw-rw-rw- 1 oracle oinstall 906 Aug 11 18:57 aa000000
Configure pump(傳遞) process in source system--------------------------------
配置傳遞到目標庫(target)的信息
Edit data pump process parameter
GGSCI (gc2) 27> EDIT PARAMS PORA_1
-- Data Pump parameter file to read the local
-- trail of EMP_OGG and DEPT_OGG changes
--
EXTRACT PORA_1
SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
PASSTHRU
RMTHOST oraclelinux54.cuug.net, MGRPORT 7809 將捕獲的日志傳送到目標主機oraclelinux54.cuug.net,端口7809
RMTTRAIL /u01/app/ogg/dirdat/pa
TABLE scott.TCUSTMER;
TABLE scott.TCUSTORD;
Add data pump Extract group
GGSCI (gc2) 29> ADD EXTRACT PORA_1, EXTTRAILSOURCE /u01/app/ogg/dirdat/aa
告訴PORA_1要傳送哪個路徑下的跟蹤信息
EXTRACT added.
Verify results:
GGSCI (gc2) 30> INFO EXTRACT PORA_1
EXTRACT PORA_1 Initialized 2014-08-11 19:08 Status STOPPED
Checkpoint Lag 00:00:00 (updated 00:00:23 ago)
Log Read Checkpoint File /u01/app/ogg/dirdat/aa000000
First Record RBA 0
Add GoldenGate remote(遠程) trail in Source system
在源數據庫端配置遠程的路徑及文件
GGSCI (gc2) 31> ADD RMTTRAIL /u01/app/ogg/dirdat/pa, EXTRACT PORA_1, MEGABYTES 5
表示把捕獲到的信息傳送到遠程的哪個目錄的文件中
RMTTRAIL added.
Start data pump process:
GGSCI (gc2) 32> START EXTRACT PORA_1 啟動傳送,一直運行
Sending START request to MANAGER ...
EXTRACT PORA_1 starting
Verify the results:
GGSCI (gc2) 33> INFO EXTRACT PORA_1
EXTRACT PORA_1 Last Started 2014-08-11 19:11 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:00 ago)
Log Read Checkpoint File /u01/app/ogg/dirdat/aa000000
First Record RBA 906
Now Goldengate will generate remote tail file “pa000000” under dirdat in Target system:
[oracle@gc2 ~]$ ll /u01/app/ogg/dirdat/
total 4
-rw-rw-rw- 1 oracle oinstall 906 Aug 11 18:57 aa000000
Configure replicat(復制) process in target system-----------------------------------------
在目標端配置怎么接收,怎么處理傳過來的信息
Create GLOBALS parameter in target system
Edit GLOBALS(upper case) parameter file to indicate checkpoint table
GGSCI (oraclelinux54.cuug.net) 5> EDIT PARAMS ./GLOBALS
CHECKPOINTTABLE ogg.ggschkpt 用到ogg下的checkpoint表
Verify:
[oracle@oraclelinux54.cuug.net:/u01/app/ogg]$ll GLOBALS
-rw-rw-rw- 1 oracle oinstall 29 Aug 11 07:14 GLOBALS
For GLOBALS configuration take effect, we must exit GGSCI session:
GGSCI (oraclelinux54.cuug.net) 6> exit
Add replicat checkpoint table in target system:
GGSCI (oraclelinux54.cuug.net) 1> DBLOGIN USERID ogg, PASSWORD ogg 登入到目標數據庫
Successfully logged into database.
GGSCI (oraclelinux54.cuug.net) 2> ADD CHECKPOINTTABLE 把檢查點信息放到這個表當中,專門存放checkpoint的表
Successfully created checkpoint table OGG.
sys@TDB112>conn ogg/ogg
ogg@TDB112>select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------------------------------------------------------------------ --------------------- ----------
GGSCHKPT TABLE
Edit Delivery process parameter
Add Replicat group:
GGSCI (oraclelinux54.cuug.net) 4>ADD REPLICAT RORA_1, EXTTRAIL/u01/app/ogg/dirdat/pa
表示從哪里提取傳送過來的信息
REPLICAT added.
Edit replicat process RORA_1 parameter:
GGSCI (oraclelinux54.cuug.net) 7> EDIT PARAM RORA_1
--
-- Change Delivery parameter file to apply
-- EMP_OGG and DEPT_OGG Changes
--
REPLICAT RORA_1
SETENV (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
USERID ogg, PASSWORD ogg
HANDLECOLLISIONS
ASSUMETARGETDEFS
DISCARDFILE ./dirrpt/RORA_aa.DSC, PURGE
MAP scott.tcustmer, TARGET scott.tcustmer; 源數據庫中的哪個表,目標數據庫中的哪個表接收
MAP scott.tcustord, TARGET scott.tcustord;
Note: In the MAP statement, the first owner/schema is for the source and the second for the target.
Start Replicat process:
GGSCI (oraclelinux54.cuug.net) 8> START REPLICAT RORA_1
Sending START request to MANAGER ...
REPLICAT RORA_1 starting
Verify:
GGSCI (oraclelinux54.cuug.net) 9> INFO REPLICAT RORA_1
REPLICAT RORA_1 Initialized 2014-08-11 07:20 Status STOPPED
Checkpoint Lag 00:00:00 (updated 00:07:19 ago)
Log Read Checkpoint File /u01/app/ogg/dirdat/pa000000
First Record RBA 0
Verify if DML can be duplicated correctly
Insert operation
Insert data in source system:
SQL> conn scott/tiger
SQL> insert into tcustmer values ('abbb','beijing','shanghao' ,'ch');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from tcustmer;
CUST NAME CITY ST
---- ------------------------------ -------------------- --
WILL BG SOFTWARE CO. SEATTLE WA
JANE ROCKY FLYER INC. DENVER CO
abb beijing shanghao ch
Check the result in target system:
SQL> select * from tcustmer;
CUST NAME CITY ST
---- ------------------------------ -------------------- --------------------------------------
WILL BG SOFTWARE CO. SEATTLE WA
JANE ROCKY FLYER INC. DENVER CO
abb beijing shanghao ch
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。