rman backup scripts on Windows

I am currently using the following scripts to perform the rman backups on a 10g oracle database. These scripts were setup by the previous DBA. Just checking to see, if these are correct. Both these scripts are scheduled using windows "at" scheduler. Level 0 script runs once  every sunday and level 1 script runs every day.  If you have any better version of script, to back up the database on a windows, please send it to me. I am also looking for a 7 day retention policy. So, If i need to recover the database to any point 7 days before, I should be able to perform.

Thank You


This script is scheduled to run every weekend on sundays:

run {
allocate channel oem_backup_disk1 type disk format 'C:\oracle\db1\backup\%U';
backup incremental level 0 cumulative as BACKUPSET tag '%TAG' database include current controlfile;
backup as BACKUPSET tag '%TAG' archivelog all not backed up delete all input;
release channel oem_backup_disk1;
}
allocate channel for maintenance type disk;
delete noprompt obsolete device type disk;
release channel;
exit


The following script is scheduled to run every day:
run {
allocate channel oem_backup_disk1 type disk format 'C:\oracle\db1\backup\%U';
backup incremental level 1 cumulative as BACKUPSET tag '%TAG' database include current controlfile;
backup as BACKUPSET tag '%TAG' archivelog all not backed up delete all input;
release channel oem_backup_disk1;
}
allocate channel for maintenance type disk;
delete noprompt obsolete device type disk;
release channel;
exit

praveen_kattaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
POracleConnect With a Mentor Commented:
Praveen,

No need to have luxury of Tape. Disks are now cheaper !! So go for a disk backup.

Is it good to go ahead and perform a full backup every night?>>
No, In fact I didn't suggest you full backup every night. Instead perform full backup only once and  then use  "Rolling Forward Image Copy Backups" features of 10g.

Here is example of how to use rolling forward image copy.

On sunday, 2/May/2010:

RMAN> RUN {
2> ALLOCATE CHANNEL C1 TYPE DISK FORMAT '\Disk1\%U';
3> RECOVER COPY OF DATABASE WITH TAG 'ROLLING_IMAGE_COPY';
4> BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG='ROLLING_IMAGE_COPY' DATABASE;
5> }

Now, copy the image copy taken by above script to disk-2 using RMAN(Write script for this). this image copy will be useful in case you want to restore back.

Schedule this script to run every night.
 
When you run this first time on 2/May/2010 you have image copy of datafiles and incremental backup.

On subsequent run this script will create incremental backup ONLY and also apply incremental backup on image copy taken on Sunday night. In this way you have always image copy which is 1 day old. In case of failure you have to restore from this image copy and recovery require only 1 day old backup to recover.

On next Sunday, replace the copy stored on disk-2 with image copy reside on disk-1.

Thats it, You need to keep only last one backup to restore back on time.

One more thing, in you current script you are storing backup on C drive.
<<allocate channel oem_backup_disk1 type disk format 'C:\oracle\db1\backup\%U';>>
If this is real case then change location of backup to some other disk.

Thanks
0
 
POracleCommented:
Hi,
You can go for this.
1) enable block change tracking (This will reduce time taken by your incremental Backupt)
2) make one full backup (and never do that again)
3) use rman true incrementals to read only blocks that were modified and have rman "catch your backup up".

0
 
praveen_kattaAuthor Commented:
Thanks POracle.
Do you have scripts to cover these additional features. Also I am looking for a 7 day retention policy. What do you mean by " make one full backup (and never do that again)" Is there any problem with using incremental level 0 and incremental level 1 like I have in my version of scripts.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
POracleCommented:
Is there any problem with using incremental level 0 and incremental level 1 like I have in my version of scripts.>>
No it has no problem at all, If your database size is small. but if you have large database and 24x7 running then you cant afford to spend more time in taking backup.

To configure 7 day retention policy use this command
RMAN>CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
0
 
praveen_kattaAuthor Commented:
Thanks I got the script for retention policy.
Yes. I do have a 24 X 7 requirement and would like to change the backup scripts to complete as quickly as possible. Should I be using backup database or backup database plus archive logs command instead?

Also, as of now, because of level 0 and level 1 incremental backups, I am not able to restore going back 7 days. Because, when I perform level 0 on sundays, All previous level 1s become obsolete and they are deleted. So on monday, all I can go back to is to sunday and not 7 days.

I would like to change this, so I can ensure the users that we can rollback to 7 days at any point of time.

If you can get me a new version of backups scripts satisfying these requirements and the additional features, that you mentioned, that will be great.

Thank You
0
 
slightwv (䄆 Netminder)Connect With a Mentor Commented:
What POracle is referring to is a new feature in 10g I believe.  It's a rolling incremental.

Bsaically, after your level1 is complete Oracle takes it and applies it against your last level0.  Then or recovery you are only ever one level1 behind.

Check out:  http://download.oracle.com/docs/cd/B19306_01/backup.102/b14192/bkup004.htm
4.4.3 Incrementally Updated Backups: Rolling Forward Image Copy Backups

Now, if you have some internal requirement that would require you to restore back to 7 days ago (Not sure what this would be), you might not be able to do this w/o going to tapes (Looks like you are going disk to disk, disk to tape).



0
 
POracleCommented:
I think this document is useful to understand Retention policy.
 
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96566/rcmconc1.htm#477319

read example given for recovery windows of 7 days, it is good example to understand retention policy.
0
 
POracleCommented:

Yes, slightwv is right, in that case we need to store last 7 backup on tape .
Thanks slightwv.
0
 
praveen_kattaAuthor Commented:
I don't have a luxury of tape backups. So, with this as the requirement, could you please let me know, how to implement the backups. Is it good to go ahead and perform a full backup every night? Also, if you have any scripts that performs this job, that will be helpful.
0
All Courses

From novice to tech pro — start learning today.