Back to Scripting | Daily Renaming of ORACLE Alert Logs


ORACLE alert logs will grow to the maximum size specified in the init.ora file before the information they contain will be overwritten. With this in mind, it can be very useful to have an alert log specific to each day. The scripts provided will rename the ORACLE alert log and append the date to the file name nightly.


Rename_ALERT.cmd

REM Add an event to the NT event log to indicate start
logevent -s I "Oracle ARCHIVE ALERTS job started"
REM Run the vbscript passing in the ORACLE alert log filename and the new destination filename.  The VBscript will 
REM automatically append the current date (YYYYMMDD) to the end of the filename in front of the file extension.
cscript d:\SharedScripts\RenameAppendDate.vbs d:\Orant\bdump\rtppALRT.log d:\Orant\bdump\archived_alerts\rtppALRT.log
REM Add an event to the NT event log to indicate completion
logevent -s I "Oracle ARCHIVE ALERTS job finished"
exit

RenameAppendDate.vbs

Please see the generic script entitled "Rename/move file with date appended between filename and file extension".


Adding this job to the scheduler

AT 11:59PM /EVERY:M,T,W,Th,F,S,Su "D:\Scheduled\Rename_ALERT.cmd"