OGG-extract程式對應的多餘trail檔案的刪除

to_be_Dba發表於2015-10-09
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 <trail name> 
 
 
<trail name> 
 
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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章