Tablespace Point in Time Recovery

RMAN> run {
        SET AUXILIARY INSTANCE PARAMETER FILE TO ‘/u01/app/ora112/product/H11203/dbs/init_tspitr.ora’;
        recover tablespace hh_test until time “to_date(’25-FEB 16:48:00′, ‘DD-MON HH24:MI:SS’)” auxiliary destination ‘/u01/app/ora112/oradata/AUXDB’;   
        }

executing command: SET auxiliary parameter file

Starting recover at 25-FEB-13 16:49:08
using channel ORA_DISK_1

Creating automatic instance, with SID=’xwie’
using contents of file /u01/app/ora112/product/H11203/dbs/init_tspitr.ora

initialization parameters used for automatic instance:
db_name=DB3DUP
db_unique_name=xwie_tspitr_DB3DUP
compatible=11.2.0.3
db_block_size=8192
db_files=200
sga_target=280M
processes=50
db_create_file_dest=/u01/app/ora112/oradata/AUXDB
log_archive_dest_1=’location=/u01/app/ora112/oradata/AUXDB’
ifile=/u01/app/ora112/product/H11203/dbs/init_tspitr.ora

starting up automatic instance DB3DUP

Oracle instance started

Total System Global Area    2138521600 bytes

Fixed Size                     2161024 bytes
Variable Size                503318144 bytes
Database Buffers            1610612736 bytes
Redo Buffers                  22429696 bytes
Automatic instance created
Running TRANSPORT_SET_CHECK on recovery set tablespaces
TRANSPORT_SET_CHECK completed successfully

contents of Memory Script:
{
# set requested point in time
set until  time “to_date(’25-FEB 16:48:00′, ‘DD-MON HH24:MI:SS’)”;
# restore the controlfile
restore clone controlfile;
# mount the controlfile
sql clone ‘alter database mount clone database’;
# archive current online log
sql ‘alter system archive log current’;
# avoid unnecessary autobackups for structural changes during TSPITR
sql ‘begin dbms_backup_restore.AutoBackupFlag(FALSE); end;’;
# resync catalog
resync catalog;
}
executing Memory Script

executing command: SET until clause

Starting restore at 25-FEB-13 16:49:58
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=89 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece +FRA/db3dup/backupset/2013_02_25/ncnnf0_tag20130225t164655_0.257.808332441
channel ORA_AUX_DISK_1: piece handle=+FRA/db3dup/backupset/2013_02_25/ncnnf0_tag20130225t164655_0.257.808332441 tag=TAG20130225T164655
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:10
output file name=/u01/app/ora112/oradata/AUXDB/DB3DUP/controlfile/o1_mf_8lq21lfh_.ctl
Finished restore at 25-FEB-13 16:50:12

sql statement: alter database mount clone database

sql statement: alter system archive log current

sql statement: begin dbms_backup_restore.AutoBackupFlag(FALSE); end;

starting full resync of recovery catalog
full resync complete

contents of Memory Script:
{
# set requested point in time
set until  time “to_date(’25-FEB 16:48:00′, ‘DD-MON HH24:MI:SS’)”;
plsql <<<– tspitr_2
declare
sqlstatement       varchar2(512);
offline_not_needed exception;
pragma exception_init(offline_not_needed, -01539);
begin
sqlstatement := ‘alter tablespace ‘||  ‘HH_TEST’ ||’ offline immediate’;
krmicd.writeMsg(6162, sqlstatement);
krmicd.execSql(sqlstatement);
exception
when offline_not_needed then
null;
end; >>>;
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile  1 to new;
set newname for clone datafile  3 to new;
set newname for clone datafile  2 to new;
set newname for clone tempfile  1 to new;
set newname for datafile  4 to
“+BIG_DATA/db3dup/datafile/hh_test.281.808332301”;
# switch all tempfiles
switch clone tempfile all;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile  1, 3, 2, 4;
switch clone datafile all;
}
executing Memory Script

