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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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) 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
POracleCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.