goldengate的官方文档中说,每个进程对应一个(组)trail文件,每个trail文件只对应一个进程。
但实际使用时,由于误操作而给extract进程e_tmp添加了两个trail文件(组),下面实验是删除方法,
即停掉extract进程后执行delete exttrail ./dirdat/xx
1)切换到GG_HOME目录,查看进程
[oracle@rhlinux ogg]$ pwd
/u02/ogg
[oracle@rhlinux ogg]$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x86, 32bit (optimized), Oracle 11g on Apr 23 2012 08:09:25
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (rhlinux) 1> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT_1 00:00:00 00:00:01
EXTRACT RUNNING E_TMP 00:00:00 00:00:06
EXTRACT RUNNING PUMP_1 00:00:00 00:00:03
EXTRACT RUNNING P_TMP 00:00:00 00:00:01
GGSCI (rhlinux) 9> exit
2)查看trail文件
[oracle@rhlinux ogg]$ cd dirdat
[oracle@rhlinux dirdat]$ ls -lrt
total 616
-rw-rw-rw- 1 oracle oinstall 48965 Jul 14 14:33 e1000000
-rw-rw-rw- 1 oracle oinstall 13514 Jul 14 15:14 e1000001
-rw-rw-rw- 1 oracle oinstall 1061 Jul 14 15:16 e1000002
-rw-rw-rw- 1 oracle oinstall 1061 Jul 14 15:19 e1000003
-rw-rw-rw- 1 oracle oinstall 320441 Jul 15 21:49 tp000000
-rw-rw-rw- 1 oracle oinstall 1473 Jul 15 22:01 tq000000
-rw-rw-rw- 1 oracle oinstall 174887 Jul 16 01:52 e1000004
-rw-rw-rw- 1 oracle oinstall 38888 Jul 16 02:20 tp000001
-rw-rw-rw- 1 oracle oinstall 1490 Jul 16 02:21 tp000002
3)修改mgr进程,将过期trail文件删除
[oracle@rhlinux dirdat]$ cd ..
[oracle@rhlinux ogg]$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x86, 32bit (optimized), Oracle 11g on Apr 23 2012 08:09:25
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (rhlinux) 1> stop *
Sending STOP request to EXTRACT EXT_1 ...
Request processed.
Sending STOP request to EXTRACT E_TMP ...
Request processed.
Sending STOP request to EXTRACT PUMP_1 ...
Request processed.
Sending STOP request to EXTRACT P_TMP ...
Request processed.
GGSCI (rhlinux) 2> stop mgr
Manager process is required by other GGS processes.
Are you sure you want to stop it (y/n)? y
Sending STOP request to MANAGER ...
Request processed.
Manager stopped.
GGSCI (rhlinux) 3> edit params mgr
GGSCI (rhlinux) 4> view params mgr
port 7811
dynamicportlist 7812-7820
autorestart extract *,waitminutes 2,retries 3
PURGEOLDEXTRACTS ./dirdat/*, USECHECKPOINTS, MINKEEPHOURS 1 --此行是新添加的内容,表示超过一小时且超过读检查点的数据自动删除
GGSCI (rhlinux) 5> start mgr
Manager started.
GGSCI (rhlinux) 6> start *
Sending START request to MANAGER ...
EXTRACT EXT_1 starting
Sending START request to MANAGER ...
EXTRACT E_TMP starting
Sending START request to MANAGER ...
EXTRACT PUMP_1 starting
Sending START request to MANAGER ...
EXTRACT P_TMP starting
GGSCI (rhlinux) 7> exit
4)查看删除效果
[oracle@rhlinux ogg]$ cd dirdat
[oracle@rhlinux dirdat]$ ls
e1000004 tp000001 tp000002 tq000000
[oracle@rhlinux dirdat]$ ls -lrt
total 224
-rw-rw-rw- 1 oracle oinstall 1473 Jul 15 22:01 tq000000
-rw-rw-rw- 1 oracle oinstall 174887 Jul 16 01:52 e1000004
-rw-rw-rw- 1 oracle oinstall 38888 Jul 16 02:20 tp000001
-rw-rw-rw- 1 oracle oinstall 1490 Jul 16 02:21 tp000002
[oracle@rhlinux dirdat]$ date
Thu Jul 16 02:23:16 CST 2015
5)查看删除trail文件的语法
[oracle@rhlinux dirdat]$ cd -
/u02/ogg
[oracle@rhlinux ogg]$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x86, 32bit (optimized), Oracle 11g on Apr 23 2012 08:09:25
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (rhlinux) 2> help delete exttrail
DELETE EXTTRAIL
Use DELETE EXTTRAIL to delete the record of checkpoints associated with
a trail on a local system. Checkpoints are maintained in a file bearing
the same name as the group in the dirchk sub-directory of the Oracle
GoldenGate directory.
This command only deletes references to the specified trail from the
checkpoint file. It does not delete the trail files themselves. To
delete the trail files, use standard operating system commands for
removing files.
Syntax:
DELETE EXTTRAIL
The fully qualified path name of the trail, including the two-character
trail prefix.
Example:
DELETE EXTTRAIL /home/ggs/dirdat/et
6)查看检查点状态
GGSCI (rhlinux) 3> info e_tmp,showch
EXTRACT E_TMP Last Started 2015-07-16 02:28 Status RUNNING
Checkpoint Lag 00:00:47 (updated 00:00:10 ago)
Log Read Checkpoint Oracle Redo Logs
2015-07-16 02:28:02 Seqno 629, RBA 25148928
SCN 0.10432015 (10432015)
Current Checkpoint Detail:
Read Checkpoint #1
Oracle Redo Log
Startup Checkpoint (starting position in the data source):
Thread #: 1
Sequence #: 629
RBA: 25148432
Timestamp: 2015-07-16 02:28:02.000000
SCN: 0.10432015 (10432015)
Redo File: /u01/oradata/testdb/redo02.log
Recovery Checkpoint (position of oldest unprocessed transaction in the data source):
Thread #: 1
Sequence #: 629
RBA: 25148432
Timestamp: 2015-07-16 02:28:02.000000
SCN: 0.10432015 (10432015)
Redo File: /u01/oradata/testdb/redo02.log
Current Checkpoint (position of last record read in the data source):
Thread #: 1
Sequence #: 629
RBA: 25148928
Timestamp: 2015-07-16 02:28:02.000000
SCN: 0.10432015 (10432015)
Redo File: /u01/oradata/testdb/redo02.log
Write Checkpoint #1
GGS Log Trail
Current Checkpoint (current write position):
Sequence #: 4
RBA: 1061
Timestamp: 2015-07-16 02:28:49.692372
Extract Trail: ./dirdat/tp --该进程有两个检查点,分别是tp和tq开头
Write Checkpoint #2
GGS Log Trail
Current Checkpoint (current write position):
Sequence #: 0
RBA: 0
Timestamp: 2015-07-15 21:49:28.284243
Extract Trail: ./dirdat/tq --该进程有两个检查点,分别是tp和tq开头
CSN state information:
CRC: 28-31-66-7A
CSN: Not available
Header:
Version = 2
Record Source = A
Type = 10
# Input Checkpoints = 1
# Output Checkpoints = 2
File Information:
Block Size = 2048
Max Blocks = 100
Record Length = 2048
Current Offset = 0
Configuration:
Data Source = 3
Transaction Integrity = 1
Task Type = 0
Status:
Start Time = 2015-07-16 02:28:49
Last Update Time = 2015-07-16 02:28:49
Stop Status = A
Last Result = 0
GGSCI (rhlinux) 12> view params e_tmp
extract e_tmp
userid ogg password ogg
exttrail ./dirdat/tp
table tmp_user.*;
GGSCI (rhlinux) 13> exit
7)向表中添加数据,观察trail文件变化:
[oracle@rhlinux ogg]$ cd dirdat
[oracle@rhlinux dirdat]$ ls -lrt
total 264
-rw-rw-rw- 1 oracle oinstall 1473 Jul 15 22:01 tq000000
-rw-rw-rw- 1 oracle oinstall 38888 Jul 16 02:20 tp000001
-rw-rw-rw- 1 oracle oinstall 1061 Jul 16 02:23 e1000005
-rw-rw-rw- 1 oracle oinstall 174887 Jul 16 02:23 e1000004
-rw-rw-rw- 1 oracle oinstall 1490 Jul 16 02:23 tp000002
-rw-rw-rw- 1 oracle oinstall 1914 Jul 16 02:28 tp000003
-rw-rw-rw- 1 oracle oinstall 29653 Jul 16 02:30 tp000004 --此文件是新产生的,也就是说,tp是正在使用的trail文件,而tq当前未使用
[oracle@rhlinux dirdat]$ date
Thu Jul 16 02:31:02 CST 2015
8)下面删除tq开头的文件
[oracle@rhlinux dirdat]$ cd ..
[oracle@rhlinux ogg]$ ./ggsci
Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x86, 32bit (optimized), Oracle 11g on Apr 23 2012 08:09:25
Copyright (C) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
GGSCI (rhlinux) 1> stop e_tmp
Sending STOP request to EXTRACT E_TMP ...
Request processed.
GGSCI (rhlinux) 2> delete exttrail ./dirdat/tq
Deleting extract trail ./dirdat/tq for extract E_TMP
GGSCI (rhlinux) 3> start e_tmp
Sending START request to MANAGER ...
EXTRACT E_TMP starting
GGSCI (rhlinux) 6> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT_1 00:00:00 00:00:09
EXTRACT RUNNING E_TMP 00:00:36 00:00:10
EXTRACT RUNNING PUMP_1 00:00:00 00:00:09
EXTRACT RUNNING P_TMP 00:00:00 00:00:02
GGSCI (rhlinux) 7> !
info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT_1 00:00:00 00:00:07
EXTRACT RUNNING E_TMP 00:00:00 00:00:08
EXTRACT RUNNING PUMP_1 00:00:00 00:00:07
EXTRACT RUNNING P_TMP 00:00:00 00:00:00
GGSCI (rhlinux) 8> info e_tmp,showch
EXTRACT E_TMP Last Started 2015-07-16 02:31 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:08 ago)
Log Read Checkpoint Oracle Redo Logs
2015-07-16 02:32:02 Seqno 629, RBA 25397760
SCN 0.10432254 (10432254)
Current Checkpoint Detail:
Read Checkpoint #1
Oracle Redo Log
Startup Checkpoint (starting position in the data source):
Thread #: 1
Sequence #: 629
RBA: 25359888
Timestamp: 2015-07-16 02:31:13.000000
SCN: 0.10432188 (10432188)
Redo File: /u01/oradata/testdb/redo02.log
Recovery Checkpoint (position of oldest unprocessed transaction in the data source):
Thread #: 1
Sequence #: 629
RBA: 25396752
Timestamp: 2015-07-16 02:31:59.000000
SCN: 0.10432252 (10432252)
Redo File: /u01/oradata/testdb/redo02.log
Current Checkpoint (position of last record read in the data source):
Thread #: 1
Sequence #: 629
RBA: 25397760
Timestamp: 2015-07-16 02:32:02.000000
SCN: 0.10432254 (10432254)
Redo File: /u01/oradata/testdb/redo02.log
Write Checkpoint #1
GGS Log Trail
Current Checkpoint (current write position):
Sequence #: 5
RBA: 1204
Timestamp: 2015-07-16 02:32:11.232764
Extract Trail: ./dirdat/tp --删除后只剩下一个写检查点,且trail文件为tp
CSN state information:
CRC: E2-68-59-BC
Latest CSN: 10432237
Latest TXN: 18.13.2471
Latest CSN of finished TXNs: 10432237
Completed TXNs: 18.13.2471
Header:
Version = 2
Record Source = A
Type = 10
# Input Checkpoints = 1
# Output Checkpoints = 1
File Information:
Block Size = 2048
Max Blocks = 100
Record Length = 2048
Current Offset = 0
Configuration:
Data Source = 3
Transaction Integrity = 1
Task Type = 0
Status:
Start Time = 2015-07-16 02:31:49
Last Update Time = 2015-07-16 02:32:11
Stop Status = A
Last Result = 400
当然,这是在trail文件当前没有使用的情况下才可以正常删除。
如果继续删除tp,则会报错:
GGSCI (rhlinux) 7> add exttrail ./dirdat/tt ,extract e_tmp
EXTTRAIL added.
GGSCI (rhlinux) 8> delete exttrail ./dirdat/tp
Deleting extract trail ./dirdat/tp for extract E_TMP
Cannot delete extract trail ./dirdat/tp, extract P_TMP is running.
GGSCI (rhlinux) 9> stop p_tmp
Sending STOP request to EXTRACT P_TMP ...
Request processed.
GGSCI (rhlinux) 10> delete exttrail ./dirdat/tp
Deleting extract trail ./dirdat/tp for extract P_TMP
GGSCI (rhlinux) 14> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT_1 00:00:00 00:00:08
EXTRACT STOPPED E_TMP 00:00:00 00:02:32
EXTRACT RUNNING PUMP_1 00:00:00 00:00:09
EXTRACT STOPPED P_TMP 00:00:00 00:01:46
GGSCI (rhlinux) 15> start e_tmp
Sending START request to MANAGER ...
EXTRACT E_TMP starting
GGSCI (rhlinux) 16> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT_1 00:00:00 00:00:05
EXTRACT STOPPED E_TMP 00:00:00 00:02:39
EXTRACT RUNNING PUMP_1 00:00:00 00:00:06
EXTRACT STOPPED P_TMP 00:00:00 00:01:53
GGSCI (rhlinux) 17> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT_1 00:00:00 00:00:08
EXTRACT ABENDED E_TMP 00:00:00 00:02:42
EXTRACT RUNNING PUMP_1 00:00:00 00:00:09
EXTRACT STOPPED P_TMP 00:00:00 00:01:57
GGSCI (rhlinux) 18> exit
[oracle@rhlinux ogg]$ tail -20 ggserr.log
2015-07-16 02:54:30 INFO OGG-00975 Oracle GoldenGate Manager for Oracle, mgr.prm: EXTRACT E_TMP starting.
2015-07-16 02:54:31 INFO OGG-00992 Oracle GoldenGate Capture for Oracle, e_tmp.prm: EXTRACT E_TMP starting.
2015-07-16 02:54:31 INFO OGG-03035 Oracle GoldenGate Capture for Oracle, e_tmp.prm: Operating system character set identified as UTF-8. Locale: en_US, LC_ALL:.
2015-07-16 02:54:32 INFO OGG-03500 Oracle GoldenGate Capture for Oracle, e_tmp.prm: WARNING: NLS_LANG environment variable does not match database character set, or not set. Using database character set value of WE8MSWIN1252.
2015-07-16 02:54:32 INFO OGG-01635 Oracle GoldenGate Capture for Oracle, e_tmp.prm: BOUNDED RECOVERY: reset to initial or altered checkpoint.
2015-07-16 02:54:32 INFO OGG-01815 Oracle GoldenGate Capture for Oracle, e_tmp.prm: Virtual Memory Facilities for: BR
anon alloc: mmap(MAP_ANON) anon free: munmap
file alloc: mmap(MAP_SHARED) file free: munmap
target directories:
/u02/ogg/BR/E_TMP.
2015-07-16 02:54:32 INFO OGG-01815 Oracle GoldenGate Capture for Oracle, e_tmp.prm: Virtual Memory Facilities for: COM
anon alloc: mmap(MAP_ANON) anon free: munmap
file alloc: mmap(MAP_SHARED) file free: munmap
target directories:
/u02/ogg/dirtmp.
2015-07-16 02:54:33 WARNING OGG-01423 Oracle GoldenGate Capture for Oracle, e_tmp.prm: No valid default archive log destination directory found for thread 1.
2015-07-16 02:54:34 INFO OGG-01513 Oracle GoldenGate Capture for Oracle, e_tmp.prm: Positioning to Sequence 629, RBA 28313104, SCN 0.10435987.
2015-07-16 02:54:34 INFO OGG-01516 Oracle GoldenGate Capture for Oracle, e_tmp.prm: Positioned to Sequence 629, RBA 28313104, SCN 0.10435987, Jul 16, 2015 2:51:24 AM.
2015-07-16 02:54:34 ERROR OGG-01044 Oracle GoldenGate Capture for Oracle, e_tmp.prm: The trail './dirdat/tp' is not assigned to extract 'E_TMP'. Assign the trail to the extract with the command "ADD EXTTRAIL/RMTTRAIL ./dirdat/tp, EXTRACT E_TMP".
2015-07-16 02:54:34 ERROR OGG-01668 Oracle GoldenGate Capture for Oracle, e_tmp.prm: PROCESS ABENDING.
只有抽取进程存在此问题,投递和接收进程如果尝试增加trail文件,都会报错:
GGSCI (ogg) 2> add replicat r_tmp,exttrail ./dirdat/ta
ERROR: REPLICAT R_TMP already exists.
GGSCI (rhlinux) 3> add extract p_tmp,exttrailsource ./dirdat/ta
ERROR: EXTRACT P_TMP already exists.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26451536/viewspace-1813537/,如需转载,请注明出处,否则将追究法律责任。