/u01/app/oracle/diag/rdbms/test1/TEST1/trace/alert_TEST1.log
{
daily
rotate 15
compress
copytruncate
delaycompress
create 0640 oracle dba
notifempty
}
It's easy to create the log rotation configuration file for one database. But what if you have 20+ databases running on your server, are you still planning to manually locate their alert log files? Today I would like to introduce a shell script that will automatically search the running ASM instance, databases and listeners and create the configuration files for you. Here are the steps on how to run shell scripts. 1. Run the shell script
2. Three configuration files will be created: oracle_rdbms_log, oracle_asm_log and oracle_listener_log. Let's say we have 4 running databases: TEST1, TEST2, TEST3 and TEST4, one ASM instance +ASM1, three listeners: listener_scan1, listener_scan2 and LISTENER. The configuration files will be like:[oracle@testserver ~]$ ./gen_logrotate_config.sh
[oracle@testserver ~]$ cat oracle_rdbms_log
/u01/app/oracle/diag/rdbms/test1/TEST1/trace/alert_TEST1.log /u01/app/oracle/diag/rdbms/test2/TEST2/trace/alert_TEST2.log /u01/app/oracle/diag/rdbms/test3/TEST3/trace/alert_TEST3.log /u01/app/oracle/diag/rdbms/test3/TEST3/trace/alert_TEST4.log
{
daily
rotate 15
compress
copytruncate
delaycompress
create 0640 oracle dba
notifempty
}
[oracle@testserver ~]$ cat oracle_asm_log
/u01/app/oracle/diag/asm/+asm/+ASM1/trace/alert_+ASM1.log
{
daily
rotate 15
compress
copytruncate
delaycompress
create 0640 oracle dba
notifempty
}
[oracle@testserver ~]$ cat oracle_listener_log
/u01/app/oracle/diag/tnslsnr/TESTSERVER/listener_scan2/trace/listener_scan2.log /u01/app/oracle/diag/tnslsnr/TESTSERVER/listener_scan1/trace/listener_scan1.log /u01/app/oracle/diag/tnslsnr/TESTSERVER/listener/trace/listener.log
{
daily
rotate 15
compress
copytruncate
delaycompress
create 0640 oracle dba
notifempty
}
3. Put three configuration files to /etc/logrotate.d/ then you will see the log files will be rotated on next day. You can find the code here and enjoy!
Oracle Database Consulting Services
Ready to optimize your Oracle Database for the future?
On this page
Share this
Share this
More resources
Learn more about Pythian by reading the following blogs and articles.
How To Easily Purge Logs for GI and DB
How To Easily Purge Logs for GI and DB
Jan 14, 2021 12:00:00 AM
3
min read
How to Find Clusterware Configuration Details Using srvctl
How to Find Clusterware Configuration Details Using srvctl
Oct 23, 2019 12:00:00 AM
1
min read
Using ADRCI to Review Recurrent Issues
Using ADRCI to Review Recurrent Issues
Jan 12, 2021 12:00:00 AM
3
min read
Ready to unlock value from your data?
With Pythian, you can accomplish your data transformation goals and more.