executing command: SET until clause

sql statement: alter tablespace HH_TEST offline immediate

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/ora112/oradata/AUXDB/DB3DUP/datafile/o1_mf_tempts1_%u_.tmp in control file

Starting restore at 25-FEB-13 16:50:28
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/app/ora112/oradata/AUXDB/DB3DUP/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/ora112/oradata/AUXDB/DB3DUP/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /u01/app/ora112/oradata/AUXDB/DB3DUP/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to +BIG_DATA/db3dup/datafile/hh_test.281.808332301
channel ORA_AUX_DISK_1: reading from backup piece +FRA/db3dup/backupset/2013_02_25/nnndf0_tag20130225t164655_0.256.808332423
channel ORA_AUX_DISK_1: piece handle=+FRA/db3dup/backupset/2013_02_25/nnndf0_tag20130225t164655_0.256.808332423 tag=TAG20130225T164655
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 25-FEB-13 16:51:16

datafile 1 switched to datafile copy
input datafile copy RECID=6 STAMP=808332677 file name=/u01/app/ora112/oradata/AUXDB/DB3DUP/datafile/o1_mf_system_8lq227tn_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=808332677 file name=/u01/app/ora112/oradata/AUXDB/DB3DUP/datafile/o1_mf_undotbs1_8lq22852_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=8 STAMP=808332677 file name=/u01/app/ora112/oradata/AUXDB/DB3DUP/datafile/o1_mf_sysaux_8lq22805_.dbf

contents of Memory Script:
{
# set requested point in time
set until  time “to_date(’25-FEB 16:48:00′, ‘DD-MON HH24:MI:SS’)”;
# online the datafiles restored or switched
sql clone “alter database datafile  1 online”;
sql clone “alter database datafile  3 online”;
sql clone “alter database datafile  2 online”;
sql clone “alter database datafile  4 online”;
# recover and open resetlogs
recover clone database tablespace  “HH_TEST”, “SYSTEM”, “UNDOTBS1”, “SYSAUX” delete archivelog;
alter clone database open resetlogs;
}
executing Memory Script

executing command: SET until clause

sql statement: alter database datafile  1 online

sql statement: alter database datafile  3 online

sql statement: alter database datafile  2 online

sql statement: alter database datafile  4 online

Starting recover at 25-FEB-13 16:51:18
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 16 is already on disk as file +FRA/db3dup/archivelog/2013_02_25/thread_1_seq_16.258.808332471
archived log for thread 1 with sequence 17 is already on disk as file +FRA/db3dup/archivelog/2013_02_25/thread_1_seq_17.260.808332533
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=15
channel ORA_AUX_DISK_1: reading from backup piece +FRA/db3dup/backupset/2013_02_25/annnf0_tag20130225t164730_0.259.808332455
channel ORA_AUX_DISK_1: piece handle=+FRA/db3dup/backupset/2013_02_25/annnf0_tag20130225t164730_0.259.808332455 tag=TAG20130225T164730
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u01/app/ora112/oradata/AUXDB/1_15_808304082.dbf thread=1 sequence=15
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/ora112/oradata/AUXDB/1_15_808304082.dbf RECID=15 STAMP=808332702
archived log file name=+FRA/db3dup/archivelog/2013_02_25/thread_1_seq_16.258.808332471 thread=1 sequence=16
archived log file name=+FRA/db3dup/archivelog/2013_02_25/thread_1_seq_17.260.808332533 thread=1 sequence=17
media recovery complete, elapsed time: 00:00:02
Finished recover at 25-FEB-13 16:51:46

database opened

contents of Memory Script:
{
# make read only the tablespace that will be exported
sql clone ‘alter tablespace  HH_TEST read only’;
# create directory for datapump import
sql “create or replace directory TSPITR_DIROBJ_DPDIR as ”
/u01/app/ora112/oradata/AUXDB””;
# create directory for datapump export
sql clone “create or replace directory TSPITR_DIROBJ_DPDIR as ”
/u01/app/ora112/oradata/AUXDB””;
}
executing Memory Script

