1. My current server running with multiple database owned by oracle and oradev user
[root@oracledb ~]# ps -ef|grep smon
oracle 2524 1 0 12:53 ? 00:00:00 ora_smon_GGSOURCE
oracle 3122 1 0 12:54 ? 00:00:00 ora_smon_ORA12C
oradev 4029 1 0 12:56 ? 00:00:00 ora_smon_ORACDB
root 8711 30209 0 16:36 pts/0 00:00:00 grep --color=auto smon
oracle 13118 1 0 Feb22 ? 00:00:56 ora_smon_ORCL
[root@oracledb ~]#
2. schedule a cleanup script to run on every Sunday
I am scheduling it with root use so that I need to schedule it multiple times for each user like in this example oracle user and oradev user.
[root@oracledb ~]# crontab -l
0 0 * * SUN /root/delete_aud.sh
[root@oracledb ~]#
3. On-demand manual execution of script
[root@oracledb ~]# sh /root/delete_aud.sh
[root@oracledb ~]#
4. Cleanup script
[root@oracledb ~]# more /root/delete_aud.sh
#!/bin/bash
find /u01/app/oracle/admin/GGSOURCE/adump -type f -mtime +7 -name '*.aud' -exec rm -f {} \;
find /u01/app/oracle/admin/ORA12C/adump -type f -mtime +7 -name '*.aud' -exec rm -f {} \;
find /u01/app/oracle/admin/ORCL/adump -type f -mtime +7 -name '*.aud' -exec rm -f {} \;
find /u01/app/oradev/admin/ORACDB/adump -type f -mtime +7 -name '*.aud' -exec rm -f {} \;
#diag or trace or xml
find /u01/app/oracle/diag/rdbms/ggsource/GGSOURCE/trace -type f -mtime +7 -name '*.trc' -exec rm -f {} \;
find /u01/app/oracle/diag/rdbms/ggsource/GGSOURCE/trace -type f -mtime +7 -name '*.trm' -exec rm -f {} \;
find /u01/app/oracle/diag/rdbms/ggsource/GGSOURCE/alert -type f -mtime +7 -name '*.xml' -exec rm -f {} \;
find /u01/app/oracle/diag/rdbms/ggsource/GGSOURCE/incident -type d -mtime +7 -name 'incdir_*' -exec rm -rf {} \;
#diag or trace or xml
find /u01/app/oracle/diag/rdbms/ora12c/ORA12C/trace -type f -mtime +7 -name '*.trc' -exec rm -f {} \;
find /u01/app/oracle/diag/rdbms/ora12c/ORA12C/trace -type f -mtime +7 -name '*.trm' -exec rm -f {} \;
find /u01/app/oracle/diag/rdbms/ora12c/ORA12C/alert -type f -mtime +7 -name '*.xml' -exec rm -f {} \;
find /u01/app/oracle/diag/rdbms/ora12c/ORA12C/incident -type d -mtime +7 -name 'incdir_*' -exec rm -rf {} \;
#diag or trace or xml
find /u01/app/oracle/diag/rdbms/orcl/ORCL/trace -type f -mtime +7 -name '*.trc' -exec rm -f {} \;
find /u01/app/oracle/diag/rdbms/orcl/ORCL/trace -type f -mtime +7 -name '*.trm' -exec rm -f {} \;
find /u01/app/oracle/diag/rdbms/orcl/ORCL/alert -type f -mtime +7 -name '*.xml' -exec rm -f {} \;
find /u01/app/oracle/diag/rdbms/orcl/ORCL/incident -type d -mtime +7 -name 'incdir_*' -exec rm -rf {} \;
#diag or trace or xml
find /u01/app/oradev/diag/rdbms/oracdb/ORACDB/trace -type f -mtime +7 -name '*.trc' -exec rm -f {} \;
find /u01/app/oradev/diag/rdbms/oracdb/ORACDB/trace -type f -mtime +7 -name '*.trm' -exec rm -f {} \;
find /u01/app/oradev/diag/rdbms/oracdb/ORACDB/alert -type f -mtime +7 -name '*.xml' -exec rm -f {} \;
find /u01/app/oradev/diag/rdbms/oracdb/ORACDB/incident -type d -mtime +7 -name 'incdir_*' -exec rm -rf {} \;
[root@oracledb ~]#
Regards,
Mallikarjun / Vismo Technologies
WhatsApp: +91 9880616848 / +91 9036478079
Cell: +91 9880616848 / +91 9036478079
Email: mallikarjun.ramadurg@gmail.com / vismotechnologies@gmail.com / info@vismotechnologies.com
No comments:
Post a Comment