Database Reference
In-Depth Information
Step 10. Back Up Any Archive Redo Logs Generated During the Backup
Back up the archive redo logs that were generated during the hot backup. You can do this with an OS copy command:
$ cp <archive redo logs generated during backup> <backup directory>
This procedure guarantees that you have the logs, even if a failure should occur soon after the hot backup
finishes. Be sure you don't back up an archive redo log that is currently being written to by the archiver process—
doing so results in an incomplete copy of that file. Sometimes, DBAs script this process by checking the maximum
SEQUENCE# with the maximum RESETLOGS_ID in the V$ARCHIVED_LOG view. Oracle updates that view when it's finished
copying the archive redo log to disk. Therefore, any archive redo log file that appears in the V$ARCHIVED_LOG view
should be safe to copy.
Scripting Hot Backups
The script in this section covers the minimal tasks associated with a hot backup. For a production environment a hot
backup script can be quite complex. The script given here provides you with a baseline of what you should include in
a hot backup script. You need to modify these variables in the script for it to work in your environment:
ORACLE_SID
ORACLE_HOME
hbdir
The ORACLE_SID OS variable defines your database name. The ORACLE_HOME OS varriable defines where you
installed the Oracle software. The SQL*Plus hbdir variable points to the directory for the hot backups.
#!/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
spo hotback.sql
select 'spo &&hbdir/hotlog.txt' from dual;
select 'select max(sequence#) from v\$log;' from dual;
select 'alter database begin backup;' from dual;
select '!cp ' || name || ' ' || '&&hbdir' from v\$datafile;
select 'alter database end backup;' from dual;
select 'alter database backup controlfile to ' || '''' || '&&hbdir'
|| '/controlbk.ctl' || '''' || ' reuse;' from dual;
select 'alter system archive log current;' from dual;
select 'select max(sequence#) from v\$log;' from dual;
select 'select member from v\$logfile;' from dual;
select 'spo off;' from dual;
spo off;
@@hotback.sql
EOF
 
Search WWH ::




Custom Search