DESCRIPTION:
In this article, we are going to know how to perform Transportable tablespace using Rman.
[oracle@trichy BIJU1]$ rman target / Recovery Manager: Release 12.2.0.1.0 - Production on Mon Jan 04 11:00:57 2021 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. connected to target database: BIJU1 (DBID=805092274)
RMAN> TRANSPORT TABLESPACE tbs_test TABLESPACE DESTINATION '/u01/app/oracle/oradata/BIJU1/rman_transdest' AUXILIARY DESTINATION '/u01/app/oracle/oradata/BIJU1/rman_auxdest';
using target database control file instead of recovery catalog
RMAN-05026: warning: presuming following set of tablespaces applies to specified point-in-time
List of tablespaces expected to have UNDO segments
Tablespace SYSTEM
Tablespace UNDOTBS1
Creating automatic instance, with SID='kvwx'
initialization parameters used for automatic instance:
db_name=BIJU1
db_unique_name=kvwx_pitr_BIJU1
compatible=12.2.0
db_block_size=8192
db_files=200
diagnostic_dest=/u01/app/oracle
_system_trig_enabled=FALSE
sga_target=1168M
processes=200
db_create_file_dest=/u01/app/oracle/oradata/BIJU1/rman_auxdest
log_archive_dest_1='location=/u01/app/oracle/oradata/BIJU1/rman_auxdest'
#No auxiliary parameter file used
starting up automatic instance BIJU1
Oracle instance started
Total System Global Area 2483027968 bytes
Fixed Size 8611736 bytes
Variable Size 553650568 bytes
Database Buffers 1912602624 bytes
Redo Buffers 8151040 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 scn 5048742;
# 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';
}
executing Memory Script
executing command: SET until clause
Starting restore at 04-JAN-20
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=35 device type=DISKchannel 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 /u01/app/oracle/fast_recovery_area/Biju1/BIJU1/autobackup/2021_09_04/o1_mf_s_1051307510_hp4gwzp8_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/Biju1/BIJU1/autobackup/2021_09_04/o1_mf_s_1051307510_hp4gwzp8_.bkp tag=TAG20210904T215150
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
output file name=/u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/controlfile/o1_mf_hp4m0v21_.ctl
Finished restore at 04-JAN-20
sql statement: alter database mount clone database
sql statement: alter system archive log current
contents of Memory Script:
{
# set requested point in time
set until scn 5048742;
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile 1 to new;
set newname for clone datafile 4 to new;
set newname for clone datafile 3 to new;
set newname for clone tempfile 1 to new;
set newname for datafile 5 to
"/u01/app/oracle/oradata/BIJU1/rman_transdest/tbs_test.dbf";
# switch all tempfiles
switch clone tempfile all;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile 1, 4, 3, 5;
switch clone datafile all;
}
executing Memory Script
executing command: SET until clause
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/oracle/oradata/BIJU1/rman_auxdest/BIJU1/datafile/o1_mf_temp_%u_.tmp in control file
Starting restore at 04-JAN-20
using channel ORA_AUX_DISK_1
creating datafile file number=5 name=/u01/app/oracle/oradata/BIJU1/rman_transdest/tbs_test.dbf
channel ORA_AUX_DISK_1: restoring datafile 00001
input datafile copy RECID=2 STAMP=1051051878 file name=/u01/app/oracle/fast_recovery_area/Biju1/BIJU1/datafile/o1_mf_system_howo5zck_.dbf
destination for restore of datafile 00001: /u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: copied datafile copy of datafile 00001
output file name=/u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/datafile/o1_mf_system_hp4m10z6_.dbf RECID=6 STAMP=1051311773
channel ORA_AUX_DISK_1: restoring datafile 00004
input datafile copy RECID=3 STAMP=1051051911 file name=/u01/app/oracle/fast_recovery_area/Biju1/BIJU1/datafile/o1_mf_undotbs1_howo8o5o_.dbf
destination for restore of datafile 00004: /u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: copied datafile copy of datafile 00004
output file name=/u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/datafile/o1_mf_undotbs1_hp4m2gm6_.dbf RECID=7 STAMP=1051311787
channel ORA_AUX_DISK_1: restoring datafile 00003
input datafile copy RECID=1 STAMP=1051051798 file name=/u01/app/oracle/fast_recovery_area/Biju1/BIJU1/datafile/o1_mf_sysaux_howo48c4_.dbf
destination for restore of datafile 00003: /u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: copied datafile copy of datafile 00003
output file name=/u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/datafile/o1_mf_sysaux_hp4m2omr_.dbf RECID=8 STAMP=1051311866
Finished restore at 04-JAN-20
datafile 1 switched to datafile copy
input datafile copy RECID=9 STAMP=1051311875 file name=/u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/datafile/o1_mf_system_hp4m10z6_.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=10 STAMP=1051311875 file name=/u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/datafile/o1_mf_undotbs1_hp4m2gm6_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=11 STAMP=1051311875 file name=/u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/datafile/o1_mf_sysaux_hp4m2omr_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=12 STAMP=1051311875 file name=/u01/app/oracle/oradata/BIJU1/rman_transdest/tbs_test.dbf
contents of Memory Script:
{
# set requested point in time
set until scn 5048742;
# online the datafiles restored or switched
sql clone "alter database datafile 1 online";
sql clone "alter database datafile 4 online";
sql clone "alter database datafile 3 online";
sql clone "alter database datafile 5 online";
# recover and open resetlogs
recover clone database tablespace "TBS_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 4 online
sql statement: alter database datafile 3 online
sql statement: alter database datafile 5 online
Starting recover at 04-JAN-20
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 63 is already on disk as file /u01/backup/arch/Biju1/1_63_1040065134.dbf
archived log for thread 1 with sequence 64 is already on disk as file /u01/backup/arch/Biju1/1_64_1040065134.dbf
archived log for thread 1 with sequence 1 is already on disk as file /u01/backup/arch/Biju1/1_1_1051224827.dbf
archived log for thread 1 with sequence 2 is already on disk as file /u01/backup/arch/Biju1/1_2_1051224827.dbf
archived log file name=/u01/backup/arch/Biju1/1_63_1040065134.dbf thread=1 sequence=63
archived log file name=/u01/backup/arch/Biju1/1_64_1040065134.dbf thread=1 sequence=64
archived log file name=/u01/backup/arch/Biju1/1_1_1051224827.dbf thread=1 sequence=1
archived log file name=/u01/backup/arch/Biju1/1_2_1051224827.dbf thread=1 sequence=2
media recovery complete, elapsed time: 00:01:10
Finished recover at 04-JAN-20
database opened
contents of Memory Script:
{
# make read only the tablespace that will be exported
sql clone 'alter tablespace TBS_TEST read only';
# create directory for datapump export
sql clone "create or replace directory STREAMS_DIROBJ_DPDIR as ''
/u01/app/oracle/oradata/BIJU1/rman_transdest''";
}
executing Memory Script
sql statement: alter tablespace TBS_TEST read only
sql statement: create or replace directory STREAMS_DIROBJ_DPDIR as ''/u01/app/oracle/oradata/BIJU1/rman_transdest''
Performing export of metadata...
EXPDP> Starting "SYS"."TSPITR_EXP_kvwx_vvDC":
EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
EXPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
EXPDP> Master table "SYS"."TSPITR_EXP_kvwx_vvDC" successfully loaded/unloaded
EXPDP> ******************************************************************************
EXPDP> Dump file set for SYS.TSPITR_EXP_kvwx_vvDC is:
EXPDP> /u01/app/oracle/oradata/BIJU1/rman_transdest/dmpfile.dmp
EXPDP> ******************************************************************************
EXPDP> Datafiles required for transportable tablespace TBS_TEST:
EXPDP> /u01/app/oracle/oradata/BIJU1/rman_transdest/tbs_test.dbf
EXPDP> Job "SYS"."TSPITR_EXP_kvwx_vvDC" successfully completed at Mon Jan 04 11:08:03 2021 elapsed 0 00:00:42
Export completed
Not performing table import after point-in-time recovery
/*
The following command may be used to import the tablespaces.
Substitute values for <logon> and <directory>.
impdp <logon> directory=<directory> dumpfile= 'dmpfile.dmp' transport_datafiles= /u01/app/oracle/oradata/BIJU1/rman_transdest/tbs_test.dbf
*/
--
--
--
--
CREATE DIRECTORY STREAMS$DIROBJ$1 AS '/u01/app/oracle/oradata/BIJU1/rman_transdest/';
CREATE DIRECTORY STREAMS$DIROBJ$DPDIR AS '/u01/app/oracle/oradata/BIJU1/rman_transdest';
/* PL/SQL Script to import the exported tablespaces */
DECLARE
--
tbs_files dbms_streams_tablespace_adm.file_set;
cvt_files dbms_streams_tablespace_adm.file_set;
--
dump_file dbms_streams_tablespace_adm.file;
dp_job_name VARCHAR2(30) := NULL;
--
ts_names dbms_streams_tablespace_adm.tablespace_set;
BEGIN
--
dump_file.file_name := 'dmpfile.dmp';
dump_file.directory_object := 'STREAMS$DIROBJ$DPDIR';
--
tbs_files( 1).file_name := 'tbs_test.dbf';
tbs_files( 1).directory_object := 'STREAMS$DIROBJ$1';
--
dbms_streams_tablespace_adm.attach_tablespaces(
datapump_job_name => dp_job_name,
dump_file => dump_file,
tablespace_files => tbs_files,
converted_files => cvt_files,
tablespace_names => ts_names);
--
IF ts_names IS NOT NULL AND ts_names.first IS NOT NULL THEN
FOR i IN ts_names.first .. ts_names.last LOOP
dbms_output.put_line('imported tablespace '|| ts_names(i));
END LOOP;
END IF;
END;
/
--
DROP DIRECTORY STREAMS$DIROBJ$1;
DROP DIRECTORY STREAMS$DIROBJ$DPDIR;
--------------------------------------------------------------
-- End of sample PL/SQL script
--------------------------------------------------------------
Removing automatic instance
shutting down automatic instance
Oracle instance shut down
Automatic instance removed
auxiliary instance file /u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/datafile/o1_mf_temp_hp4m93dr_.tmp deleted
auxiliary instance file /u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/onlinelog/o1_mf_3_hp4m8ox6_.log deleted
auxiliary instance file /u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/onlinelog/o1_mf_2_hp4m7r30_.log deleted
auxiliary instance file /u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/onlinelog/o1_mf_1_hp4m7r2x_.log deleted
auxiliary instance file /u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/datafile/o1_mf_sysaux_hp4m2omr_.dbf deleted
auxiliary instance file /u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/datafile/o1_mf_undotbs1_hp4m2gm6_.dbf deleted
auxiliary instance file /u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/datafile/o1_mf_system_hp4m10z6_.dbf deleted
auxiliary instance file /u01/app/oracle/oradata/BIJU1/rman_auxdest/BIJU1/controlfile/o1_mf_hp4m0v21_.ctl deleted
RMAN>
Recovery Manager complete.
Recent Posts