Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

rman hot backup script

Posted on 2009-07-01
6
Medium Priority
?
1,659 Views
Last Modified: 2013-12-19
Hi members,
Here is my RMAN hotback up script getting ready to be tun daily on our windows 2003 server running oracle 10.2.0.3 . Actually, the same will be used by backup exec 12.5 agent. The idea is to back up the database and also backup the FRA to tape.  Can you please take a look? I will appreciate any suggestions or mistakes or changes to script and if the order needs any changes. Please let me know if you have a better script for this. Thanks in advance.
run {
host 'copy D:\oracle\product\10.2.0\db_1\database\spfiletest.ora E:\oracle\flash_recovery_area\TEST';
host 'copy D:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\listener.ora E:\oracle\flash_recovery_area\TEST';
host 'copy D:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\tnsnames.ora E:\oracle\flash_recovery_area\TEST';
configure backup optimization on;
crosscheck backup of database;
crosscheck backup of controlfile;
crosscheck archivelog all;
delete noprompt obsolete;
delete force noprompt expired backup of database;
delete force noprompt expired backup of controlfile;
delete force noprompt expired archivelog all;
backup as compressed backupset database plus archivelog;
crosscheck backup of database;
backup flash recovery area;
}
exit

Open in new window

0
Comment
Question by:dbguy0
  • 3
  • 2
6 Comments
 
LVL 40

Accepted Solution

by:
mrjoltcola earned 1800 total points
ID: 24758587
It looks good, except it does appear to be a lot of crosschecking for a backup script.

You have two "crosscheck backup of database" lines, only one should be needed, unless you are somehow deleting something from outside of RMAN.

Also make sure you have: "configure controlfile autobackup on;" in your RMAN config.

Other than that, it looks good.

Specifically:  backup as compressed backupset database plus archivelog;


Will correctly backup your DB plus flush your archivelog so you'll have a full backupset to recover from. This is often an oversight.

0
 
LVL 3

Assisted Solution

by:garysadler
garysadler earned 200 total points
ID: 24758798
I agree.

Do you have a retention policy configured?  That will dictate how the DELETE OBSOLETE statement behaves.  If you're not sure, just do

SHOW RETENTION POLICY;

to see what it's set to.  Also the BACKUP FLASH RECOVERY AREA seems redundant.  What are you aiming for with that step?
0
 

Author Comment

by:dbguy0
ID: 24759539
Hi there. Thanks for asking this question.
I have corrected BACKUP FLASH RECOVERY AREA  to BACKUP RECOVERY AREA  ;
The idea is to backup flash recovery area to tape soo after the backup finishes. Would that back up to the default tape media attached? Because in my show all;  command listing, no specific tape media has been specified. It is also not specified in the script . The back up exec agent will invoke this script, will it back it up the tape drive attached to the machine where the back up exec software runs? Thank you!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 40

Assisted Solution

by:mrjoltcola
mrjoltcola earned 1800 total points
ID: 24759608
It will backup to whatever default device you have set, otherwise you must allocate a channel for SBT device type.

RMAN> show all;

To see your default device type. The SBT device must be configured properly to work with your tape driver. See the RMAN setup guide for specific instructions, usually the tape vendor provides specific config string for RMAN.

0
 

Author Comment

by:dbguy0
ID: 24784753
Thanks members.
 It worked for some time well. It started giving this error and I tried a few ways but it didn't work..

I tried both
allocate channel for delete device type disk;
allocate channel for maintenance device type disk;  before running the script with no luck.


Here is my new script


run {
host 'copy D:\oracle\product\10.2.0\db_1\database\spfileDIATEST.ora E:\oracle\flash_recovery_area\DIATEST';
host 'copy D:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\listener.ora E:\oracle\flash_recovery_area\DIATEST';
host 'copy D:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\tnsnames.ora E:\oracle\flash_recovery_area\DIATEST';
configure backup optimization on;
configure controlfile autobackup on;
crosscheck backup of database;
crosscheck backup of controlfile;
crosscheck archivelog all;
delete noprompt obsolete;
delete force noprompt expired backup of database;
delete force noprompt expired backup of controlfile;
delete force noprompt expired archivelog all;
backup as compressed backupset database plus archivelog;
allocate channel ch01 device type sbt;
backup recovery area;
release channel ch01;
}

show all;

RMAN> show all;

RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'D:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\SNCFDIATEST.ORA'; # default


0
 

Author Comment

by:dbguy0
ID: 24784895
Sorry.

This is the error I am receiving.

RMAN-06091 no channel allocated for maintenance (of an appropriate type)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to take different types of Oracle backups using RMAN.
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question