sql statement: alter tablespace  HH_TEST read only

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ”/u01/app/ora112/oradata/AUXDB”

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ”/u01/app/ora112/oradata/AUXDB”

Performing export of metadata…
EXPDP> Starting “SYS”.”TSPITR_EXP_xwie”:
EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
EXPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
EXPDP> Master table “SYS”.”TSPITR_EXP_xwie” successfully loaded/unloaded
EXPDP> ******************************************************************************
EXPDP> Dump file set for SYS.TSPITR_EXP_xwie is:
EXPDP>   /u01/app/ora112/oradata/AUXDB/tspitr_xwie_53543.dmp
EXPDP> ******************************************************************************
EXPDP> Datafiles required for transportable tablespace HH_TEST:
EXPDP>   +BIG_DATA/db3dup/datafile/hh_test.281.808332301
EXPDP> Job “SYS”.”TSPITR_EXP_xwie” successfully completed at 16:55:24
Export completed

contents of Memory Script:
{
# shutdown clone before import
shutdown clone immediate
# drop target tablespaces before importing them back
sql ‘drop tablespace  HH_TEST including contents keep datafiles’;
}
executing Memory Script

database closed
database dismounted
Oracle instance shut down

sql statement: drop tablespace  HH_TEST including contents keep datafiles

Performing import of metadata…
IMPDP> Master table “SYS”.”TSPITR_IMP_xwie” successfully loaded/unloaded
IMPDP> Starting “SYS”.”TSPITR_IMP_xwie”:
IMPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
IMPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
IMPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
IMPDP> Job “SYS”.”TSPITR_IMP_xwie” successfully completed at 16:56:10
Import completed

contents of Memory Script:
{
# make read write and offline the imported tablespaces
sql ‘alter tablespace  HH_TEST read write’;
sql ‘alter tablespace  HH_TEST offline’;
# enable autobackups after TSPITR is finished
sql ‘begin dbms_backup_restore.AutoBackupFlag(TRUE); end;’;
# resync catalog
resync catalog;
}
executing Memory Script

sql statement: alter tablespace  HH_TEST read write

sql statement: alter tablespace  HH_TEST offline

sql statement: begin dbms_backup_restore.AutoBackupFlag(TRUE); end;

starting full resync of recovery catalog
full resync complete

Removing automatic instance
Automatic instance removed
auxiliary instance file /u01/app/ora112/oradata/AUXDB/DB3DUP/datafile/o1_mf_tempts1_8lq25156_.tmp deleted
auxiliary instance file /u01/app/ora112/oradata/AUXDB/DB3DUP/onlinelog/o1_mf_3_8lq24vwx_.log deleted
auxiliary instance file /u01/app/ora112/oradata/AUXDB/DB3DUP/onlinelog/o1_mf_2_8lq24qln_.log deleted
auxiliary instance file /u01/app/ora112/oradata/AUXDB/DB3DUP/onlinelog/o1_mf_1_8lq24mcv_.log deleted
auxiliary instance file /u01/app/ora112/oradata/AUXDB/DB3DUP/datafile/o1_mf_sysaux_8lq22805_.dbf deleted
auxiliary instance file /u01/app/ora112/oradata/AUXDB/DB3DUP/datafile/o1_mf_undotbs1_8lq22852_.dbf deleted
auxiliary instance file /u01/app/ora112/oradata/AUXDB/DB3DUP/datafile/o1_mf_system_8lq227tn_.dbf deleted
auxiliary instance file /u01/app/ora112/oradata/AUXDB/DB3DUP/controlfile/o1_mf_8lq21lfh_.ctl deleted
Finished recover at 25-FEB-13 16:56:19

RMAN> sql ‘alter tablespace hh_test online’;

sql statement: alter tablespace hh_test online
starting full resync of recovery catalog
full resync complete

Leave a Reply

Your email address will not be published. Required fields are marked *