{"id":9596,"date":"2016-12-18T09:12:46","date_gmt":"2016-12-18T08:12:46","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/"},"modified":"2016-12-18T09:12:46","modified_gmt":"2016-12-18T08:12:46","slug":"rman-transport-tablespace","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/","title":{"rendered":"RMAN&gt; TRANSPORT TABLESPACE"},"content":{"rendered":"<h2>By Franck Pachot<\/h2>\n<p>.<br \/>\nIn a <a href=\"http:\/\/dbi-services.com\/blog\/easy-datawarehouse-ods-load-in-enterprise-edition\/\" target=\"_blank\" rel=\"noopener noreferrer\">previous post<\/a> I explained how to use transportable tablespace from a standby database. Here I&#8217;m showing an alternative where you can transport from a backup instead of a standby database. RMAN can do that since 10<em>g<\/em>R2.<br \/>\n<!--more--><br \/>\nTransportable Tablespace is a beautiful feature: the performance of physical copy and the flexibility of logical export\/import. But it has one drawback: the source tablespace must be opened read only when you copy it and export the metadata. This means that you cannot use it from production, such as moving data to a datawarehouse ODS. There&#8217;s an alternative to that: restore the tablespace with TSPITR (tablespace point-in-time recovery) into a temporary instance and transport from there.<br \/>\nThis is what is automated by RMAN with a simple command: RMAN&gt; TRANSPORT TABLESPACE.<\/p>\n<h3>Multitenant<\/h3>\n<p>This blog post shows how to do that when you are in 12<em>c<\/em> multitenant architecture. Even if 12.2 comes with online PDB clone, you may want to transport a single tablespace.<\/p>\n<p>You cannot run TRANSPORT TABLESPACE when connected to a PDB. Let&#8217;s test it:<\/p>\n<pre><code>\nRMAN&gt; connect target sys\/oracle@\/\/localhost\/PDB1\nconnected to target database: CDB1:PDB1 (DBID=1975603085)\n<\/code><\/pre>\n<p>Here are the datafiles:<\/p>\n<pre><code>\nRMAN&gt; report schema;\nusing target database control file instead of recovery catalog\nReport of database schema for database with db_unique_name CDB1A\n&nbsp;\nList of Permanent Datafiles\n===========================\nFile Size(MB) Tablespace           RB segs Datafile Name\n---- -------- -------------------- ------- ------------------------\n9    250      SYSTEM               NO      \/u02\/oradata\/CDB1A\/PDB1\/system01.dbf\n10   350      SYSAUX               NO      \/u02\/oradata\/CDB1A\/PDB1\/sysaux01.dbf\n11   520      UNDOTBS1             NO      \/u02\/oradata\/CDB1A\/PDB1\/undotbs01.dbf\n12   5        USERS                NO      \/u02\/oradata\/CDB1A\/PDB1\/users01.dbf\n&nbsp;\nList of Temporary Files\n=======================\nFile Size(MB) Tablespace           Maxsize(MB) Tempfile Name\n---- -------- -------------------- ----------- --------------------\n3    20       TEMP                 32767       \/u02\/oradata\/CDB1A\/PDB1\/temp01.dbf\n<\/code><\/pre>\n<p>Let&#8217;s run the TRANSPORT TABLESPACE command:<\/p>\n<pre><code>\nRMAN&gt; transport tablespace USERS auxiliary destination '\/var\/tmp\/AUX' tablespace destination '\/var\/tmp\/TTS';\nRMAN-05026: warning: presuming following set of tablespaces applies to specified point-in-time\n&nbsp;\nList of tablespaces expected to have UNDO segments\nTablespace SYSTEM\nTablespace UNDOTBS1\n&nbsp;\nCreating automatic instance, with SID='jlDa'\n&nbsp;\ninitialization parameters used for automatic instance:\ndb_name=CDB1\ndb_unique_name=jlDa_pitr_CDB1\ncompatible=12.2.0\ndb_block_size=8192\ndb_files=200\ndiagnostic_dest=\/u01\/app\/oracle\n_system_trig_enabled=FALSE\nsga_target=768M\nprocesses=200\ndb_create_file_dest=\/var\/tmp\/AUX\nlog_archive_dest_1='location=\/var\/tmp\/AUX'\nenable_pluggable_database=true\n_clone_one_pdb_recovery=true\n#No auxiliary parameter file used\n&nbsp;\nstarting up automatic instance CDB1\n&nbsp;\nOracle instance started\n&nbsp;\nTotal System Global Area     805306368 bytes\n&nbsp;\nFixed Size                     8793056 bytes\nVariable Size                234882080 bytes\nDatabase Buffers             553648128 bytes\nRedo Buffers                   7983104 bytes\nAutomatic instance created\n&nbsp;\nRemoving automatic instance\nshutting down automatic instance\nOracle instance shut down\nAutomatic instance removed\nRMAN-00571: ===========================================================\nRMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============\nRMAN-00571: ===========================================================\nRMAN-03002: failure of transport tablespace command at 12\/17\/2016 21:33:14\nRMAN-07538: Pluggable Database qualifier not allowed when connected to a Pluggable Database\n<\/code><\/pre>\n<p>You got the idea: an auxiliary instance is automatically created but then it failed because an internal command cannot be run from a PDB.<\/p>\n<h3>Run from CDB<\/h3>\n<p>So let&#8217;s run it when connected to CDB$ROOT:<\/p>\n<pre><code>\necho set on\n&nbsp;\nRMAN&gt; connect target sys\/oracle\nconnected to target database: CDB1 (DBID=894360530)\n<\/code><\/pre>\n<p>Whe can see all pluggable databases and all datafiles:<\/p>\n<pre><code>\nRMAN&gt; report schema;\nusing target database control file instead of recovery catalog\nReport of database schema for database with db_unique_name CDB1A\n&nbsp;\nList of Permanent Datafiles\n===========================\nFile Size(MB) Tablespace           RB segs Datafile Name\n---- -------- -------------------- ------- ------------------------\n1    800      SYSTEM               YES     \/u02\/oradata\/CDB1A\/system01.dbf\n3    480      SYSAUX               NO      \/u02\/oradata\/CDB1A\/sysaux01.dbf\n4    65       UNDOTBS1             YES     \/u02\/oradata\/CDB1A\/undotbs01.dbf\n5    250      PDB$SEED:SYSTEM      NO      \/u02\/oradata\/CDB1A\/pdbseed\/system01.dbf\n6    350      PDB$SEED:SYSAUX      NO      \/u02\/oradata\/CDB1A\/pdbseed\/sysaux01.dbf\n7    5        USERS                NO      \/u02\/oradata\/CDB1A\/users01.dbf\n8    520      PDB$SEED:UNDOTBS1    NO      \/u02\/oradata\/CDB1A\/pdbseed\/undotbs01.dbf\n9    250      PDB1:SYSTEM          YES     \/u02\/oradata\/CDB1A\/PDB1\/system01.dbf\n10   350      PDB1:SYSAUX          NO      \/u02\/oradata\/CDB1A\/PDB1\/sysaux01.dbf\n11   520      PDB1:UNDOTBS1        YES     \/u02\/oradata\/CDB1A\/PDB1\/undotbs01.dbf\n12   5        PDB1:USERS           NO      \/u02\/oradata\/CDB1A\/PDB1\/users01.dbf\n&nbsp;\nList of Temporary Files\n=======================\nFile Size(MB) Tablespace           Maxsize(MB) Tempfile Name\n---- -------- -------------------- ----------- --------------------\n1    240      TEMP                 32767       \/u02\/oradata\/CDB1A\/temp01.dbf\n2    32       PDB$SEED:TEMP        32767       \/u02\/oradata\/CDB1A\/pdbseed\/temp012016-08-23_14-12-45-799-PM.dbf\n3    20       PDB1:TEMP            32767       \/u02\/oradata\/CDB1A\/PDB1\/temp01.dbf\n<\/code><\/pre>\n<p>We can run the TRANSPORT TABLESPACE command from here, naming the tablespace prefixed with the PDB name PDB1:USERS<\/p>\n<h3>transport tablespace &#8230; auxiliary destination &#8230; tablespace destination<\/h3>\n<p>The TRANSPORT TABLESPACE command needs a destination where to put the datafiles and dump file to transport (TABLESPACE DESTINATION) and also needs an auxiliary destination (AUXILIARY DESTINATION). It seems it is mandatory, which is different from the PDBPITR where the FRA is used by default.<\/p>\n<pre><code>\nRMAN&gt; transport tablespace PDB1:USERS auxiliary destination '\/var\/tmp\/AUX' tablespace destination '\/var\/tmp\/TTS';\n<\/code><\/pre>\n<p>And then you will see all what RMAN does for you. I&#8217;ll show most of the output.<\/p>\n<h3>UNDO<\/h3>\n<p>Restoring a tablespace will need to apply redo and then rollback the transactions that were opened at that PIT. This is why RMAN has to restore all tablespaces that may contain UNDO:<\/p>\n<pre><code>RMAN-05026: warning: presuming following set of tablespaces applies to specified point-in-time\n&nbsp;\nList of tablespaces expected to have UNDO segments\nTablespace SYSTEM\nTablespace PDB1:SYSTEM\nTablespace UNDOTBS1\nTablespace PDB1:UNDOTBS1\n<\/code><\/pre>\n<p>I suppose that when the UNDO_TABLESPACE has changed in the meantime, RMAN cannot guess which tablespace covered the transactions at the requested PIT but I seen nothing in the TRANSPORT TABLESPACE syntax to specify it. That&#8217;s probably for a future post and \/or SR.<\/p>\n<h3>Auxiliary instance<\/h3>\n<p>So RMAN creates an auxiliary instance with some specific parameters to be sure there&#8217;s no side effect on the source database (the RMAN target one).<\/p>\n<pre><code>\nCreating automatic instance, with SID='qnDA'\n&nbsp;\ninitialization parameters used for automatic instance:\ndb_name=CDB1\ndb_unique_name=qnDA_pitr_PDB1_CDB1\ncompatible=12.2.0\ndb_block_size=8192\ndb_files=200\ndiagnostic_dest=\/u01\/app\/oracle\n_system_trig_enabled=FALSE\nsga_target=768M\nprocesses=200\ndb_create_file_dest=\/var\/tmp\/AUX\nlog_archive_dest_1='location=\/var\/tmp\/AUX'\nenable_pluggable_database=true\n_clone_one_pdb_recovery=true\n#No auxiliary parameter file used\n&nbsp;\n&nbsp;\nstarting up automatic instance CDB1\n&nbsp;\nOracle instance started\n&nbsp;\nTotal System Global Area     805306368 bytes\n&nbsp;\nFixed Size                     8793056 bytes\nVariable Size                234882080 bytes\nDatabase Buffers             553648128 bytes\nRedo Buffers                   7983104 bytes\nAutomatic instance created\n<\/code><\/pre>\n<h3>Restore<\/h3>\n<p>The goal is to transport the tablespace, so RMAN checks that they are self-contained:<\/p>\n<pre><code>\nRunning TRANSPORT_SET_CHECK on recovery set tablespaces\nTRANSPORT_SET_CHECK completed successfully\n<\/code><\/pre>\n<p>and starts the restore of controlfile and datafiles (the CDB SYSTEM, SYSAUX, UNDO and the PDB SYSTEM, SYSAUX, UNDO and the tablespaces to transport)<\/p>\n<pre><code>\ncontents of Memory Script:\n{\n# set requested point in time\nset until  scn 1836277;\n# restore the controlfile\nrestore clone controlfile;\n&nbsp;\n# mount the controlfile\nsql clone 'alter database mount clone database';\n&nbsp;\n# archive current online log\nsql 'alter system archive log current';\n}\nexecuting Memory Script\n&nbsp;\nexecuting command: SET until clause\n&nbsp;\nStarting restore at 17-DEC-16\nallocated channel: ORA_AUX_DISK_1\nchannel ORA_AUX_DISK_1: SID=253 device type=DISK\n&nbsp;\nchannel ORA_AUX_DISK_1: starting datafile backup set restore\nchannel ORA_AUX_DISK_1: restoring control file\nchannel ORA_AUX_DISK_1: reading from backup piece \/u02\/fast_recovery_area\/CDB1A\/autobackup\/2016_12_17\/o1_mf_s_930864638_d5c83gxl_.bkp\nchannel ORA_AUX_DISK_1: piece handle=\/u02\/fast_recovery_area\/CDB1A\/autobackup\/2016_12_17\/o1_mf_s_930864638_d5c83gxl_.bkp tag=TAG20161217T213038\nchannel ORA_AUX_DISK_1: restored backup piece 1\nchannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03\noutput file name=\/var\/tmp\/AUX\/CDB1A\/controlfile\/o1_mf_d5c88zp3_.ctl\nFinished restore at 17-DEC-16\n&nbsp;\nsql statement: alter database mount clone database\n&nbsp;\nsql statement: alter system archive log current\n&nbsp;\ncontents of Memory Script:\n{\n# set requested point in time\nset until  scn 1836277;\n# set destinations for recovery set and auxiliary set datafiles\nset newname for clone datafile  1 to new;\nset newname for clone datafile  9 to new;\nset newname for clone datafile  4 to new;\nset newname for clone datafile  11 to new;\nset newname for clone datafile  3 to new;\nset newname for clone datafile  10 to new;\nset newname for clone tempfile  1 to new;\nset newname for clone tempfile  3 to new;\nset newname for datafile  12 to\n \"\/var\/tmp\/TTS\/users01.dbf\";\n# switch all tempfiles\nswitch clone tempfile all;\n# restore the tablespaces in the recovery set and the auxiliary set\nrestore clone datafile  1, 9, 4, 11, 3, 10, 12;\n&nbsp;\nswitch clone datafile all;\n}\nexecuting Memory Script\n&nbsp;\nexecuting command: SET until clause\n&nbsp;\nexecuting command: SET NEWNAME\n&nbsp;\nexecuting command: SET NEWNAME\n&nbsp;\nexecuting command: SET NEWNAME\n&nbsp;\nexecuting command: SET NEWNAME\n&nbsp;\nexecuting command: SET NEWNAME\n&nbsp;\nexecuting command: SET NEWNAME\n&nbsp;\nexecuting command: SET NEWNAME\n&nbsp;\nexecuting command: SET NEWNAME\n&nbsp;\nexecuting command: SET NEWNAME\n&nbsp;\nrenamed tempfile 1 to \/var\/tmp\/AUX\/CDB1A\/datafile\/o1_mf_temp_%u_.tmp in control file\nrenamed tempfile 3 to \/var\/tmp\/AUX\/CDB1A\/3ABD2FF082A634B5E053754EA8C022A9\/datafile\/o1_mf_temp_%u_.tmp in control file\n&nbsp;\nStarting restore at 17-DEC-16\nusing channel ORA_AUX_DISK_1\n&nbsp;\nchannel ORA_AUX_DISK_1: starting datafile backup set restore\nchannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set\nchannel ORA_AUX_DISK_1: restoring datafile 00001 to \/var\/tmp\/AUX\/CDB1A\/datafile\/o1_mf_system_%u_.dbf\nchannel ORA_AUX_DISK_1: restoring datafile 00004 to \/var\/tmp\/AUX\/CDB1A\/datafile\/o1_mf_undotbs1_%u_.dbf\nchannel ORA_AUX_DISK_1: restoring datafile 00003 to \/var\/tmp\/AUX\/CDB1A\/datafile\/o1_mf_sysaux_%u_.dbf\nchannel ORA_AUX_DISK_1: reading from backup piece \/u02\/fast_recovery_area\/CDB1A\/backupset\/2016_12_17\/o1_mf_nnndf_TAG20161217T213044_d5c83n81_.bkp\nchannel ORA_AUX_DISK_1: piece handle=\/u02\/fast_recovery_area\/CDB1A\/backupset\/2016_12_17\/o1_mf_nnndf_TAG20161217T213044_d5c83n81_.bkp tag=TAG20161217T213044\nchannel ORA_AUX_DISK_1: restored backup piece 1\nchannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:35\nchannel ORA_AUX_DISK_1: starting datafile backup set restore\nchannel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set\nchannel ORA_AUX_DISK_1: restoring datafile 00009 to \/var\/tmp\/AUX\/CDB1A\/3ABD2FF082A634B5E053754EA8C022A9\/datafile\/o1_mf_system_%u_.dbf\nchannel ORA_AUX_DISK_1: restoring datafile 00011 to \/var\/tmp\/AUX\/CDB1A\/3ABD2FF082A634B5E053754EA8C022A9\/datafile\/o1_mf_undotbs1_%u_.dbf\nchannel ORA_AUX_DISK_1: restoring datafile 00010 to \/var\/tmp\/AUX\/CDB1A\/3ABD2FF082A634B5E053754EA8C022A9\/datafile\/o1_mf_sysaux_%u_.dbf\nchannel ORA_AUX_DISK_1: restoring datafile 00012 to \/var\/tmp\/TTS\/users01.dbf\nchannel ORA_AUX_DISK_1: reading from backup piece \/u02\/fast_recovery_area\/CDB1A\/3ABD2FF082A634B5E053754EA8C022A9\/backupset\/2016_12_17\/o1_mf_nnndf_TAG20161217T213044_d5c851hh_.bkp\nchannel ORA_AUX_DISK_1: piece handle=\/u02\/fast_recovery_area\/CDB1A\/3ABD2FF082A634B5E053754EA8C022A9\/backupset\/2016_12_17\/o1_mf_nnndf_TAG20161217T213044_d5c851hh_.bkp tag=TAG20161217T213044\nchannel ORA_AUX_DISK_1: restored backup piece 1\nchannel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:25\nFinished restore at 17-DEC-16\n&nbsp;\ndatafile 1 switched to datafile copy\ninput datafile copy RECID=11 STAMP=930865006 file name=\/var\/tmp\/AUX\/CDB1A\/datafile\/o1_mf_system_d5c8993k_.dbf\ndatafile 9 switched to datafile copy\ninput datafile copy RECID=12 STAMP=930865006 file name=\/var\/tmp\/AUX\/CDB1A\/3ABD2FF082A634B5E053754EA8C022A9\/datafile\/o1_mf_system_d5c8d8ow_.dbf\ndatafile 4 switched to datafile copy\ninput datafile copy RECID=13 STAMP=930865006 file name=\/var\/tmp\/AUX\/CDB1A\/datafile\/o1_mf_undotbs1_d5c8998b_.dbf\ndatafile 11 switched to datafile copy\ninput datafile copy RECID=14 STAMP=930865006 file name=\/var\/tmp\/AUX\/CDB1A\/3ABD2FF082A634B5E053754EA8C022A9\/datafile\/o1_mf_undotbs1_d5c8d8g6_.dbf\ndatafile 3 switched to datafile copy\ninput datafile copy RECID=15 STAMP=930865006 file name=\/var\/tmp\/AUX\/CDB1A\/datafile\/o1_mf_sysaux_d5c8996o_.dbf\ndatafile 10 switched to datafile copy\ninput datafile copy RECID=16 STAMP=930865006 file name=\/var\/tmp\/AUX\/CDB1A\/3ABD2FF082A634B5E053754EA8C022A9\/datafile\/o1_mf_sysaux_d5c8d8o7_.dbf\ndatafile 12 switched to datafile copy\ninput datafile copy RECID=17 STAMP=930865006 file name=\/var\/tmp\/TTS\/users01.dbf\n<\/code><\/pre>\n<p>You noticed that the SYSTEM, SYSAUX, UNDO are restored in the auxiliary location but the tablespaces to transport (USERS here) goes to its destination. If you want to transport it on the same server, you can avoid any copying of it.<\/p>\n<h3>Recover<\/h3>\n<p>The recovery continues automatically to the PIT (which you can also specify with an UNTIL clause or restore point)<\/p>\n<pre><code>\ncontents of Memory Script:\n{\n# set requested point in time\nset until  scn 1836277;\n# online the datafiles restored or switched\nsql clone \"alter database datafile  1 online\";\nsql clone 'PDB1' \"alter database datafile\n 9 online\";\nsql clone \"alter database datafile  4 online\";\nsql clone 'PDB1' \"alter database datafile\n 11 online\";\nsql clone \"alter database datafile  3 online\";\nsql clone 'PDB1' \"alter database datafile\n 10 online\";\nsql clone 'PDB1' \"alter database datafile\n 12 online\";\n# recover and open resetlogs\nrecover clone database tablespace  \"PDB1\":\"USERS\", \"SYSTEM\", \"PDB1\":\"SYSTEM\", \"UNDOTBS1\", \"PDB1\":\"UNDOTBS1\", \"SYSAUX\", \"PDB1\":\"SYSAUX\" delete archivelog;\nalter clone database open resetlogs;\n}\nexecuting Memory Script\n&nbsp;\nexecuting command: SET until clause\n&nbsp;\nsql statement: alter database datafile  1 online\n&nbsp;\nsql statement: alter database datafile  9 online\n&nbsp;\nsql statement: alter database datafile  4 online\n&nbsp;\nsql statement: alter database datafile  11 online\n&nbsp;\nsql statement: alter database datafile  3 online\n&nbsp;\nsql statement: alter database datafile  10 online\n&nbsp;\nsql statement: alter database datafile  12 online\n&nbsp;\nStarting recover at 17-DEC-16\nusing channel ORA_AUX_DISK_1\n&nbsp;\nstarting media recovery\n&nbsp;\narchived log for thread 1 with sequence 30 is already on disk as file \/u02\/fast_recovery_area\/CDB1A\/archivelog\/2016_12_17\/o1_mf_1_30_d5c83ll5_.arc\narchived log for thread 1 with sequence 31 is already on disk as file \/u02\/fast_recovery_area\/CDB1A\/archivelog\/2016_12_17\/o1_mf_1_31_d5c8783v_.arc\narchived log file name=\/u02\/fast_recovery_area\/CDB1A\/archivelog\/2016_12_17\/o1_mf_1_30_d5c83ll5_.arc thread=1 sequence=30\narchived log file name=\/u02\/fast_recovery_area\/CDB1A\/archivelog\/2016_12_17\/o1_mf_1_31_d5c8783v_.arc thread=1 sequence=31\nmedia recovery complete, elapsed time: 00:00:02\nFinished recover at 17-DEC-16\n&nbsp;\ndatabase opened\n&nbsp;\ncontents of Memory Script:\n{\nsql clone 'alter pluggable database  PDB1 open';\n}\nexecuting Memory Script\n&nbsp;\nsql statement: alter pluggable database  PDB1 open\n<\/code><\/pre>\n<h3>Export TTS<\/h3>\n<p>The restored tablespaces can be set read only, which was the goal.<\/p>\n<pre><code>\ncontents of Memory Script:\n{\n# make read only the tablespace that will be exported\nsql clone 'PDB1' 'alter tablespace\n USERS read only';\n# create directory for datapump export\nsql clone 'PDB1' \"create or replace directory\nSTREAMS_DIROBJ_DPDIR as ''\n\/var\/tmp\/TTS''\";\n}\nexecuting Memory Script\n&nbsp;\nsql statement: alter tablespace  USERS read only\n<\/code><\/pre>\n<p>Now the export of metadata run (equivalent to expdp transport_tablespace=Y)<\/p>\n<pre><code>\nsql statement: create or replace directory STREAMS_DIROBJ_DPDIR as ''\/var\/tmp\/TTS''\n&nbsp;\nPerforming export of metadata...\n   EXPDP&gt; Starting \"SYS\".\"TSPITR_EXP_qnDA_urDb\":\n&nbsp;\n   EXPDP&gt; Processing object type TRANSPORTABLE_EXPORT\/PLUGTS_BLK\n   EXPDP&gt; Processing object type TRANSPORTABLE_EXPORT\/POST_INSTANCE\/PLUGTS_BLK\n   EXPDP&gt; Master table \"SYS\".\"TSPITR_EXP_qnDA_urDb\" successfully loaded\/unloaded\n   EXPDP&gt; ******************************************************************************\n   EXPDP&gt; Dump file set for SYS.TSPITR_EXP_qnDA_urDb is:\n   EXPDP&gt;   \/var\/tmp\/TTS\/dmpfile.dmp\n   EXPDP&gt; ******************************************************************************\n   EXPDP&gt; Datafiles required for transportable tablespace USERS:\n   EXPDP&gt;   \/var\/tmp\/TTS\/users01.dbf\n   EXPDP&gt; Job \"SYS\".\"TSPITR_EXP_qnDA_urDb\" successfully completed at Sat Dec 17 21:41:06 2016 elapsed 0 00:00:47\nExport completed\n&nbsp;\nNot performing table import after point-in-time recovery\n<\/code><\/pre>\n<p>The last message let me think that the RMAN codes shares the one that manages RECOVER TABLE.<\/p>\n<p>Then RMAN lists the commands to run the import (also available in a generated script) and removes the auxiliary instance.<\/p>\n<h3>Cleanup<\/h3>\n<p>Not everything has been removed:<\/p>\n<pre><code>[oracle@VM117 blogs]$ du -ha \/var\/tmp\/AUX\n0       \/var\/tmp\/AUX\/CDB1A\/controlfile\n201M    \/var\/tmp\/AUX\/CDB1A\/onlinelog\/o1_mf_51_d5c8k0oo_.log\n201M    \/var\/tmp\/AUX\/CDB1A\/onlinelog\/o1_mf_52_d5c8kcjp_.log\n201M    \/var\/tmp\/AUX\/CDB1A\/onlinelog\/o1_mf_53_d5c8kskz_.log\n601M    \/var\/tmp\/AUX\/CDB1A\/onlinelog\n0       \/var\/tmp\/AUX\/CDB1A\/datafile\n521M    \/var\/tmp\/AUX\/CDB1A\/3ABD2FF082A634B5E053754EA8C022A9\/datafile\/o1_mf_undo_1_d5c8m1nx_.dbf\n521M    \/var\/tmp\/AUX\/CDB1A\/3ABD2FF082A634B5E053754EA8C022A9\/datafile\n521M    \/var\/tmp\/AUX\/CDB1A\/3ABD2FF082A634B5E053754EA8C022A9\n1.1G    \/var\/tmp\/AUX\/CDB1A\n1.1G    \/var\/tmp\/AUX<\/code><\/pre>\n<h3>Import TTS<\/h3>\n<p>In the destination you find the tablespace datafiles, the dump of metadata and a script that can be run to import it to the destination:<\/p>\n<pre><code>[oracle@VM117 blogs]$ du -ha \/var\/tmp\/TTS\n5.1M    \/var\/tmp\/TTS\/users01.dbf\n132K    \/var\/tmp\/TTS\/dmpfile.dmp\n4.0K    \/var\/tmp\/TTS\/impscrpt.sql\n5.2M    \/var\/tmp\/TTS<\/code><\/pre>\n<p>For this example, I import it on the same server, in a different pluggable database:<\/p>\n<pre><code>\nSQL&gt; connect \/ as sysdba\nConnected.\nSQL&gt; alter session set container=PDB2;\nSession altered.\n<\/code><\/pre>\n<p>and simply run the script provided:<\/p>\n<pre><code>\nSQL&gt; set echo on\n&nbsp;\nSQL&gt; @\/var\/tmp\/TTS\/impscrpt.sql\n&nbsp;\nSQL&gt; \/*\nSQL&gt;    The following command may be used to import the tablespaces.\nSQL&gt;    Substitute values for  and .\nSQL&gt;\nSQL&gt;    impdp  directory= dumpfile= 'dmpfile.dmp' transport_datafiles= \/var\/tmp\/TTS\/users01.dbf\nSQL&gt; *\/\nSQL&gt;\nSQL&gt; --\nSQL&gt; --\nSQL&gt; --\nSQL&gt; --\nSQL&gt; CREATE DIRECTORY STREAMS$DIROBJ$1 AS  '\/var\/tmp\/TTS\/';\nDirectory created.\n&nbsp;\nSQL&gt; CREATE DIRECTORY STREAMS$DIROBJ$DPDIR AS  '\/var\/tmp\/TTS';\nDirectory created.\n&nbsp;\nSQL&gt; \/* PL\/SQL Script to import the exported tablespaces *\/\nSQL&gt; DECLARE\n  2  --\n  3    tbs_files        dbms_streams_tablespace_adm.file_set;\n  4    cvt_files        dbms_streams_tablespace_adm.file_set;\n  5\n  6  --\n  7    dump_file        dbms_streams_tablespace_adm.file;\n  8    dp_job_name      VARCHAR2(30) := NULL;\n  9\n 10  --\n 11    ts_names  dbms_streams_tablespace_adm.tablespace_set;\n 12  BEGIN\n 13  --\n 14    dump_file.file_name :=  'dmpfile.dmp';\n 15    dump_file.directory_object := 'STREAMS$DIROBJ$DPDIR';\n 16\n 17  --\n 18    tbs_files( 1).file_name :=  'users01.dbf';\n 19    tbs_files( 1).directory_object :=  'STREAMS$DIROBJ$1';\n 20\n 21  --\n 22    dbms_streams_tablespace_adm.attach_tablespaces(\n 23      datapump_job_name      =&gt; dp_job_name,\n 24      dump_file              =&gt; dump_file,\n 25      tablespace_files       =&gt; tbs_files,\n 26      converted_files        =&gt; cvt_files,\n 27      tablespace_names       =&gt; ts_names);\n 28\n 29  --\n 30    IF ts_names IS NOT NULL AND ts_names.first IS NOT NULL THEN\n 31      FOR i IN ts_names.first .. ts_names.last LOOP\n 32        dbms_output.put_line('imported tablespace '|| ts_names(i));\n 33      END LOOP;\n 34    END IF;\n 35  END;\n 36  \/\nPL\/SQL procedure successfully completed.\n&nbsp;\nSQL&gt;\nSQL&gt; --\nSQL&gt; DROP DIRECTORY STREAMS$DIROBJ$1;\nDirectory dropped.\n&nbsp;\nSQL&gt; DROP DIRECTORY STREAMS$DIROBJ$DPDIR;\nDirectory dropped.\n&nbsp;\nSQL&gt; --------------------------------------------------------------\nSQL&gt; -- End of sample PL\/SQL script\nSQL&gt; --------------------------------------------------------------\n<\/code><\/pre>\n<p>Of course, you don&#8217;t need to and you can run the import with IMPDP:<\/p>\n<pre><code>SQL&gt; alter session set container=pdb2;\nSession altered.\nSQL&gt; create directory tts as '\/var\/tmp\/TTS';\nDirectory created.\nSQL&gt; host impdp pdbadmin\/oracle@\/\/localhost\/PDB2 directory=TTS dumpfile='dmpfile.dmp' transport_datafiles=\/var\/tmp\/TTS\/users01.dbf<\/code><\/pre>\n<p>You may also use convert to transport to a different endianness.<\/p>\n<h3>Local Undo<\/h3>\n<p>Note that if you run it on current 12.2.0.1.0 cloud first DBaaS you will get an error when RMAN opens the PDB in the auxiliary instance because there&#8217;s a bug with local undo. Here is the alert.log part:<\/p>\n<pre><code>\nPDB1(3):Opening pdb with no Resource Manager plan active \nPDB1(3):CREATE SMALLFILE UNDO TABLESPACE undo_1 DATAFILE SIZE 188743680 AUTOEXTEND ON NEXT 5242880 MAXSIZE 34359721984 ONLINE \nPDB1(3):Force tablespace UNDO_1 to be encrypted with AES128 \n2016-12-17T18:05:14.759732+00:00 \nPDB1(3):ORA-00060: deadlock resolved; details in file \/u01\/app\/oracle\/diag\/rdbms\/fqkn_pitr_pdb1_cdb1\/fqkn\/trace\/fqkn_ora_26146.trc \nPDB1(3):ORA-60 signalled during: CREATE SMALLFILE UNDO TABLESPACE undo_1 DATAFILE SIZE 188743680 AUTOEXTEND ON NEXT 5242880 MAXSIZE 34359721984 ONLINE... \nPDB1(3):Automatic creation of undo tablespace failed with error 604 60 \nORA-604 signalled during: alter pluggable database PDB1 open...\n<\/code><\/pre>\n<p>I did this demo with LOCAL UNDO OFF.<\/p>\n<h3>So what?<\/h3>\n<p>You can use Transportable Tablespaces from a database where you cannot put the tablespace read-only. The additional cost of it is to recover it from a backup, along with SYSTEM, SYSAUX and UNDO. But it is fully automated with only one RMAN command.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By Franck Pachot . In a previous post I explained how to use transportable tablespace from a standby database. Here I&#8217;m showing an alternative where you can transport from a backup instead of a standby database. RMAN can do that since 10gR2.<\/p>\n","protected":false},"author":27,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229],"tags":[220,64,96,209,66,223,270,1006],"type_dbi":[],"class_list":["post-9596","post","type-post","status-publish","format-standard","hentry","category-database-administration-monitoring","tag-cdb","tag-multitenant","tag-oracle","tag-oracle-12c","tag-pdb","tag-pluggable-databases","tag-rman","tag-tts"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>RMAN&gt; TRANSPORT TABLESPACE - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"RMAN&gt; TRANSPORT TABLESPACE\" \/>\n<meta property=\"og:description\" content=\"By Franck Pachot . In a previous post I explained how to use transportable tablespace from a standby database. Here I&#8217;m showing an alternative where you can transport from a backup instead of a standby database. RMAN can do that since 10gR2.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-12-18T08:12:46+00:00\" \/>\n<meta name=\"author\" content=\"Oracle Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oracle Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"17 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/\"},\"author\":{\"name\":\"Oracle Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"headline\":\"RMAN&gt; TRANSPORT TABLESPACE\",\"datePublished\":\"2016-12-18T08:12:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/\"},\"wordCount\":773,\"commentCount\":0,\"keywords\":[\"CDB\",\"multitenant\",\"Oracle\",\"Oracle 12c\",\"PDB\",\"Pluggable Databases\",\"RMAN\",\"TTS\"],\"articleSection\":[\"Database Administration &amp; Monitoring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/\",\"name\":\"RMAN&gt; TRANSPORT TABLESPACE - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2016-12-18T08:12:46+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"RMAN&gt; TRANSPORT TABLESPACE\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\",\"name\":\"Oracle Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"caption\":\"Oracle Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"RMAN&gt; TRANSPORT TABLESPACE - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/","og_locale":"en_US","og_type":"article","og_title":"RMAN&gt; TRANSPORT TABLESPACE","og_description":"By Franck Pachot . In a previous post I explained how to use transportable tablespace from a standby database. Here I&#8217;m showing an alternative where you can transport from a backup instead of a standby database. RMAN can do that since 10gR2.","og_url":"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/","og_site_name":"dbi Blog","article_published_time":"2016-12-18T08:12:46+00:00","author":"Oracle Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Oracle Team","Est. reading time":"17 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/"},"author":{"name":"Oracle Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"headline":"RMAN&gt; TRANSPORT TABLESPACE","datePublished":"2016-12-18T08:12:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/"},"wordCount":773,"commentCount":0,"keywords":["CDB","multitenant","Oracle","Oracle 12c","PDB","Pluggable Databases","RMAN","TTS"],"articleSection":["Database Administration &amp; Monitoring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/","url":"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/","name":"RMAN&gt; TRANSPORT TABLESPACE - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2016-12-18T08:12:46+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/rman-transport-tablespace\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"RMAN&gt; TRANSPORT TABLESPACE"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee","name":"Oracle Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","caption":"Oracle Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/9596","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=9596"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/9596\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=9596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=9596"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=9596"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=9596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}