RMAN backup and crosscheck script
759572Mar 11 2010 — edited Mar 12 2010Hi,
I just joined a new company this week. As any DBA would do, I was just going thru the RMAN backup scripts used in the new environment.
Here we run weekly RMAN full backup for some of the databases I am responsible to manage. The script and timings are as follow.
Every Sunday 9pm we run a weekly crosscheck job
Connect target username/pwd@DBNAME
Connect catalog username/pwd@DBNAME
Run {
CROSSCHECK BACKUP;
CROSSCHECK COPY;
CROSSCHECK BACKUPSET;
CROSSCHECK ARCHIVELOG ALL;
DELETE NOPROMPT OBSOLETE;
}
Every Sunday 9:30 pm we run the RMAN backup command which is
Connect target username/pwd@DBNAME
Connect catalog username/pwd@DBNAME
run
{
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
sql 'alter system archive log current';
backup as backupset database include current controlfile;
sql 'alter system archive log current';
BACKUP ARCHIVELOG from time 'SYSDATE-8';
DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-15';
}
One database I will manage was set up just a week before I join.
28th Feb 9pm – No backup/copy/backup set to crosscheck. I hope it will crosscheck all the archive logs available in the database. No obsolete backup/copy/backup/archivelogs to delete.
28th Feb 9:30pm – sets the retention policy to 7 days, backs up full database backup and backup all the archivelogs (sysdate-8). No archive logs to delete as database was created (migrated) less than 15 days back.
7th March 9pm – Crosschecks the backupset ( taken on 28th Feb 9:30 pm). No backup/copy to crosscheck.
Question 1 : Is there any obsolete backup here to delete?
Own thought : Recovery window is 7 days. RMAN needs a backup to recover the database anytime -7 days from current time ( 7th March 9 PM – 7 days = 28th Feb 9PM) . No obsolete backup to delete.
7th March 9:30 PM –backs up full database and fails to backup all the archive logs (sysdate-8). No space in the Flash recovery disk group. As the archivelog backup failed and RMAN terminated , it did not delete the archivelogs ‘sysdate-15’
Backup will run again on 14th March. Of course it will fail since there is no enough space in the Recovery disk group.
Future: I am confused
14th March 9PM : Crosschecks the backupset ( taken on March Feb 9:30 pm). No backup/copy to crosscheck.
Question 2 : How to know what is obsolete here? .According to the recovery window of 7 days , 14th March 9PM – 7 days = 7th March 9PM. Last Backup was taken at 7th March 9:30 PM.
To recover to 9PM , Does RMAN keep the backup of 28th March? .. Does that mean every time I will have 3 backup copies ?...
14th March 9:30 PM – backups database .. Archive log backup will fail as there is no space. ( I am thinking to do a compressed backup).
Question 3: How these commands make sense?
BACKUP ARCHIVELOG from time 'SYSDATE-8';
DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-15';
If I take a successful backup of archivelogs sysdate-8 , why I need to keep the archivelogs prior to that? What could be reason the previous DBA has kept DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-15'; Instead of giving DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-8' ?
Thanks in advance for your help.
Edited by: user8907052 on Mar 11, 2010 12:10 PM