Database Reference
In-Depth Information
After you run this script, here is a sample of the copy commands written to the coldback.sql script:
shutdown immediate;
!cp /u01/dbfile/O12C/system01.dbf /u01/cbackup/O12C
!cp /u01/dbfile/O12C/sysaux01.dbf /u01/cbackup/O12C
!cp /u01/dbfile/O12C/undotbs01.dbf /u01/cbackup/O12C
!cp /u01/dbfile/O12C/users01.dbf /u01/cbackup/O12C
!cp /u01/dbfile/O12C/tools01.dbf /u01/cbackup/O12C
!cp /u01/dbfile/O12C/temp01.dbf /u01/cbackup/O12C
!cp /u01/oraredo/O12C/redo02a.rdo /u01/cbackup/O12C
!cp /u02/oraredo/O12C/redo02b.rdo /u01/cbackup/O12C
!cp /u01/oraredo/O12C/redo01a.rdo /u01/cbackup/O12C
!cp /u02/oraredo/O12C/redo01b.rdo /u01/cbackup/O12C
!cp /u01/oraredo/O12C/redo03a.rdo /u01/cbackup/O12C
!cp /u02/oraredo/O12C/redo03b.rdo /u01/cbackup/O12C
!cp /u01/dbfile/O12C/control01.ctl /u01/cbackup/O12C
!cp /u01/dbfile/O12C/control02.ctl /u01/cbackup/O12C
startup;
While you make a cold backup, you should also generate a script that provides the commands to copy data files,
temp files, log files, and control files back to their original locations. You can use this script to restore from the cold
backup. The next script in this section dynamically creates a coldrest.sql script that copies files from the backup
location to the original data file locations. You need to modify this script in the same manner that you modified the
cold backup script (i.e., change the ORACLE_SID , ORACLE_HOME , and cbdir variables to match your environment):
#!/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 cbdir=/u01/cbackup/O12C
define dbname=$ORACLE_SID
spo coldrest.sql
select 'shutdown abort;' from dual;
select '!cp ' || '&&cbdir/' || substr(name, instr(name,'/',-1,1)+1) ||
' ' || name from v\$datafile;
select '!cp ' || '&&cbdir/' || substr(name, instr(name,'/',-1,1)+1) ||
' ' || name from v\$tempfile;
select '!cp ' || '&&cbdir/' || substr(member, instr(member,'/',-1,1)+1) ||
' ' || member from v\$logfile;
select '!cp ' || '&&cbdir/' || substr(name, instr(name,'/',-1,1)+1) ||
' ' || name from v\$controlfile;
select 'startup;' from dual;
spo off;
EOF
exit 0
Search WWH ::




Custom Search