总结:
1.使用PUMP--数据泵时:
exttrail建立的trail文件是本地的,是给extract进程使用,将捕获的日志数据写入到trail文件中。
DataPump进程需要在参数文件中指定本地建立的exttrail文件,然后从这个文件中读取日志数据。
然后还要在目标端建立一个rmtrail文件,这个文件是DataPump进程通过网络写入到目标数据库。
目标数据库Replicat进程就去读rmttail指定过来的trail文件,然后应用到数据库中。
2.不使用PUMP--数据泵时:
add exttrail 和add rmttail的效果是一样的,建立的trail都是在远程的目标端的。
#########################################
实验:不使用PUMP时add exttrail 和add rmttail的效果是一样的
1.源库的配置: --检查发现 add exttrail /u01/ogg/dirdat/test/et, extract ext6 所指定的文件并没有在本地创建。
GGSCI (bys001.oel.com) 7>
add extract ext6,tranlog, begin now
EXTRACT added.
GGSCI (bys001.oel.com) 8> exit
[oracle@bys001 ogg]$
ls dirdat/
at000000 at000001 bt000000 rep2_discard.txt
[oracle@bys001 ogg]$ date
Sat Aug 31 19:17:53 CST 2013
[oracle@bys001 ogg]$ ./ggsci
GGSCI (bys001.oel.com) 1>
add exttrail /u01/ogg/dirdat/test/et, extract ext6
EXTTRAIL added.
GGSCI (bys001.oel.com) 2>
edit params ext6
extract ext6
userid ogg, password ogg
rmthost 192.168.1.213, mgrport 7809
rmttrail /u01/ogg/dirdat/test/et
table test6.test6;
~
GGSCI (bys001.oel.com) 5> start ext6
Sending START request to MANAGER ...
EXTRACT EXT6 starting
GGSCI (bys001.oel.com) 6> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT ABENDED EXT1 00:00:00 45:22:13
EXTRACT ABENDED EXT3 00:00:00 45:20:12
EXTRACT RUNNING EXT6 00:00:00 00:01:57
EXTRACT ABENDED EXTMYSQL 00:00:00 07:18:42
EXTRACT ABENDED EXTORA 00:00:00 07:18:41
EXTRACT ABENDED PUMP3 00:00:00 45:22:15
REPLICAT ABENDED REP2 00:00:00 45:20:15
GGSCI (bys001.oel.com) 8> exit
[oracle@bys001 ogg]$ date
Sat Aug 31 19:19:41 CST 2013
[oracle@bys001 ogg]$ ls dirdat/
---源库中未创建相应文档。
at000000 at000001 bt000000 rep2_discard.txt
2.目标库配置:
逐次输入以下命令:
dblogin userid ogg,password ogg
add checkpointtable ogg.checkpoint --这里如果是初次增加可以执行。已经使用过此语句增加表再执行会报错。
add replicat rep6,exttrail /u01/ogg/dirdat/test/et, checkpointtable ogg.checkpoint
edit params rep6
在弹出编辑窗口输入以下:
replicat rep6
handlecollisions
assumetargetdefs
userid ogg,password ogg
discardfile /u01/ogg/dirdat/rep6_discard.txt,append, megabytes 10
map test6.test6, target test6.test6;
启动此进程。
双方进程都启动后,在目标库可以看到源库中add exttrail /u01/ogg/dirdat/test/et, extract ext6指定的文件还是创建在了目标库上。--进程启动后创建
[oracle
@bys2 ogg]$ ls -al dirdat/test/
total 16
drwxr-xr-x 2 oracle oinstall 4096 Aug 31 19:19 .
drwxrwxr-x 3 oracle oinstall 4096 Aug 31 19:09 ..
-rw-rw-rw- 1 oracle oinstall 1276 Aug 31 19:19 et000000
-rw-rw-rw- 1 oracle oinstall 1520 Aug 31 19:20 et000001
##########################
3.测试数据同步是可以的
[oracle@bys001 ogg]$ sqlplus test6/test6
TEST6@bys1>set time on
19:20:44 TEST6@bys1>insert into test6 values(123);
1 row created.
19:20:49 TEST6@bys1>commit;
Commit complete.
19:20:53 TEST6@bys1>
#######################
目标库查询
[oracle@bys2 ogg]$ sqlplus test6/test6
TEST6@bys2>select * from test6;
AA
----------
123
811
888
4.源库OGG日志:
从使用add exttrail /u01/ogg/dirdat/test/et, extract ext6语句开始
2013-08-31 19:17:13 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): delete extract ext6.
2013-08-31 19:17:28 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): add extract ext6 tranlog, begin now.
2013-08-31 19:18:00 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle):
add exttrail /u01/ogg/dirdat/test/et extract ext6.
2013-08-31 19:18:09 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): edit params ext6.
2013-08-31 19:19:19 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): start ex.
2013-08-31 19:19:23 INFO OGG-00987 Oracle GoldenGate Command Interpreter for Oracle: GGSCI command (oracle): start ext6.
###############################
2013-08-31 19:19:23 INFO OGG-00963 Oracle GoldenGate Manager for Oracle, mgr.prm:
Command received from GGSCI on host bys001.oel.com (START EXTRACT EXT6 ).
2013-08-31 19:19:23 INFO OGG-00975 Oracle GoldenGate Manager for Oracle, mgr.prm: EXTRACT EXT6 starting.
2013-08-31 19:19:23 INFO OGG-00992 Oracle GoldenGate Capture for Oracle, ext6.prm: EXTRACT EXT6 starting.
2013-08-31 19:19:23 INFO OGG-03035 Oracle GoldenGate Capture for Oracle, ext6.prm: Operating system character set identified as UTF-8. Locale: en_US, LC_ALL:.
2013-08-31 19:19:24 INFO OGG-03500 Oracle GoldenGate Capture for Oracle, ext6.prm: WARNING: NLS_LANG environment variable does not match database character set, or not set. Using database character set value of AL32UTF8.
2013-08-31 19:19:24 INFO OGG-01635 Oracle GoldenGate Capture for Oracle, ext6.prm: BOUNDED RECOVERY: reset to initial or altered checkpoint.
2013-08-31 19:19:24 INFO OGG-01815 Oracle GoldenGate Capture for Oracle, ext6.prm: Virtual Memory Facilities for: BR
anon alloc: mmap(MAP_ANON) anon free: munmap
file alloc: mmap(MAP_SHARED) file free: munmap
target directories:
/u01/ogg/BR/EXT6.
2013-08-31 19:19:24 INFO OGG-01815 Oracle GoldenGate Capture for Oracle, ext6.prm: Virtual Memory Facilities for: COM
anon alloc: mmap(MAP_ANON) anon free: munmap
file alloc: mmap(MAP_SHARED) file free: munmap
target directories:
/u01/ogg/dirtmp.
2013-08-31 19:19:25 INFO OGG-01515 Oracle GoldenGate Capture for Oracle, ext6.prm: Positioning to begin time Aug 31, 2013 7:17:28 PM.
2013-08-31 19:19:25 INFO OGG-01516 Oracle GoldenGate Capture for Oracle, ext6.prm: Positioned to Sequence 38, RBA 4098048, SCN 0.0, Aug 31, 2013 7:17:28 PM.
2013-08-31 19:19:25 INFO OGG-00993 Oracle GoldenGate Capture for Oracle, ext6.prm: EXTRACT EXT6 started.
2013-08-31 19:19:30 INFO OGG-01226 Oracle GoldenGate Capture for Oracle, ext6.prm: Socket buffer size set to 27985 (flush size 27985).
2013-08-31 19:19:30 INFO OGG-01056 Oracle GoldenGate Capture for Oracle, ext6.prm:
Recovery initialization completed for target file /u01/ogg/dirdat/test/et000000, at RBA 1276, CSN 1532424.
2013-08-31 19:19:30 INFO OGG-01478 Oracle GoldenGate Capture for Oracle, ext6.prm: Output file /u01/ogg/dirdat/test/et is using format RELEASE 11.2.
2013-08-31 19:19:30 WARNING OGG-01438 Oracle GoldenGate Capture for Oracle, ext6.prm: Checkpoint marked as from graceful shutdown, but records found after checkpoint in trail /u01/ogg/dirdat/test/et. Expected EOF Seqno 0, RBA 0. Found Seqno 0, RBA 1276.
2013-08-31 19:19:30 INFO OGG-01026 Oracle GoldenGate Capture for Oracle, ext6.prm:
Rolling over remote file /u01/ogg/dirdat/test/et000001.
2013-08-31 19:19:30 INFO OGG-01517 Oracle GoldenGate Capture for Oracle, ext6.prm: Position of first record processed Sequence 38, RBA 4098064, SCN 0.1532477, Aug 31, 2013 7:17:39 PM.
2013-08-31 19:20:54 INFO OGG-01054 Oracle GoldenGate Capture for Oracle, ext6.prm: Recovery completed for target file /u01/ogg/dirdat/test/et000001, at RBA 1396, CSN 1532424.
2013-08-31 19:20:54 INFO OGG-01057 Oracle GoldenGate Capture for Oracle, ext6.prm: Recovery completed for all targets.
5.目标库OGG日志:
2013-08-31 19:16:20 INFO OGG-01670 Oracle GoldenGate Collector for Oracle: Closing /u01/ogg/dirdat/test/et000000.
2013-08-31 19:16:20 INFO OGG-01675 Oracle GoldenGate Collector for Oracle: Terminating because extract is stopped.
#############################
2013-08-31 19:19:10 INFO OGG-00963 Oracle GoldenGate Manager for Oracle, mgr.prm
: Command received from EXTRACT on host bys001.oel.com (START SERVER CPU -1 PRI -1 TIMEOUT 300 PARAMS ).
2013-08-31 19:19:10 INFO OGG-01677 Oracle GoldenGate Collector for Oracle: Waiting for connection (started dynamically).
2013-08-31 19:19:10 INFO OGG-00963 Oracle GoldenGate Manager for Oracle, mgr.prm: Command received from SERVER on host localhost.localdomain (REPORT 16782 7819).
2013-08-31 19:19:10 INFO OGG-00974 Oracle GoldenGate Manager for Oracle, mgr.prm: Manager started collector process (Port 7819).
2013-08-31 19:19:10 INFO OGG-01228 Oracle GoldenGate Collector for Oracle: Timeout in 300 seconds.
2013-08-31 19:19:15 INFO OGG-01229 Oracle GoldenGate Collector for Oracle:
Connected to bys001.oel.com:20294.
2013-08-31 19:19:15 INFO OGG-01669 Oracle GoldenGate Collector for Oracle: Opening /u01/ogg/dirdat/test/et000000 (byte -1, current EOF 1276).
2013-08-31 19:19:15 INFO OGG-01670 Oracle GoldenGate Collector for Oracle: Closing /u01/ogg/dirdat/test/et000000.
2013-08-31 19:19:15 INFO OGG-01669 Oracle GoldenGate Collector for Oracle:
Opening /u01/ogg/dirdat/test/et000000 (byte 1276, current EOF 1276).
2013-08-31 19:19:15 INFO OGG-01735 Oracle GoldenGate Collector for Oracle: Synchronizing /u01/ogg/dirdat/test/et000000 to disk.
2013-08-31 19:19:15 INFO OGG-01735 Oracle GoldenGate Collector for Oracle: Synchronizing /u01/ogg/dirdat/test/et000000 to disk.
2013-08-31 19:19:15 INFO OGG-01670 Oracle GoldenGate Collector for Oracle: Closing /u01/ogg/dirdat/test/et000000.
2013-08-31 19:19:15 INFO OGG-01669 Oracle GoldenGate Collector for Oracle:
Opening /u01/ogg/dirdat/test/et000001 (byte -1, current EOF 0).
2013-08-31 19:19:15 INFO OGG-01020 Oracle GoldenGate Delivery for Oracle, rep6.prm: Processed extract process RESTART_ABEND record at seq 1, rba 1337 (aborted 0 records).