Pages

Wednesday, February 18, 2009

RMAN Full Backup Script

Though, creating RMAN Full backup script is pretty simple, I would like to share my script and how to create it over here.

Firstly, Invoke RMAN. Then, connect to your Recovery Catalog and Target Database.

You can create a RMAN Full Backup Script by running the following:

create script prod_full_bkp{
CROSSCHECK BACKUP;
CROSSCHECK
ARCHIVELOG ALL;
Sql 'alter system archive log current’;
BACKUP DATABASE;
BACKUP ARCHIVELOG ALL DELETE INPUT;
REPORT UNRECOVERABLE;
REPORT
OBSOLETE ORPHAN;
}

The script will be stored in the Recovery Catalog. Here, obsolete will reflect obsolete backups as per the retention policy configured for the target database. Delete Input will delete the archivelogs after they have been backed up.

You can either manually run or schedule a job to run using the following script:

spool log to '\prod_full_bkp.log';
run {execute script prod_full_bkp;}
list backup summary;
spool log off;

2 comments:

  1. You can also think of taking periodic archivelog backup in between the hot backups to reduce the data loss incase of a fatal crash, say in every 1 or 2 hours gap.
    I also assume that your backup location is not on the server where database is residing.

    Regards
    Anwar

    ReplyDelete
  2. Well, that seems to be a good thought. I will write & schedule the script to take the archivelog backups at an interval of 2-3 hours.

    The RMAN Backup location is not on the same server. We have a SAN location (50GB), provided by the IT Admins. But, backup on that location takes more than 8 hours to complete. Whereas, backup on a test server take less than 50 minutes to complete. As you know, SAN are supposed to be faster that normal drives. I have sent the logs to the IT Admins for further investigation.

    I will elaborate more on the backup duration issue that I am currently facing here, once I resolve the same.

    Thanks for your feedback.

    Regards,
    Zaffer

    ReplyDelete