Stupid RMAN tricks...

So I have mentioned before about the replication product that we use that is based on Archived Redo Logs (Golden Gate). Well sometimes the replication process abends before the RMAN backup. Since there is no communication between the two processes, RMAN happily removes archived logs that the replication process might need the next time it starts up.

Because of this we usually like to keep a few hours worth of archived logs hanging around.

Does this suck up disk space? Yes. Is it worth it sacrifice some disk space in order to save us some DBA time? Absolutely.

If we leave some extra logs on disk then we can restart the process and don't have to figure out which logs are missing, fire up RMAN, restore the logs, and wait for RMAN to serve them up.

Given that you usually have RMAN configured to only backup Archived Log copies once:

CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;

Then you can get this done in 2 steps.

Step 1: Backup Archived Logs without Deleting Them

BACKUP ARCHIVELOG ALL

Step 2: Delete Unneeded Logs
Then run a 2nd command to back up logs up until (SYSDATE-1) and then delete the input. Since we just ran a BACKUP ARCHIVELOG ALL and BACKUP COPIES = 1, it will basically skip the backup part and just delete them.

BACKUP ARCHIVELOG UNTIL TIME 'SYSDATE -1' DELETE ALL INPUT 

-- Dave

Tags: 

Add new comment