Oracle 11g OGG mgr定期清理tail 文件

OGG mgr定期清理tail 文件

2018-06-11 11:58 440 0 原创 GoldenGate

1. OGG mgr定期清理tail 文件

1.1. 源端操作

1.1.1. 停止mgr进程

GGSCI (cndba) 14> 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 (cndba) 15> info all Program Status Group Lag at Chkpt Time Since Chkpt MANAGER STOPPED
EXTRACT RUNNING EXT1 00:00:00 00:00:02
EXTRACT RUNNING PUMP1 00:00:00 00:00:05

1.1.2. 编辑文件添加参数

GGSCI (cndba) 20> edit params mgr
GGSCI (cndba) 25> view params mgr port 7809
PURGEOLDEXTRACTS ./dirdat/et*, USECHECKPOINTS, MINKEEPHOURS 1
参数说明:定期清理dirdat路径下的本地队列(local trail)。保留期限一个小时,过期后自动删除。从而控制队列文件的目录不会增长过大。

1.1.3. 启动mgr进程

GGSCI (cndba) 21> start mgr

Manager started.

GGSCI (cndba) 24> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
EXTRACT RUNNING EXT1 00:00:00 00:00:01
EXTRACT RUNNING PUMP1 00:00:00 00:00:04

1.1.4. 查看源端tail 文件

--配置参数前
[root@www.cndba.cn dirdat]# ll
total 21524
-rw-rw-rw- 1 oracle oinstall 1405 Jun 7 16:11 et000000
-rw-rw-rw- 1 oracle oinstall 1016 Jun 7 16:19 et000001
-rw-rw-rw- 1 oracle oinstall 21989956 Jun 7 22:13 et000002
-rw-rw-rw- 1 oracle oinstall 1075 Jun 8 11:18 et000003
-rw-rw-rw- 1 oracle oinstall 2513 Jun 8 18:28 et000004
-rw-rw-rw- 1 oracle oinstall 1416 Jun 8 19:17 et000005
-rw-rw-rw- 1 oracle oinstall 1442 Jun 11 09:16 et000006
-rw-rw-rw- 1 oracle oinstall 1779 Jun 11 09:16 et000007
-rw-rw-rw- 1 oracle oinstall 1175 Jun 9 02:20 ex000000
-rw-rw-rw- 1 oracle oinstall 1322 Jun 9 02:49 ex000001
-rw-rw-rw- 1 oracle oinstall 2513 Jun 9 03:01 ex000002
-rw-rw-rw- 1 oracle oinstall 1350 Jun 9 03:05 ex000003
--配置参数后
[root@www.cndba.cn dirdat]# ll
total 36
-rw-rw-rw- 1 oracle oinstall 1416 Jun 8 19:17 et000005
-rw-rw-rw- 1 oracle oinstall 1442 Jun 11 09:16 et000006
-rw-rw-rw- 1 oracle oinstall 1779 Jun 11 10:07 et000007
-rw-rw-rw- 1 oracle oinstall 1075 Jun 11 10:07 et000008
-rw-rw-rw- 1 oracle oinstall 1175 Jun 9 02:20 ex000000
-rw-rw-rw- 1 oracle oinstall 1322 Jun 9 02:49 ex000001
-rw-rw-rw- 1 oracle oinstall 2513 Jun 9 03:01 ex000002
-rw-rw-rw- 1 oracle oinstall 1350 Jun 9 03:05 ex000003

1.2. 目标端操作

1.2.1. 停止mgr进程

GGSCI (cndba) 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.

1.2.2. 编辑文件添加参数

GGSCI (cndba) 4> edit params mgr

GGSCI (cndba) 5> view params mgr

port 7809
PURGEOLDEXTRACTS ./dirdat/et*, USECHECKPOINTS, MINKEEPHOURS 1

1.2.3. 启动mgr进程

GGSCI (cndba) 6> start mgr

Manager started.

GGSCI (cndba) 7> info all

Program     Status      Group       Lag at Chkpt  Time Since Chkpt

MANAGER     RUNNING
REPLICAT RUNNING REP1 00:00:00 00:00:04

1.2.4. 查看目标端tail文件

----配置参数前
[oracle@www.cndba.cn ogg]$ cd dirdat
[oracle@www.cndba.cn dirdat]$ ll
total 21500
drwxr-xr-x 2 root root 4096 Jun 8 11:21 backup
-rw-rw-rw- 1 oracle oinstall 1444 Jun 7 16:11 et000000
-rw-rw-rw- 1 oracle oinstall 0 Jun 7 16:19 et000001
-rw-rw-rw- 1 oracle oinstall 21989995 Jun 7 22:14 et000002
-rw-rw-rw- 1 oracle oinstall 1209 Jun 8 11:19 et000003
-rw-rw-rw- 1 oracle oinstall 2682 Jun 11 09:16 et000004
-rw-rw-rw- 1 oracle oinstall 1793 Jun 11 10:07 et000005
-rw-rw-rw- 1 oracle oinstall 1314 Jun 11 10:07 et000006
--配置参数后
[oracle@www.cndba.cn dirdat]$ ll
total 12
drwxr-xr-x 2 root root 4096 Jun 8 11:21 backup
-rw-rw-rw- 1 oracle oinstall 1793 Jun 11 10:07 et000005
-rw-rw-rw- 1 oracle oinstall 1314 Jun 11 10:07 et000006

1.3. 补充说明

因为测试这里保留1个小时的tail文件,
保留期限7天的tail文件,过期后自动删除
PURGEOLDEXTRACTS ./dirdat/et*, USECHECKPOINTS,MINKEEPDAYS 7
只保留一个处理过的队列文件(不建议使用)
PURGEOLDEXTRACTS /ggs/dirdat/AA*, USECHECKPOINTS, MINKEEPFILES 1
PURGEOLDEXTRACTS /ggs/dirdat/AA*, USECHECKPOINTS, MINKEEPHOURS 4, &MINKEEPFILES 4
如果MINKEEPHOURS ,MINKEEPDAYS ,MINKEEPFILES 同时使用,如果发生冲突时,那么系统接受MINKEEPHOURS和MINKEEPDAYS 参数将对MINKEEPFILES 参数做忽略。
上一篇:YOU种你来丨i春秋校园行第一站北京电子科技学院


下一篇:linux-shell-变量参数