Wednesday 25 November 2009

Rotate Oracle Application Server logs

How to rotate Oracle Application Server logs

We are using the Oracle10g Application Server version 10.1.2.2.0. As the logfiles generated on OAS are occupying the space some times we need to stop the OAS to clear the log files. Alternatively we can set the parameters on the OAS config to rotate the log files.

We can achieve the log rotation using Oracle Diagnostic Logging (ODL). Follow the below steps to rotate the logs.

1. Go to the $ORACLE_HOME/j2ee/oc4j_bi_forms/config
2. Take a backup of the application.xml file.
3. Find the below lines on the application.xml file.



and change it to



Note: specify the max-file-size and max-directory-size values appropriately.

4. Take a backup of the j2ee-logging.xml file in the same directory
5. Add the below code into the log loader



Wednesday 11 November 2009

Check the top 10 space using files and the directories

To identify the top 10 space using files and directories use the du commnad as below.

du -a /opt/oracle | sort -n -r | head -n 10

If you want to list n or more files then change the value 10 to the required number of files. eg: 30

Unix - Delete files older than 7 days

We are using IBM AIX servers. We wanted to delete the log files older than 7 days to reclaim the space.

First i need to find the files older than 7 days and then remove them.

$find . -mtime +7 -exec rm -f {} \;

Here i have used find command to find the files in current directory("." means current directory) alternatively you can specify a directory path like "/opt/oracle/admin/log"

And used the parameter -mtime to specify the number of days where i have given +7.

If you specify 7 then seven or more days old files are selected
If you specify +7 then 8 or more days old files are selected.

Then execute the rm command with the -exec option.