Pythian Blog: Technical Track

How To Easily Purge Logs for GI and DB

With a total of 33 directories for GI (Grid Infrastructure) and DB (database) homes, what’s the easiest method to remove files older than 90 days for all directories?

Luckily, Oracle Support does offer purgeLogs; a one-button automation script, which can purge files such as audit_file_dest using the -extra switch.

It’s designed for Exadata but can work for non-Exadata as well.

Keep in mind, you need to use it carefully, since if you don’t handle error checking with that -extra switch, you could do some damage.

DEMO: Cloud Exadata

--- Purge logs older than 90 days for all GI and DB homes.
# ./purgeLogs -days 90

--- Here are all the directories where logs were purged if applicable.
$ grep destination HOSTNAME_purge.log
2021-01-12 07:46:41: I adrci GI purging diagnostic destination diag/asmcmd/user_grid/HOSTNAME
2021-01-12 07:46:41: I adrci GI purging diagnostic destination diag/asmcmd/user_root/HOSTNAME
2021-01-12 07:46:41: I adrci GI purging diagnostic destination diag/apx/+apx/+APX1
2021-01-12 07:46:44: I adrci GI purging diagnostic destination diag/kfod/HOSTNAME/kfod
2021-01-12 07:46:45: I adrci GI purging diagnostic destination diag/asmtool/user_oracle/host_111111111_110
2021-01-12 07:46:46: I adrci GI purging diagnostic destination diag/asmtool/user_root/host_111111111_110
2021-01-12 07:46:47: I adrci GI purging diagnostic destination diag/crs/HOSTNAME/crs
2021-01-12 07:46:50: I adrci GI purging diagnostic destination diag/asm/+asm/+ASM1
2021-01-12 07:47:10: I adrci GI purging diagnostic destination diag/tnslsnr/HOSTNAME/listener
2021-01-12 07:47:11: I adrci GI purging diagnostic destination diag/tnslsnr/HOSTNAME/asmnet1lsnr_asm
2021-01-12 07:47:11: I adrci GI purging diagnostic destination diag/tnslsnr/HOSTNAME/listener_scan2
2021-01-12 07:47:11: I adrci GI purging diagnostic destination diag/tnslsnr/HOSTNAME/listener_scan3
2021-01-12 07:47:12: I adrci GI purging diagnostic destination diag/tnslsnr/HOSTNAME/listener_scan1
2021-01-12 07:47:12: I adrci GI purging diagnostic destination diag/tnslsnr/HOSTNAME/listener2
2021-01-12 07:47:12: I adrci GI purging diagnostic destination diag/clients/user_grid/host_111111111_110
2021-01-12 07:47:13: I adrci GI purging diagnostic destination diag/clients/user_oracle/host_111111111_82
2021-01-12 07:47:26: I adrci RDBMS purging diagnostic destination diag/rdbms/BBBBBBBB_region/BBBBBBBB
2021-01-12 07:47:28: I adrci RDBMS purging diagnostic destination diag/rdbms/BBBBBBBB_region/BBBBBBBB1
2021-01-12 07:47:46: I adrci RDBMS purging diagnostic destination diag/rdbms/AAAA/AAAA1
2021-01-12 07:48:29: I adrci RDBMS purging diagnostic destination diag/rdbms/CCCCC_region/CCCCC
2021-01-12 07:48:32: I adrci RDBMS purging diagnostic destination diag/rdbms/CCCCC_region/CCCCC1
2021-01-12 07:48:48: I adrci RDBMS purging diagnostic destination diag/rdbms/DDDDD_region/DDDDD
2021-01-12 07:48:50: I adrci RDBMS purging diagnostic destination diag/rdbms/DDDDD_region/DDDDD1
2021-01-12 07:49:08: I adrci RDBMS purging diagnostic destination diag/rdbms/EEEEE/EEEEE1
2021-01-12 07:49:42: I adrci RDBMS purging diagnostic destination diag/rdbms/FFFFF_region/FFFFF1
2021-01-12 07:49:47: I adrci RDBMS purging diagnostic destination diag/rdbms/FFFFF_region/FFFFF
2021-01-12 07:50:03: I adrci RDBMS purging diagnostic destination diag/rdbms/GGGGG/GGGGG1
2021-01-12 07:51:01: I adrci RDBMS purging diagnostic destination diag/rdbms/HHHHH/HHHHH1
2021-01-12 07:51:44: I adrci RDBMS purging diagnostic destination diag/rdbms/IIIII/IIIII1
2021-01-12 07:52:27: I adrci RDBMS purging diagnostic destination diag/rdbms/JJJJJ/JJJJJ1
2021-01-12 07:54:04: I adrci RDBMS purging diagnostic destination diag/rdbms/KKKKK/KKKKK1
2021-01-12 07:55:08: I adrci RDBMS purging diagnostic destination diag/rdbms/LLLLL/LLLLL1
2021-01-12 07:56:02: I adrci RDBMS purging diagnostic destination diag/rdbms/MMMMM/MMMMM1

Hopefully, the above will make your life much easier.

Please review Doc ID 2081655.1 for usage and applicable environments.

Finally, I’ll leave you with a few examples for purgeLogs usage:

--- purgeLogs - Usage
purgeLogs - GI/RDBMS cleanup
purgeLogs - OSWatcher/ExaWatcher archive & OAK/DCS cleanup (on ODA - Oracle Database Appliance)
purgeLogs - Files from "extra" given folders
purgeLogs - GI/RDBMS, TFA, OSWatcher & OAK cleanup
purgeLogs - Cleanup listener logs

No Comments Yet

Let us know what you think

Subscribe by email