Databases Reference
In-Depth Information
If the previous script fails on a statement before ALTER DATABASE END BACKUP is executed, you must
take your database (tablespaces) out of backup mode by manually running ALTER DATABASE END BACKUP from
sQL*plus (as the SYS user).
Caution
While you generate the hot backup script, it's prudent to generate a script that you can use to copy the data files
from a backup directory. You have to modify the hbdir variable in this script to match the location of the hot backups
for your environment. Here is a script that generates the copy commands:
#!/bin/bash
ORACLE_SID=o12c
ORACLE_HOME=/u01/app/oracle/product/12.1.0.1/db_1
PATH=$PATH:$ORACLE_HOME/bin
#
sqlplus -s <<EOF
/ as sysdba
set head off pages0 lines 132 verify off feed off trimsp on
define hbdir=/u01/hbackup/o12c/
define dbname=$ORACLE_SID
spo hotrest.sql
select '!cp ' || '&&hbdir' || substr(name,instr(name,'/',-1,1)+1)
|| ' ' || name from v\$datafile;
spo off;
EOF
#
exit 0
For my environment here is the code generated that can be executed from SQL*Plus to copy the data files back
from the backup directory, if a failure should occur:
!cp /u01/hbackup/o12c/system01.dbf /u01/dbfile/o12c/system01.dbf
!cp /u01/hbackup/o12c/sysaux01.dbf /u01/dbfile/o12c/sysaux01.dbf
!cp /u01/hbackup/o12c/undotbs01.dbf /u01/dbfile/o12c/undotbs01.dbf
!cp /u01/hbackup/o12c/users01.dbf /u01/dbfile/o12c/users01.dbf
!cp /u01/hbackup/o12c/tools01.dbf /u01/dbfile/o12c/tools01.dbf
In this output, you can remove the exclamation point ( ! ) from each line if you prefer to run the commands from
the OS prompt. The main idea is that these commands are available in the event of a failure, so you know which files
have been backed up to which location and how to copy them back.
don't use user-managed hot backup technology for online backups; use rMan. rMan doesn't need to place
tablespaces in backup mode and automates nearly everything related to backup and recovery.
Tip
 
 
Search WWH ::




Custom Search