Join this Blog for direct reference of any post into your inbox. To join just click on "Join this Site" under "Follower" then Login with your Email.*** DECLARATION: I Maintain this Blog for Helping Myself While at Work and Welcome any body Needing Help!!!.*** CAUTION: Using any of the script from this Blog may contain at Own Risk. These scripts May or May not have been Tested.***

Monday, 25 March 2013

Preventing RMAN to overwrite logfile

Previously we need to change the RMAN backup logfile name before being overwrite with next day backup to keep the old logfile. But if you decide to keep your old log files or to generate unique logfile even you are taking multiple backup in a day. You can do this simply using the date and time function with the RMAN backup or dump log file in windows environment.
Date:  %date:~4,2%-%date:~7,2%-%date:~12,2%
Time:  %time:~0,2%-%time:~3,2%-%time:~6,2%  
You can combine these two functions to generate unique log file in rman backup
The multiple backup outputs in the same day through the above logic:
-or- you can use the concept as:
Daily_Backup_${ORACLE_SID}.'date +%Y%m%d_%H%M%S'
Same logic you can use with the dumpfile to generate unique dumpfile.
C:\>exp system/****  owner=orafin file=D:\dump\orafin_%date:~4,2%-%date:~7,2%-%date:~12,2%-%time:~0,2%-%time:~3,2%-%time:~6,2%.dmp log=D:\dump\orafin_%date:~4,2%-%date:~7,2%-%date:~12,2%-%time:~3,2%-%time:~6,2%.log
On Linux /Unix Environment:
expdate=`date ‘+%d%m%Y’`
dat=`date ‘+%m%d%y %H:%M:%S’`

Now define in script as:
./expdp system/**** dumpfile=orafin_$expdate.dmp logfile=orafin_log_$expdate.log schemas=orafin   
The output generated with the above logic:
Dump= ‘orafin_03-24-13-11-05-33.dmp’
Log = ‘orafin_03-24-13-05-33.log’
Where date is 03-24-13 is the date 24-MAR-2013 and 11-05-33 is the time in 11hr:5min:33sec.


  1. Good pointers you have here to explain your subject. I appreciate your effort.Thank you for your insight.
    website design