| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Backup/Restore
You don't say if you are using catalog or not. If not, be sure to backup control files at end of backup. For what it's worth here is what I do for disk backups and no catalog. Business critical databases use catalog and go directly to tape using Networker (P.O.S. ... at least on Tru64). I have separate scripts for database and log files in case the archived log destination gets dangerously full (monitored by cron job).
For database:
run {
allocate channel ch1 type disk format
'/u05/oracle/admin/HRP1/backup/%U_DATA';
set command id to 'rman';
backup
tag backup_db_full
(database include current controlfile);
release channel ch1;
}
For log files (we are duplexing on this database):
run {
allocate channel ch1 type disk format
'/u05/oracle/admin/HRP1/backup/%U_ARCH';
set command id to 'rman';
change archivelog all crosscheck;
backup
(archivelog all delete input);
backup
(archivelog like '/oracle/app/oracle/admin/HRP1/arch2/%' delete input);
release channel ch1;
allocate channel ch1 type disk format
'/u05/oracle/admin/HRP1/backup/%U_CONTROL';
backup current controlfile tag='backup';
release channel ch1;
sql "ALTER DATABASE BACKUP CONTROLFILE TO
''/u05/oracle/admin/HRP1/backup/CONTROL_FILE.BAK'' REUSE";
}
If the database and all controlfiles got blown away, then the CONTROL_FILE.BAK is your salvation.
The following "script" is kept handy as a fast reference for restoring. I run the commands by hand; but the script serves to jog my memory as to the commands. I've slept since I put this together, but I think some of the commands are for when you have a catalog.
#!/bin/ksh
## Define variables for your SID
export ORACLE_SID=ABCXYZ
export USER=internal
export PASS=the_password
## With Oracle 9.X you must use sqlplus.
svrmgrl <<-XXX
connect internal
startup nomount
exit
XXX
rman nocatalog <<-XXX
connect target ${USER}/${PASS}@${ORACLE_SID}
run {
### If you have control files, then you don't need format when allocating
channel.
allocate channel ch1 type disk;
### When you want to restore up to, but not including, a specific log
sequence number
### For example, the database wants log 275, but all you have in rman
catalog are 273 and 274
#set until logseq=275 thread=1;
### When you want to restore to a specific time. # set until time "to_date('2001-02-09 02:00:00','YYYY-MM-DD HH24:MI:SS')";
### Various syntax possibilities for restoring control files #restore controlfile to '/u01/oradata/ORACLE_SID/control_01.ctl'; # restore controlfile to '/u02/oradata/ORACLE_SID/control_02.ctl'; # restore controlfile to '/u06/oradata/ORACLE_SID/control_03.ctl'; # replicate controlfile from '/u01/oradata/ORACLE_SID/control_01.ctl'; ### The following just restores them all. ### DO NOT restore controlfile when doing a point in time recovery. ### Most likely, you will not restore controlfile unless you have lost allcontrol files.
sql 'ALTER DATABASE MOUNT';
restore database;
#### You might or might not need restore archivelog.
#### When doing backups to disk, you probably don't need it.
# restore archivelog all;
recover database;
#### If control file was restored, then you will probably need resetlogs.
# sql 'ALTER DATABASE OPEN RESETLOGS';
sql 'ALTER DATABASE OPEN';
release channel ch1;
}
XXX
#### If you had to restore the controlfiles (or hand-copy in backup
controfiles),
#### or if you lost online redo log(s), or if you are missing archived
log(s),
#### then, you will likely need to recover the database by hand using one
or
#### more of the following commands.
## With Oracle 9.X you must use sqlplus.
##svrmgrl <<-XXX
echo "" echo " ------ DON'T FORGET ------ DON'T FORGET ------" echo "Don't forget to RESET DATABASE in RMAN catalog." echo " ------ DON'T FORGET ------ DON'T FORGET ------"echo
> -----Original Message-----
> From: OraCop [mailto:oracop_at_yahoo.com]
> Sent: Tuesday, November 12, 2002 2:29 PM
> To: Multiple recipients of list ORACLE-L
> Subject: Backup/Restore
>
>
> Hello,
> I need to comeup with backup strategy for my
> production oracle systems running 9iR2 on Solaris9.
>
> I do have veritas Netbackup installed. I would
> really appreciate if someone can answer these
> important questions for me.
>
> 1- Do I need to install Veritas Oracle agent for
> backup?
> 2- What are COMPLETE steps involved to
> backup/restore if I want to use Veritas for
> this purpose?
> 3- I am using following script to create backup on
>
> the local disk. This script does not delete the
> archive log files after backing 'em up. Why
> not? I am using this script at RMAN prompt.
> (connect to recvcat)
>
> run {
> allocate channel c1 type disk;
> backup
> full
> #incremental level 2 # 0 1 2 or up
> skip inaccessible
> tag hot_db_bk_level0
> filesperset 5
> # recommended format
> format '/data/oraidx/backup/bk_%s_%p_%t'
> (database);
> sql 'alter system archive log current';
> # backup all archive logs
> backup
> filesperset 20
> format '/data/oraidx/backup/al_%s_%p_%t'
> (archivelog all
> delete input);
> release channel c1;
> }
>
> 4- What is the procedure to restore using files
> created as output of above script?
> 5- Any ideas/links to help improve backup
> strategy, using veritas and RMAN.
> Thanks.
>
> OraCop
>
>
> __________________________________________________
> Do you Yahoo!?
> U2 on LAUNCH - Exclusive greatest hits videos
> http://launch.yahoo.com/u2
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: OraCop
> INET: oracop_at_yahoo.com
>
> Fat City Network Services -- 858-538-5051 http://www.fatcity.com
> San Diego, California -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
>
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Stephen Lee INET: slee_at_dollar.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Tue Nov 12 2002 - 15:50:53 CST
![]() |
![]() |