Professional Documents
Culture Documents
rman
connect target
run { allocate channel d1 type disk maxpiecesize 2047M; backup format '/u01/oracle/rman_backup/AIA/df_t%t_s%s_p%p' database; sql 'alter system archive log current'; backup format '/u01/oracle/rman_backup/AIA/al_t%t_s%s_p%p' archivelog all; backup format '/u01/oracle/rman_backup/AIA/control%U' current controlfile; delete noprompt archivelog all backed up 2 times to device type disk; release channel d1; }
mkdir -p /u01/oracle/rman_backup/AIA
4> Create Password File for Auxiliary Database cd $ORACLE_HOME/dbs orapwd file=orapwCLON password=oracle entries=5
export ORACLE_SID=CLON
startup nomount
-- listener.ora
CLON = (ADDRESS_LIST = (ADDRESS= (PROTOCOL= IPC)(KEY= EXTPROCmanprod)) (ADDRESS= (PROTOCOL= TCP)(Host= rac1.com )(Port= 1521)) )
SID_LIST_BEST = (SID_LIST = (SID_DESC = (ORACLE_HOME= /u01/rmantest/ORACLE10g) (SID_NAME = CLON) ) (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u01/rmantest/ORACLE10g) (PROGRAM = extproc) )
-- tnsnames.ora CLON = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = CLON) ) ) AIA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = linux1)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = AIA) ) )
9> Ensure You Have the Necessary Backups and Archived Redo Log Files
rem Filename: rmanstat.sql rem Purpose: List completed RMAN backups for the last 24-hours rem (use info from Dictionary - Control File Views) rem Date: 12-Feb-2000 rem Author: Frank Naude, Oracle FAQ rem -----------------------------------------------------------------------
col type format a4 col handle format a35 trunc col file# format 9999 col duration format a9
select decode(BACKUP_TYPE, 'L', 'ARCH', 'D', 'DB', 'I', 'INC', 'Unknown type='||BACKUP_TYPE) TYPE, to_char(a.start_time, 'DDMON HH24:MI') start_time,
to_char(a.elapsed_seconds/60, '99.9')||' Min' DURATION, substr(handle, -35) handle, nvl(d.file#, l.sequence#) file#, nvl(d.blocks, l.blocks) blocks from SYS.V_$BACKUP_SET a, SYS.V_$BACKUP_PIECE b, SYS.V_$BACKUP_DATAFILE d, SYS.V_$BACKUP_REDOLOG l where a.start_time between sysdate-1 and sysdate and a.SET_STAMP = b.SET_STAMP and a.SET_STAMP = d.SET_STAMP(+) and a.SET_STAMP = l.SET_STAMP(+) order by start_time, file# /
set -a LOG_FILE=CLON.log set +a ( rman < < EOF CONNECT TARGET sys/oracle@AIA
RUN { set until time "to_date('OCT 31 2009 02:30:00','Mon DD YYYY HH24:MI:SS')"; SET NEWNAME FOR DATAFILE 1 TO '/u01/rmantest/CLON/data/system01.dbf'; SET NEWNAME FOR DATAFILE 2 TO '/u01/rmantest/CLON/data/undotbs01.dbf'; SET NEWNAME FOR DATAFILE 3 TO '/u01/rmantest/CLON/data/sysaux01.dbf'; SET NEWNAME FOR DATAFILE 4 TO '/u01/rmantest/CLON/data/users01.dbf'; SET NEWNAME FOR DATAFILE 5 TO '/u01/rmantest/CLON/data/example01.dbf'; set newname for tempfile 1 to '/u01/rmantest/CLON/data/temp.dbf'; DUPLICATE TARGET DATABASE TO CLON LOGFILE GROUP 1 ('/u01/rmantest/CLON/data/redo1a.log') SIZE 50M reuse, GROUP 2 ('/u01/rmantest/CLON/data/redo1b.log') SIZE 50M reuse, GROUP 3 ('/u01/rmantest/CLON/data/redo2a.log') SIZE 50M reuse, GROUP 4 ('/u01/rmantest/CLON/data/redo2b.log') SIZE 50M reuse; } EOF ) > $LOG_FILE 2>&1