Home | Tip of the Week | Tip of the Week Archive | Partners | Clients | History | Friends

Tip of the Week (Archived)
Oracle Disk Devouring Files II...Archive Log Files (UNIX)

Last night, a client test database stopped running. It was in archive log mode and ran out of space in the archive log file system. Luckily, this was a test database, so there was no production impact. And, luck born of being prepared, since we are using Oracle Enterprise Manager (OEM) to monitor this database, when the error appeared in the alert log, an email was sent notifying us of the problem, allowing a quick resolution.

The quick resolution was the following one line UNIX command that deleted all archive logs more than 30 days old, freeing up enough space in the file system for the new archive log to be written and the database to resume operation:

find <path> -mtime +30 -exec rm {} \;

The find command locates files beginning at the supplied path that meet specified conditions. The components of the above command are:

  • path The directory path that will be processed by the find command as it tries to locate files that meet the specified conditions.
  • -mtime +30 Find files that were last modified more that 30 days ago.
  • -exec rm {} \; Run the rm (remove) command for each file returned by the find command. The {} argument is the argument into the rm command. Each file returned by the find command is substituted for the {} argument, and then rm is executed on that file. The command sequence is then ended by the \;.

In scripting, I would always recommend using the full path in the find command. I know of at least one major database crash caused by the find command referring to the current directory and navigation to the correct directory  failing, resulting in the wrong set of files being deleted by mistake.

In further responding to this issue. I have already set up OEM to monitor available space in the archive log file system, with notifying emails to be sent at 20% and 10% free space available. I have also recommended that the above find command be incorporated into the existing backup scripts to prevent this situation from happening again.

Note: This tip was tested on Solaris 9 using the Korn shell.

Was this tip useful? Did you find any errors? Do you have any suggestions? Do you care? Click here for the tip feedback page. Thank you.

2000 Turnberry Circle, Glenmoore, PA 19343
Voice: (610) 942-1979
Fax: (610) 942-1990
Email


© 2005 Alydan Consulting, Inc.