在11g之前的版本中需要我们手动去清理trace文件,11g可以使用工具ADRCI清理,默认情况下由MMON后台进程进行自动清理过期的trace文件,这里涉及两个参数:
LONGP_POLICY:默认保留365天的事件与警告。
SHORTP_POLICY:默认保留30的trace文件或core dump file
[oracle@jzh5 ~]$ cd $ORACLE_BASE/diag/rdbms/jzh/jzh/trace
[oracle@jzh5 trace]$ ll
total 1956
-rw-r----- 1 oracle oinstall 134249 Sep 13 08:55 alert_jzh.log
-rw-r----- 1 oracle oinstall 928 Aug 5 02:08 jzh_arc1_3039.trc
-rw-r----- 1 oracle oinstall 58 Aug 5 02:08 jzh_arc1_3039.trm
-rw-r----- 1 oracle oinstall 942 Jul 22 14:58 jzh_arc1_3053.trc
-rw-r----- 1 oracle oinstall 58 Jul 22 14:58 jzh_arc1_3053.trm
-rw-r----- 1 oracle oinstall 928 Sep 13 08:39 jzh_arc1_3300.trc
-rw-r----- 1 oracle oinstall 58 Sep 13 08:39 jzh_arc1_3300.trm
-rw-r----- 1 oracle oinstall 929 Aug 2 07:31 jzh_arc1_3630.trc
-rw-r----- 1 oracle oinstall 58 Aug 2 07:31 jzh_arc1_3630.trm
-rw-r----- 1 oracle oinstall 942 Aug 8 16:18 jzh_arc2_3040.trc
-rw-r----- 1 oracle oinstall 58 Aug 8 16:18 jzh_arc2_3040.trm
-rw-r----- 1 oracle oinstall 942 Aug 1 14:41 jzh_arc2_3136.trc
-rw-r----- 1 oracle oinstall 58 Aug 1 14:41 jzh_arc2_3136.trm
-rw-r----- 1 oracle oinstall 986 Aug 8 15:33 jzh_cjq0_3077.trc
-rw-r----- 1 oracle oinstall 69 Aug 8 15:33 jzh_cjq0_3077.trm
-rw-r----- 1 oracle oinstall 986 Aug 1 10:31 jzh_cjq0_3195.trc
-rw-r----- 1 oracle oinstall 69 Aug 1 10:31 jzh_cjq0_3195.trm
-rw-r----- 1 oracle oinstall 986 Aug 2 07:09 jzh_cjq0_3201.trc
-rw-r----- 1 oracle oinstall 69 Aug 2 07:09 jzh_cjq0_3201.trm
-rw-r----- 1 oracle oinstall 986 Aug 2 07:31 jzh_cjq0_3674.trc
-rw-r----- 1 oracle oinstall 68 Aug 2 07:31 jzh_cjq0_3674.trm
-rw-r----- 1 oracle oinstall 986 Aug 2 07:48 jzh_cjq0_4052.trc
-rw-r----- 1 oracle oinstall 59 Aug 2 07:48 jzh_cjq0_4052.trm
-rw-r----- 1 oracle oinstall 986 Aug 2 08:47 jzh_cjq0_5134.trc
-rw-r----- 1 oracle oinstall 68 Aug 2 08:47 jzh_cjq0_5134.trm
-rw-r----- 1 oracle oinstall 1150 Aug 8 15:50 jzh_ckpt_2948.trc
-rw-r----- 1 oracle oinstall 58 Aug 8 15:50 jzh_ckpt_2948.trm
-rw-r----- 1 oracle oinstall 1026 Aug 5 02:27 jzh_ckpt_2950.trc
-rw-r----- 1 oracle oinstall 58 Aug 5 02:27 jzh_ckpt_2950.trm
-rw-r----- 1 oracle oinstall 972 Jul 28 15:52 jzh_ckpt_2951.trc
-rw-r----- 1 oracle oinstall 58 Jul 28 15:52 jzh_ckpt_2951.trm
-rw-r----- 1 oracle oinstall 1081 Aug 11 08:11 jzh_ckpt_2952.trc
-rw-r----- 1 oracle oinstall 58 Aug 11 08:11 jzh_ckpt_2952.trm
-rw-r----- 1 oracle oinstall 1464 Aug 5 09:27 jzh_ckpt_2954.trc
-rw-r----- 1 oracle oinstall 79 Aug 5 09:27 jzh_ckpt_2954.trm
-rw-r----- 1 oracle oinstall 1288 Jul 22 15:01 jzh_ckpt_2963.trc
[oracle@jzh5 trace]$ adrci
ADRCI: Release 11.2.0.3.0 - Production on Sun Sep 13 12:20:13 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
ADR base = "/u01/app/oracle"
adrci> show control
ADR Home = /u01/app/oracle/diag/rdbms/jzh/jzh:
*************************************************************************
ADRID SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME
LAST_AUTOPRG_TIME LAST_MANUPRG_TIME ADRDIR_VERSION
ADRSCHM_VERSION ADRSCHMV_SUMMARY ADRALERT_VERSION CREATE_TIME
-------------------- -------------------- -------------------- ----------------------------------------
---------------------------------------- ---------------------------------------- --------------------
-------------------- -------------------- -------------------- ----------------------------------------
2275908615 720 (30天) 8760(365天) 2015-03-16 01:28:49.774202 +08:00
1
2 80 1 2015-03-16 01:28:49.774202 +08:00
1 rows fetched
LONGP_POLICY:默认保留365天的事件与警告。
SHORTP_POLICY:默认保留30的trace文件或core dump file
[oracle@jzh5 ~]$ cd $ORACLE_BASE/diag/rdbms/jzh/jzh/trace
[oracle@jzh5 trace]$ ll
total 1956
-rw-r----- 1 oracle oinstall 134249 Sep 13 08:55 alert_jzh.log
-rw-r----- 1 oracle oinstall 928 Aug 5 02:08 jzh_arc1_3039.trc
-rw-r----- 1 oracle oinstall 58 Aug 5 02:08 jzh_arc1_3039.trm
-rw-r----- 1 oracle oinstall 942 Jul 22 14:58 jzh_arc1_3053.trc
-rw-r----- 1 oracle oinstall 58 Jul 22 14:58 jzh_arc1_3053.trm
-rw-r----- 1 oracle oinstall 928 Sep 13 08:39 jzh_arc1_3300.trc
-rw-r----- 1 oracle oinstall 58 Sep 13 08:39 jzh_arc1_3300.trm
-rw-r----- 1 oracle oinstall 929 Aug 2 07:31 jzh_arc1_3630.trc
-rw-r----- 1 oracle oinstall 58 Aug 2 07:31 jzh_arc1_3630.trm
-rw-r----- 1 oracle oinstall 942 Aug 8 16:18 jzh_arc2_3040.trc
-rw-r----- 1 oracle oinstall 58 Aug 8 16:18 jzh_arc2_3040.trm
-rw-r----- 1 oracle oinstall 942 Aug 1 14:41 jzh_arc2_3136.trc
-rw-r----- 1 oracle oinstall 58 Aug 1 14:41 jzh_arc2_3136.trm
-rw-r----- 1 oracle oinstall 986 Aug 8 15:33 jzh_cjq0_3077.trc
-rw-r----- 1 oracle oinstall 69 Aug 8 15:33 jzh_cjq0_3077.trm
-rw-r----- 1 oracle oinstall 986 Aug 1 10:31 jzh_cjq0_3195.trc
-rw-r----- 1 oracle oinstall 69 Aug 1 10:31 jzh_cjq0_3195.trm
-rw-r----- 1 oracle oinstall 986 Aug 2 07:09 jzh_cjq0_3201.trc
-rw-r----- 1 oracle oinstall 69 Aug 2 07:09 jzh_cjq0_3201.trm
-rw-r----- 1 oracle oinstall 986 Aug 2 07:31 jzh_cjq0_3674.trc
-rw-r----- 1 oracle oinstall 68 Aug 2 07:31 jzh_cjq0_3674.trm
-rw-r----- 1 oracle oinstall 986 Aug 2 07:48 jzh_cjq0_4052.trc
-rw-r----- 1 oracle oinstall 59 Aug 2 07:48 jzh_cjq0_4052.trm
-rw-r----- 1 oracle oinstall 986 Aug 2 08:47 jzh_cjq0_5134.trc
-rw-r----- 1 oracle oinstall 68 Aug 2 08:47 jzh_cjq0_5134.trm
-rw-r----- 1 oracle oinstall 1150 Aug 8 15:50 jzh_ckpt_2948.trc
-rw-r----- 1 oracle oinstall 58 Aug 8 15:50 jzh_ckpt_2948.trm
-rw-r----- 1 oracle oinstall 1026 Aug 5 02:27 jzh_ckpt_2950.trc
-rw-r----- 1 oracle oinstall 58 Aug 5 02:27 jzh_ckpt_2950.trm
-rw-r----- 1 oracle oinstall 972 Jul 28 15:52 jzh_ckpt_2951.trc
-rw-r----- 1 oracle oinstall 58 Jul 28 15:52 jzh_ckpt_2951.trm
-rw-r----- 1 oracle oinstall 1081 Aug 11 08:11 jzh_ckpt_2952.trc
-rw-r----- 1 oracle oinstall 58 Aug 11 08:11 jzh_ckpt_2952.trm
-rw-r----- 1 oracle oinstall 1464 Aug 5 09:27 jzh_ckpt_2954.trc
-rw-r----- 1 oracle oinstall 79 Aug 5 09:27 jzh_ckpt_2954.trm
-rw-r----- 1 oracle oinstall 1288 Jul 22 15:01 jzh_ckpt_2963.trc
[oracle@jzh5 trace]$ adrci
ADRCI: Release 11.2.0.3.0 - Production on Sun Sep 13 12:20:13 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
ADR base = "/u01/app/oracle"
adrci> show control
ADR Home = /u01/app/oracle/diag/rdbms/jzh/jzh:
*************************************************************************
ADRID SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME
LAST_AUTOPRG_TIME LAST_MANUPRG_TIME ADRDIR_VERSION
ADRSCHM_VERSION ADRSCHMV_SUMMARY ADRALERT_VERSION CREATE_TIME
-------------------- -------------------- -------------------- ----------------------------------------
---------------------------------------- ---------------------------------------- --------------------
-------------------- -------------------- -------------------- ----------------------------------------
2275908615 720 (30天) 8760(365天) 2015-03-16 01:28:49.774202 +08:00
1
2 80 1 2015-03-16 01:28:49.774202 +08:00
1 rows fetched
更改
SHORTP_POLICY:
adrci> set control (SHORTP_POLICY=360)
adrci> show control
ADR Home = /u01/app/oracle/diag/rdbms/jzh/jzh:
*************************************************************************
ADRID SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME
LAST_AUTOPRG_TIME LAST_MANUPRG_TIME ADRDIR_VERSION
ADRSCHM_VERSION ADRSCHMV_SUMMARY ADRALERT_VERSION CREATE_TIME
-------------------- -------------------- -------------------- ----------------------------------------
--------------------------------------- ---------------------------------------- --------------------
-------------------- -------------------- -------------------- ----------------------------------------
2275908615 360 8760 2015-09-13 12:21:06.394362 +08:00
1
2 80 1 2015-03-16 01:28:49.774202 +08:00
1 rows fetched
清理trace文件:
adrci> purge -age 8760 -type TRACE
adrci> exit
[oracle@jzh5 trace]$ ll
total 316
-rw-r----- 1 oracle oinstall 134249 Sep 13 08:55 alert_jzh.log
-rw-r----- 1 oracle oinstall 928 Sep 13 08:39 jzh_arc1_3300.trc
-rw-r----- 1 oracle oinstall 58 Sep 13 08:39 jzh_arc1_3300.trm
-rw-r----- 1 oracle oinstall 1031 Sep 13 08:40 jzh_ckpt_3189.trc
-rw-r----- 1 oracle oinstall 58 Sep 13 08:40 jzh_ckpt_3189.trm
-rw-r----- 1 oracle oinstall 1059 Sep 13 09:03 jzh_ckpt_3846.trc
-rw-r----- 1 oracle oinstall 66 Sep 13 09:03 jzh_ckpt_3846.trm
-rw-r----- 1 oracle oinstall 945 Sep 13 08:40 jzh_dbrm_3169.trc
-rw-r----- 1 oracle oinstall 67 Sep 13 08:40 jzh_dbrm_3169.trm
-rw-r----- 1 oracle oinstall 1217 Sep 13 08:50 jzh_dbrm_3826.trc
-rw-r----- 1 oracle oinstall 78 Sep 13 08:50 jzh_dbrm_3826.trm
-rw-r----- 1 oracle oinstall 961 Sep 13 08:40 jzh_j006_3403.trc
-rw-r----- 1 oracle oinstall 68 Sep 13 08:40 jzh_j006_3403.trm
-rw-r----- 1 oracle oinstall 948 Sep 13 12:10 jzh_lgwr_3842.trc
-rw-r----- 1 oracle oinstall 70 Sep 13 12:10 jzh_lgwr_3842.trm
-rw-r----- 1 oracle oinstall 845 Sep 13 08:39 jzh_mman_3177.trc
-rw-r----- 1 oracle oinstall 58 Sep 13 08:39 jzh_mman_3177.trm
-rw-r----- 1 oracle oinstall 845 Sep 13 08:40 jzh_mman_3514.trc
-rw-r----- 1 oracle oinstall 58 Sep 13 08:40 jzh_mman_3514.trm
-rw-r----- 1 oracle oinstall 845 Sep 13 08:49 jzh_mman_3834.trc
-rw-r----- 1 oracle oinstall 58 Sep 13 08:49 jzh_mman_3834.trm
-rw-r----- 1 oracle oinstall 911 Sep 13 08:40 jzh_mmon_3201.trc
-rw-r----- 1 oracle oinstall 59 Sep 13 08:40 jzh_mmon_3201.trm
-rw-r----- 1 oracle oinstall 6021 Sep 13 12:21 jzh_mmon_3858.trc
-rw-r----- 1 oracle oinstall 587 Sep 13 12:21 jzh_mmon_3858.trm
-rw-r----- 1 oracle oinstall 855 Sep 13 08:39 jzh_ora_3084.trc
-rw-r----- 1 oracle oinstall 84 Sep 13 08:39 jzh_ora_3084.trm
-rw-r----- 1 oracle oinstall 4583 Sep 13 08:40 jzh_ora_3267.trc
-rw-r----- 1 oracle oinstall 259 Sep 13 08:40 jzh_ora_3267.trm
-rw-r----- 1 oracle oinstall 826 Sep 13 08:40 jzh_ora_3422.trc
-rw-r----- 1 oracle oinstall 83 Sep 13 08:40 jzh_ora_3422.trm
-rw-r----- 1 oracle oinstall 6524 Sep 13 08:45 jzh_ora_3729.trc
-rw-r----- 1 oracle oinstall 303 Sep 13 08:45 jzh_ora_3729.trm
-rw-r----- 1 oracle oinstall 826 Sep 13 08:49 jzh_ora_3742.trc
-rw-r----- 1 oracle oinstall 83 Sep 13 08:49 jzh_ora_3742.trm
-rw-r----- 1 oracle oinstall 1930 Sep 13 08:50 jzh_ora_3925.trc
-rw-r----- 1 oracle oinstall 102 Sep 13 08:50 jzh_ora_3925.trm
-rw-r----- 1 oracle oinstall 1184 Sep 13 08:40 jzh_vktm_3155.trc
-rw-r----- 1 oracle oinstall 87 Sep 13 08:40 jzh_vktm_3155.trm
-rw-r----- 1 oracle oinstall 1186 Sep 13 08:45 jzh_vktm_3492.trc
-rw-r----- 1 oracle oinstall 86 Sep 13 08:45 jzh_vktm_3492.trm
-rw-r----- 1 oracle oinstall 1065 Sep 13 08:49 jzh_vktm_3812.trc
-rw-r----- 1 oracle oinstall 74 Sep 13 08:49 jzh_vktm_3812.trm
默认情况下当天的trace文件是不能被清理的!
adrci> set control (SHORTP_POLICY=360)
adrci> show control
ADR Home = /u01/app/oracle/diag/rdbms/jzh/jzh:
*************************************************************************
ADRID SHORTP_POLICY LONGP_POLICY LAST_MOD_TIME
LAST_AUTOPRG_TIME LAST_MANUPRG_TIME ADRDIR_VERSION
ADRSCHM_VERSION ADRSCHMV_SUMMARY ADRALERT_VERSION CREATE_TIME
-------------------- -------------------- -------------------- ----------------------------------------
--------------------------------------- ---------------------------------------- --------------------
-------------------- -------------------- -------------------- ----------------------------------------
2275908615 360 8760 2015-09-13 12:21:06.394362 +08:00
1
2 80 1 2015-03-16 01:28:49.774202 +08:00
1 rows fetched
清理trace文件:
adrci> purge -age 8760 -type TRACE
adrci> exit
[oracle@jzh5 trace]$ ll
total 316
-rw-r----- 1 oracle oinstall 134249 Sep 13 08:55 alert_jzh.log
-rw-r----- 1 oracle oinstall 928 Sep 13 08:39 jzh_arc1_3300.trc
-rw-r----- 1 oracle oinstall 58 Sep 13 08:39 jzh_arc1_3300.trm
-rw-r----- 1 oracle oinstall 1031 Sep 13 08:40 jzh_ckpt_3189.trc
-rw-r----- 1 oracle oinstall 58 Sep 13 08:40 jzh_ckpt_3189.trm
-rw-r----- 1 oracle oinstall 1059 Sep 13 09:03 jzh_ckpt_3846.trc
-rw-r----- 1 oracle oinstall 66 Sep 13 09:03 jzh_ckpt_3846.trm
-rw-r----- 1 oracle oinstall 945 Sep 13 08:40 jzh_dbrm_3169.trc
-rw-r----- 1 oracle oinstall 67 Sep 13 08:40 jzh_dbrm_3169.trm
-rw-r----- 1 oracle oinstall 1217 Sep 13 08:50 jzh_dbrm_3826.trc
-rw-r----- 1 oracle oinstall 78 Sep 13 08:50 jzh_dbrm_3826.trm
-rw-r----- 1 oracle oinstall 961 Sep 13 08:40 jzh_j006_3403.trc
-rw-r----- 1 oracle oinstall 68 Sep 13 08:40 jzh_j006_3403.trm
-rw-r----- 1 oracle oinstall 948 Sep 13 12:10 jzh_lgwr_3842.trc
-rw-r----- 1 oracle oinstall 70 Sep 13 12:10 jzh_lgwr_3842.trm
-rw-r----- 1 oracle oinstall 845 Sep 13 08:39 jzh_mman_3177.trc
-rw-r----- 1 oracle oinstall 58 Sep 13 08:39 jzh_mman_3177.trm
-rw-r----- 1 oracle oinstall 845 Sep 13 08:40 jzh_mman_3514.trc
-rw-r----- 1 oracle oinstall 58 Sep 13 08:40 jzh_mman_3514.trm
-rw-r----- 1 oracle oinstall 845 Sep 13 08:49 jzh_mman_3834.trc
-rw-r----- 1 oracle oinstall 58 Sep 13 08:49 jzh_mman_3834.trm
-rw-r----- 1 oracle oinstall 911 Sep 13 08:40 jzh_mmon_3201.trc
-rw-r----- 1 oracle oinstall 59 Sep 13 08:40 jzh_mmon_3201.trm
-rw-r----- 1 oracle oinstall 6021 Sep 13 12:21 jzh_mmon_3858.trc
-rw-r----- 1 oracle oinstall 587 Sep 13 12:21 jzh_mmon_3858.trm
-rw-r----- 1 oracle oinstall 855 Sep 13 08:39 jzh_ora_3084.trc
-rw-r----- 1 oracle oinstall 84 Sep 13 08:39 jzh_ora_3084.trm
-rw-r----- 1 oracle oinstall 4583 Sep 13 08:40 jzh_ora_3267.trc
-rw-r----- 1 oracle oinstall 259 Sep 13 08:40 jzh_ora_3267.trm
-rw-r----- 1 oracle oinstall 826 Sep 13 08:40 jzh_ora_3422.trc
-rw-r----- 1 oracle oinstall 83 Sep 13 08:40 jzh_ora_3422.trm
-rw-r----- 1 oracle oinstall 6524 Sep 13 08:45 jzh_ora_3729.trc
-rw-r----- 1 oracle oinstall 303 Sep 13 08:45 jzh_ora_3729.trm
-rw-r----- 1 oracle oinstall 826 Sep 13 08:49 jzh_ora_3742.trc
-rw-r----- 1 oracle oinstall 83 Sep 13 08:49 jzh_ora_3742.trm
-rw-r----- 1 oracle oinstall 1930 Sep 13 08:50 jzh_ora_3925.trc
-rw-r----- 1 oracle oinstall 102 Sep 13 08:50 jzh_ora_3925.trm
-rw-r----- 1 oracle oinstall 1184 Sep 13 08:40 jzh_vktm_3155.trc
-rw-r----- 1 oracle oinstall 87 Sep 13 08:40 jzh_vktm_3155.trm
-rw-r----- 1 oracle oinstall 1186 Sep 13 08:45 jzh_vktm_3492.trc
-rw-r----- 1 oracle oinstall 86 Sep 13 08:45 jzh_vktm_3492.trm
-rw-r----- 1 oracle oinstall 1065 Sep 13 08:49 jzh_vktm_3812.trc
-rw-r----- 1 oracle oinstall 74 Sep 13 08:49 jzh_vktm_3812.trm
默认情况下当天的trace文件是不能被清理的!
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10271187/viewspace-1798621/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10271187/viewspace-1798621/