rman Duplicate temp (sh)


export NLS_DATE_FORMAT='DD-MON-RRRR HH24:MI:SS'
export ORACLE_SID=TEST2
sqlplus /nolog <<EOF
connect / as sysdba
alter system switch logfile;
alter system archive log all;
exit
EOF
rmanA.sh
export ORACLE_SID=TEST3
sqlplus /nolog <<EOF
connect sys/oracledba as sysdba
shutdown abort
startup nomount
exit
EOF
rman <<EOF
connect target rman/rman_oracledba@test2
connect catalog rman/rman_oracledba@test1
connect auxiliary sys/oracledba@test3
run {
resync catalog;
allocate auxiliary channel d1 type disk;
allocate auxiliary channel d2 type disk;
# set until time "to_date('2013-12-05:15:16:53','yyyy-mm-dd:hh24:mi:ss')"
# set until time "to_date('06-DEC-2013 10:50:00','dd-mon-YYYY HH24:MI:SS')"
# set until time '06-DEC-2013 10:51:00'
# set until time 'sysdate-1/96';
# set until scn = 155534
set newname for datafile '/data/oracle/TEST2/systemTEST2.dbf' TO '/data/oracle/TEST3/systemTEST3.dbf';
set newname for datafile '/data/oracle/TEST2/rbsTEST2.dbf' TO '/data/oracle/TEST3/rbsTEST3.dbf';
set newname for datafile '/data/oracle/TEST2/tempTEST2.dbf' TO '/data/oracle/TEST3/tempTEST3.dbf';
set newname for datafile '/data/oracle/TEST2/dataTEST2.dbf' TO '/data/oracle/TEST3/dataTEST3.dbf';
sql 'alter system switch logfile';
duplicate target database to test3
LOGFILE
'/data/oracle/TEST3/redoTEST301.log' size 1M,
'/data/oracle/TEST3/redoTEST302.log' size 1M,
'/data/oracle/TEST3/redoTEST303.log' size 1M;
}
EOF
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: