恢复数据库 NBU ZDLRA Backup

Duplicate of specific PDB in LOCAL UNDO for specific tablespaces using Tape/ZDLRA Backup (Doc ID 2926039.1) ​编辑To Bottom

恢复数据库 NBU ZDLRA Backup_第1张图片


恢复数据库 NBU ZDLRA Backup_第2张图片

In this Document

Goal
Solution
References

APPLIES TO:

Oracle Database - Enterprise Edition - Version 12.2.0.1 and later
Information in this document applies to any platform.

GOAL

For duplicate partial database including few tablespaces to new database.This doc is useful incase of specifying(including) only those tablespaces which are needed while duplicate using tape backups.
In this doc one can include only those tablespaces which are needed.By default, RMAN duplicate restores the root and the seed database SYSTEM,SYSAUX tablespace.
After duplicate, new CDB is created with required tabelspaces,root and the seed database SYSTEM,SYSAYX tablespaces are restored by default.
This doc can also useful incase of PITR restore / recovery of Multi Tenant database to extract information from the dropped / truncated tables of specific PDB.

SOLUTION

NOTE: In the images and/or the document content below, the user information and environment data used represents fictitious data from the Oracle sample schema(s), Public Documentation delivered with an Oracle database product or other training material. Any similarity to actual environments, actual persons, living or dead, is purely coincidental and not intended in any manner. For the purposes of this document, the following fictitious environment is used as an example to describe the procedure:

DEST_TNS                    : Destination database TNS Alias.
DESTCDB                     : Destination database name (Here DEST_CDB=mypdb).
DEST_PATH                   : Path of CDB and PDb datafiles in Destination database.
PDB01                       : Pluggable database name which needs to be duplicate from source CDB.
ABCD                        : This is the tablespace_name which is required tablespace for PDB which we inetrested for restore/recover. 
BACKUP_LOCATION             : Path of Source database backup.
SOURCE_DB_NAME              : Source database name
DEST_DB_UNIQUE_NAME         : Destination database DB_UNIQUE_NAME
DEST_SID                    : Destination database ORACLE_SID
SOURCE_DB_UNIQUE_NAME       : Source DB_UNIQUE_NAME.
SOURCE_DB_DATAFILE_LOCATION : Path of CDB and PDb datafiles in Destination database.

--In destination server ensure client for MML is installed
--For ZDLRA ensure :
Wallet is created for access source db VPC owner.
Valid libra.so copied to destination server
Make necessary changes to sqlnet.ora for WALLET_LOCATION

On the destination database, add below in parameter file :

-- set db_create_file_dest for destination datafile path.
-- set db_create_online_log_dest_1 for destination db Online Redo Log File Path.
-- set DB_UNIQUE_NAME for destination database DB_UNIQUE_NAME.
-- set UNDO_TABLESPACE=

On the destination server

-- set the ORACLE_SID and bring the database to nomount stage
-- restore the spfile from backup and create pfile from it.Here we are doing duplicate of PDB01.

In below example PDB01:ABCD tablespace will get restore.

When Duplicate finished, it will only restore root,PDB$SEED,PDB01 pluggable databases and it will skip PDB01:PDB01_USERS tablespace.

-- Below is Source Database REPORT SCHEMA  

RMAN> report schema;

using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name PRIM19CDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 1230 SYSTEM YES //o1_mf_system_kw7wtsxt_.dbf
3 1610 SYSAUX NO //o1_mf_sysaux_kw7wt61g_.dbf
5 360 PDB$SEED:SYSTEM NO //o1_mf_system_kw7ww02z_.dbf
6 450 PDB$SEED:SYSAUX NO //o1_mf_sysaux_kw7wx6to_.dbf
19 300 UNDO_NEW YES //o1_mf_undo_new_kw7wtcg1_.dbf
115 100 PDB$SEED:UNDO_SEED NO //o1_mf_undo_see_kw7wssf8_.dbf
116 100 PDB$SEED:UNDOTBS1 NO //o1_mf_undotbs1_kw7wt421_.dbf
121 380 PDB01:SYSTEM NO //o1_mf_system_kw7wqx0c_.dbf
122 540 PDB01:SYSAUX NO //o1_mf_sysaux_kw7ws6d8_.dbf
123 100 PDB01:UNDOTBS1 NO //o1_mf_undotbs1_kw7wszbx_.dbf
124 100 PDB01:UNDO_SEED NO //o1_mf_undo_see_kw7wszcv_.dbf
125 100 USERS NO //o1_mf_users_kw7wqw6s_.dbf
126 100 PDB01:PDB01_USERS NO //o1_mf_pdb01_us_kw7wqx3c_.dbf
127 50 PDB01:ABCD NO //o1_mf_abcd_kw7ws6kg_.dbf
129 1024 PDB01:USERS NO //o1_mf_users_kw7wqwr4_.dbf
130 1600 TESTTBSP NO //o1_mf_orlando_kw7wqw57_.dbf
131 100 PDB01:TEST NO //o1_mf_test_kw7wqwrg_.dbf
145 360 PDB02:SYSTEM NO //o1_mf_system_kw8d9ws1_.dbf
146 460 PDB02:SYSAUX NO //o1_mf_sysaux_kw8d9ws4_.dbf
147 100 PDB02:UNDOTBS1 NO //o1_mf_undotbs1_kw8d9ws6_.dbf
148 100 PDB02:UNDO_SEED NO //o1_mf_undo_see_kw8d9ws7_.dbf
149 50 PDB01:TBSP_XTTS NO //o1_mf_tbsp_xtt_kx7lzp0h_.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 300 TEMP 300 //o1_mf_temp_krsmjlmb_.tmp
2 200 TEMP 200 //o1_mf_temp_krsmjlkw_.tmp
3 100 PDB01:TEMP 100 ///o1_mf_temp_kvw8c186_.tmp
4 100 PDB02:TEMP 100 //o1_mf_temp_kw8d9ws7_.dbf
7 100 PDB$SEED:TEMP 100 //o1_mf_temp_krtqnhgm_.tmp

In destination database need to connect with auxiliary (without target connection).
In below syntax we need to mention Tablespace Name (which are included in RMAN duplicate) with UNDO tablespace_name.
In case of Local UNDO, for required PDB, we need to include all UNDO Tablespacea.
In case of Shared UNDO, for required PDB, we need to include shared UNDO Tablespace. 
 
In below example, used "set newname for database".(For ASM, we can give only DISK_GROUP name)
"set newname for database" at RMAN run block will have precedence over init/spfile parameters.     
  
RMAN syntax is like below example : 
rman auxiliary 'sys/XXXX'@DEST_TNS catalog /@ <==In case of NON ZDLRA, one can mention catalog user credentials.
RMAN> set dbid=XXXX

executing command: SET DBID

RMAN> run
{
set until time "to_date('XX-XX-XXX XX:XX:XX','dd-mm-yyyy hh24:mi:ss')";
set newname for database to '//%U';
allocate auxiliary channel c1 type sbt_tape parms "SBT_LIBRARY=//libra.so, ENV=(RA_WALLET=location=file:/ CREDENTIAL_ALIAS=) " FORMAT '%U_%D';
allocate auxiliary channel c2 type sbt_tape parms "SBT_LIBRARY=//libra.so, ENV=(RA_WALLET=location=file:/ CREDENTIAL_ALIAS=) " FORMAT '%U_%D';
allocate auxiliary channel c3 type sbt_tape parms "SBT_LIBRARY=//libra.so, ENV=(RA_WALLET=location=file:/ CREDENTIAL_ALIAS=) " FORMAT '%U_%D';
DUPLICATE DATABASE  TO  pluggable database "cdb$root"
TABLESPACE PDB01:ABCD,PDB01:UNDO_SEED,PDB01:UNDOTBS1;
}
 
rman auxiliary 'sys/XXX$'@DEST_TNS catalog /@ <==In case of NON ZDLRA, one can mention catalog user credentials.
set dbid ;

RMAN> set dbid=SOURCE_DBID
RMAN> run
{
set until time "to_date('XX-XX-XXX XX:XX:XX','dd-mm-yyyy hh24:mi:ss')";
set newname for database to '//%U';
allocate auxiliary channel c1 type sbt_tape parms "SBT_LIBRARY=//libra.so, ENV=(RA_WALLET=location=file:/ CREDENTIAL_ALIAS=) " FORMAT '%U_%D';
allocate auxiliary channel c2 type sbt_tape parms "SBT_LIBRARY=//libra.so, ENV=(RA_WALLET=location=file:/ CREDENTIAL_ALIAS=) " FORMAT '%U_%D';
allocate auxiliary channel c3 type sbt_tape parms "SBT_LIBRARY=//libra.so, ENV=(RA_WALLET=location=file:/ CREDENTIAL_ALIAS=) " FORMAT '%U_%D';
set newname for database to '/refresh/home/app/19.3.0.0/oracle/oradata/mypdb/%U';
DUPLICATE DATABASE ORCL19CD TO mypdb pluggable database "cdb$root"
TABLESPACE PDB01:ABCD,PDB01:UNDO_SEED,PDB01:UNDOTBS1;
}

allocated channel: c1
channel c1: SID=427 device type=SBT_TAPE
channel c1: RA Library (ZDLRA) SID=F3A3D51BCE37768BE0533432410A45CE
..

executing command: SET until clause
executing command: SET NEWNAME
Starting Duplicate Db at
contents of Memory Script:
{
sql clone "create spfile from memory";
}
executing Memory Script
sql statement: create spfile from memory
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 838858864 bytes

Fixed Size 9140336 bytes
Variable Size 226492416 bytes
Database Buffers 599785472 bytes
Redo Buffers 3440640 bytes
allocated channel: c1
channel c1: SID=424 device type=SBT_TAPE
channel c1: RA Library (ZDLRA) SID=F3A3D8204274772CE0533432410A3FBC
allocated channel: c2
channel c2: SID=428 device type=SBT_TAPE
channel c2: RA Library (ZDLRA) SID=F3A3D863598E7736E0533432410AF7B4
allocated channel: c3
...
contents of Memory Script:
{
set until scn xxxx;
sql clone "alter system set db_name =
'''' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
'''' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile;
alter clone database mount;
}
executing Memory Script
executing command: SET until clause
sql statement: alter system set db_name = '''' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = '''' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
...
allocated channel: c1
channel c1: SID=424 device type=SBT_TAPE
channel c1: RA Library (ZDLRA) SID=F3A3DB6BBD3E77E6E0533432410A32B6
allocated channel: c2
...
Starting restore at
channel c1: starting datafile backup set restore
channel c1: restoring control file
channel c1: reading from backup piece c-3687178233-20230201-04
channel c1: piece handle=c-3687178233-20230201-04 tag=TAG20230201T121032
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:00:08
output file name=//control01.ctl
output file name=//control02.ctl
Finished restore at
database mounted
Skipping pluggable database PDB02
Automatically adding tablespace PDB$SEED:SYSTEM
Automatically adding tablespace PDB$SEED:SYSAUX
Automatically adding tablespace PDB01:SYSTEM
Automatically adding tablespace PDB01:SYSAUX
Not connected to TARGET or TARGET not open, cannot verify that subset of tablespaces is self-contained
Skipping tablespace PDB01:USERS
Skipping tablespace PDB01:TEST
Skipping tablespace PDB01:TBSP_XTTS
Skipping tablespace PDB01:PDB01_USERS
Not connected to TARGET, cannot verify that set of tablespaces being duplicated does not have SYS objects
contents of Memory Script:
{
set until scn XXXX;
set newname for datafile 1 to
"///data_D-MYPDB_TS-SYSTEM_FNO-1";
set newname for datafile 3 to
"///data_D-MYPDB_TS-SYSAUX_FNO-3";
set newname for datafile 5 to
"///data_D-MYPDB_TS-SYSTEM_FNO-5";
set newname for datafile 6 to
"///data_D-MYPDB_TS-SYSAUX_FNO-6";
set newname for datafile 19 to
"///data_D-MYPDB_TS-UNDO_NEW_FNO-19";
set newname for datafile 115 to
"///data_D-MYPDB_TS-UNDO_SEED_FNO-115";
set newname for datafile 116 to
"///data_D-MYPDB_TS-UNDOTBS1_FNO-116";
set newname for datafile 121 to
"///data_D-MYPDB_TS-SYSTEM_FNO-121";
set newname for datafile 122 to
"///data_D-MYPDB_TS-SYSAUX_FNO-122";
set newname for datafile 123 to
"///data_D-MYPDB_TS-UNDOTBS1_FNO-123";
set newname for datafile 124 to
"///data_D-MYPDB_TS-UNDO_SEED_FNO-124";
set newname for datafile 125 to
"///data_D-MYPDB_TS-USERS_FNO-125";
set newname for datafile 127 to
"///data_D-MYPDB_TS-ABCD_FNO-127";
set newname for datafile 130 to
"///data_D-MYPDB_TS-TESTTBSP_FNO-130";
restore
clone database
skip forever tablespace "PDB01":"USERS",
"PDB01":"TEST",
"PDB01":"TBSP_XTTS",
"PDB01":"PDB01_USERS",
"PDB02":"UNDO_SEED",
"PDB02":"UNDOTBS1",
"PDB02":"SYSTEM",
"PDB02":"SYSAUX" ;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
...
channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00130 to ///data_D-MYPDB_TS-TESTTBSP_FNO-130
channel c1: reading from backup piece VB$_4108437090_356504I
channel c2: starting datafile backup set restore
channel c2: specifying datafile(s) to restore from backup set
channel c2: restoring datafile 00001 to ///data_D-MYPDB_TS-SYSTEM_FNO-1
channel c2: reading from backup piece VB$_4108437090_356522I
channel c3: starting datafile backup set restore
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00122 to ///data_D-MYPDB_TS-SYSAUX_FNO-122
channel c3: reading from backup piece VB$_4108437090_356531I
channel c1: piece handle=VB$_4108437090_356504I tag=TAG20230201T120419
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:01:30
channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00003 to ///data_D-MYPDB_TS-SYSAUX_FNO-3
channel c1: reading from backup piece VB$_4108437090_356542I
channel c3: piece handle=VB$_4108437090_356531I tag=TAG20230201T120419
channel c3: restored backup piece 1
channel c3: restore complete, elapsed time: 00:01:29
channel c3: starting datafile backup set restore
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00006 to ///data_D-MYPDB_TS-SYSAUX_FNO-6
channel c3: reading from backup piece VB$_4108437090_356558I
channel c3: piece handle=VB$_4108437090_356558I tag=TAG20230201T120419
channel c3: restored backup piece 1
channel c3: restore complete, elapsed time: 00:01:27
channel c3: starting datafile backup set restore
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00005 to ///data_D-MYPDB_TS-SYSTEM_FNO-5
channel c3: reading from backup piece VB$_4108437090_356567I
channel c2: piece handle=VB$_4108437090_356522I tag=TAG20230201T120419
channel c2: restored backup piece 1
channel c2: restore complete, elapsed time: 00:04:24
channel c2: starting datafile backup set restore
channel c2: specifying datafile(s) to restore from backup set
channel c2: restoring datafile 00121 to ///data_D-MYPDB_TS-SYSTEM_FNO-121
channel c2: reading from backup piece VB$_4108437090_356576I
channel c3: piece handle=VB$_4108437090_356567I tag=TAG20230201T120419
channel c3: restored backup piece 1
channel c3: restore complete, elapsed time: 00:01:28
channel c3: starting datafile backup set restore
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00019 to ///data_D-MYPDB_TS-UNDO_NEW_FNO-19
channel c3: reading from backup piece VB$_4108437090_356589I
channel c3: piece handle=VB$_4108437090_356589I tag=TAG20230201T120419
channel c3: restored backup piece 1
channel c3: restore complete, elapsed time: 00:00:07
channel c3: starting datafile backup set restore
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00125 to ///data_D-MYPDB_TS-USERS_FNO-125
channel c3: reading from backup piece VB$_4108437090_356598I
channel c3: piece handle=VB$_4108437090_356598I tag=TAG20230201T120419
channel c3: restored backup piece 1
channel c3: restore complete, elapsed time: 00:00:08
channel c3: starting datafile backup set restore
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00115 to ///data_D-MYPDB_TS-UNDO_SEED_FNO-115
channel c3: reading from backup piece VB$_4108437090_356607I
channel c3: piece handle=VB$_4108437090_356607I tag=TAG20230201T120419
channel c3: restored backup piece 1
channel c3: restore complete, elapsed time: 00:00:08
channel c3: starting datafile backup set restore
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00116 to ///data_D-MYPDB_TS-UNDOTBS1_FNO-116
channel c3: reading from backup piece VB$_4108437090_356613I
channel c3: piece handle=VB$_4108437090_356613I tag=TAG20230201T120419
channel c3: restored backup piece 1
channel c3: restore complete, elapsed time: 00:00:07
channel c3: starting datafile backup set restore
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00124 to ///data_D-MYPDB_TS-UNDO_SEED_FNO-124
channel c3: reading from backup piece VB$_4108437090_356624I
channel c3: piece handle=VB$_4108437090_356624I tag=TAG20230201T120419
channel c3: restored backup piece 1
channel c3: restore complete, elapsed time: 00:00:09
channel c3: starting datafile backup set restore
channel c3: specifying datafile(s) to restore from backup set
channel c3: restoring datafile 00123 to ///data_D-MYPDB_TS-UNDOTBS1_FNO-123
channel c3: reading from backup piece VB$_4108437090_356631I
channel c2: piece handle=VB$_4108437090_356576I tag=TAG20230201T120419
channel c2: restored backup piece 1
channel c2: restore complete, elapsed time: 00:01:07
channel c2: starting datafile backup set restore
channel c2: specifying datafile(s) to restore from backup set
channel c2: restoring datafile 00127 to ///data_D-MYPDB_TS-ABCD_FNO-127
channel c2: reading from backup piece VB$_4108437090_356682I
channel c3: piece handle=VB$_4108437090_356631I tag=TAG20230201T120419
channel c3: restored backup piece 1
channel c3: restore complete, elapsed time: 00:00:26
channel c2: piece handle=VB$_4108437090_356682I tag=TAG20230201T120419
channel c2: restored backup piece 1
channel c2: restore complete, elapsed time: 00:00:08
channel c1: piece handle=VB$_4108437090_356542I tag=TAG20230201T120419
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:04:59
Finished restore at
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=15 STAMP=1127652916 file name=///data_D-MYPDB_TS-SYSTEM_FNO-1
datafile 3 switched to datafile copy
input datafile copy RECID=16 STAMP=1127652917 file name=///data_D-MYPDB_TS-SYSAUX_FNO-3
datafile 5 switched to datafile copy
input datafile copy RECID=17 STAMP=1127652917 file name=///data_D-MYPDB_TS-SYSTEM_FNO-5
datafile 6 switched to datafile copy
input datafile copy RECID=18 STAMP=1127652917 file name=///data_D-MYPDB_TS-SYSAUX_FNO-6
datafile 19 switched to datafile copy
input datafile copy RECID=19 STAMP=1127652917 file name=///data_D-MYPDB_TS-UNDO_NEW_FNO-19
datafile 115 switched to datafile copy
input datafile copy RECID=20 STAMP=1127652917 file name=///data_D-MYPDB_TS-UNDO_SEED_FNO-115
datafile 116 switched to datafile copy
input datafile copy RECID=21 STAMP=1127652917 file name=///data_D-MYPDB_TS-UNDOTBS1_FNO-116
datafile 121 switched to datafile copy
input datafile copy RECID=22 STAMP=1127652917 file name=///data_D-MYPDB_TS-SYSTEM_FNO-121
datafile 122 switched to datafile copy
input datafile copy RECID=23 STAMP=1127652917 file name=///data_D-MYPDB_TS-SYSAUX_FNO-122
datafile 123 switched to datafile copy
input datafile copy RECID=24 STAMP=1127652917 file name=///data_D-MYPDB_TS-UNDOTBS1_FNO-123
datafile 124 switched to datafile copy
input datafile copy RECID=25 STAMP=1127652917 file name=///data_D-MYPDB_TS-UNDO_SEED_FNO-124
datafile 125 switched to datafile copy
input datafile copy RECID=26 STAMP=1127652917 file name=///data_D-MYPDB_TS-USERS_FNO-125
datafile 127 switched to datafile copy
input datafile copy RECID=27 STAMP=1127652917 file name=///data_D-MYPDB_TS-ABCD_FNO-127
datafile 130 switched to datafile copy
input datafile copy RECID=28 STAMP=1127652917 file name=///data_D-MYPDB_TS-TESTTBSP_FNO-130
contents of Memory Script:
{
set until time "to_date('XXX XX XXXX XX:XX:XX', 'MON DD YYYY HH24:MI:SS')";
recover
clone database
skip forever tablespace "PDB01":"USERS",
"PDB01":"TEST",
"PDB01":"TBSP_XTTS",
"PDB01":"PDB01_USERS",
"PDB02":"UNDO_SEED",
"PDB02":"UNDOTBS1",
"PDB02":"SYSTEM",
"PDB02":"SYSAUX" delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at
Executing: alter database datafile 145, 146, 147, 148 offline drop
Executing: alter database datafile 126, 129, 131, 149 offline drop
starting media recovery
archived log for thread 1 with sequence 113 is already on disk as file /refresh/home/app/19.3.0.0/oracle/oradata/orcl19cdb/arch/1_113_1126183346.dbf
archived log for thread 1 with sequence 114 is already on disk as file /refresh/home/app/19.3.0.0/oracle/oradata/orcl19cdb/arch/1_114_1126183346.dbf
archived log for thread 1 with sequence 115 is already on disk as file /refresh/home/app/19.3.0.0/oracle/oradata/orcl19cdb/arch/1_115_1126183346.dbf
archived log for thread 1 with sequence 116 is already on disk as file /refresh/home/app/19.3.0.0/oracle/oradata/orcl19cdb/arch/1_116_1126183346.dbf
archived log file name=//1_47_1122568973.dbf thread=1 sequence=47
archived log file name=//1_113_1126183346.dbf thread=1 sequence=113
archived log file name=//1_47_1122568973.dbf thread=1 sequence=47
archived log file name=//1_114_1126183346.dbf thread=1 sequence=114
archived log file name=//1_47_1122568973.dbf thread=1 sequence=47
archived log file name=/1_115_1126183346.dbf thread=1 sequence=115
archived log file name=/1_116_1126183346.dbf thread=1 sequence=116
media recovery complete, elapsed time: 00:00:02
Finished recover at
released channel: c1
...
Oracle instance started
.
Total System Global Area 838858864 bytes
.
Fixed Size 9140336 bytes
Variable Size 226492416 bytes
Database Buffers 599785472 bytes
Redo Buffers 3440640 bytes
.
contents of Memory Script:
{
sql clone "alter system set db_name =
'''' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset db_unique_name scope=spfile";
}
executing Memory Script

sql statement: alter system set db_name = '''' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset db_unique_name scope=spfile
Oracle instance started

Total System Global Area 838858864 bytes

Fixed Size 9140336 bytes
Variable Size 226492416 bytes
Database Buffers 599785472 bytes
Redo Buffers 3440640 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "" RESETLOGS ARCHIVELOG
MAXLOGFILES 50
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 21 SIZE 100 M ,
GROUP 22 SIZE 100 M ,
GROUP 23 SIZE 100 M
DATAFILE
'//data_D-MYPDB_TS-SYSTEM_FNO-1',
'//data_D-MYPDB_TS-SYSTEM_FNO-5',
'//data_D-MYPDB_TS-SYSTEM_FNO-121'
CHARACTER SET AL32UTF8

contents of Memory Script:
{
set newname for tempfile 1 to
"//data_D-MYPDB_TS-TEMP_FNO-1";
set newname for tempfile 2 to
"//data_D-MYPDB_TS-TEMP_FNO-2";
set newname for tempfile 7 to
"//data_D-MYPDB_TS-TEMP_FNO-7";
switch clone tempfile all;
catalog clone datafilecopy "///data_D-MYPDB_TS-SYSAUX_FNO-3",
"//data_D-MYPDB_TS-SYSAUX_FNO-6",
"//data_D-MYPDB_TS-UNDO_NEW_FNO-19",
"//data_D-MYPDB_TS-UNDO_SEED_FNO-115",
"//data_D-MYPDB_TS-UNDOTBS1_FNO-116",
"//data_D-MYPDB_TS-SYSAUX_FNO-122",
"//data_D-MYPDB_TS-UNDOTBS1_FNO-123",
"//data_D-MYPDB_TS-UNDO_SEED_FNO-124",
"//data_D-MYPDB_TS-USERS_FNO-125",
"//data_D-MYPDB_TS-ABCD_FNO-127",
"//data_D-MYPDB_TS-TESTTBSP_FNO-130";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
...
renamed tempfile 1 to //data_D-MYPDB_TS-TEMP_FNO-1 in control file
renamed tempfile 2 to //data_D-MYPDB_TS-TEMP_FNO-2 in control file
renamed tempfile 7 to //data_D-MYPDB_TS-TEMP_FNO-7 in control file
renamed tempfile 3 to //data_D-MYPDB_TS-TEMP_FNO-3 in control file
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-SYSAUX_FNO-3 RECID=1 STAMP=1127653003
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-SYSAUX_FNO-6 RECID=2 STAMP=1127653003
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-UNDO_NEW_FNO-19 RECID=3 STAMP=1127653003
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-UNDO_SEED_FNO-115 RECID=4 STAMP=1127653003
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-UNDOTBS1_FNO-116 RECID=5 STAMP=1127653003
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-SYSAUX_FNO-122 RECID=6 STAMP=1127653003
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-UNDOTBS1_FNO-123 RECID=7 STAMP=1127653003
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-UNDO_SEED_FNO-124 RECID=8 STAMP=1127653003
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-USERS_FNO-125 RECID=9 STAMP=1127653003
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-ABCD_FNO-127 RECID=10 STAMP=1127653003
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-TESTTBSP_FNO-130 RECID=11 STAMP=1127653003
datafile 3 switched to datafile copy
input datafile copy RECID=1 STAMP=1127653003 file name=///data_D-MYPDB_TS-SYSAUX_FNO-3
datafile 6 switched to datafile copy
input datafile copy RECID=2 STAMP=1127653003 file name=///data_D-MYPDB_TS-SYSAUX_FNO-6
datafile 19 switched to datafile copy
input datafile copy RECID=3 STAMP=1127653003 file name=///data_D-MYPDB_TS-UNDO_NEW_FNO-19
datafile 115 switched to datafile copy
input datafile copy RECID=4 STAMP=1127653003 file name=///data_D-MYPDB_TS-UNDO_SEED_FNO-115
datafile 116 switched to datafile copy
input datafile copy RECID=5 STAMP=1127653003 file name=///data_D-MYPDB_TS-UNDOTBS1_FNO-116
datafile 122 switched to datafile copy
input datafile copy RECID=6 STAMP=1127653003 file name=///data_D-MYPDB_TS-SYSAUX_FNO-122
datafile 123 switched to datafile copy
input datafile copy RECID=7 STAMP=1127653003 file name=///data_D-MYPDB_TS-UNDOTBS1_FNO-123
datafile 124 switched to datafile copy
input datafile copy RECID=8 STAMP=1127653003 file name=///data_D-MYPDB_TS-UNDO_SEED_FNO-124
datafile 125 switched to datafile copy
input datafile copy RECID=9 STAMP=1127653003 file name=///data_D-MYPDB_TS-USERS_FNO-125
datafile 127 switched to datafile copy
input datafile copy RECID=10 STAMP=1127653003 file name=///data_D-MYPDB_TS-ABCD_FNO-127
datafile 130 switched to datafile copy
input datafile copy RECID=11 STAMP=1127653003 file name=///data_D-MYPDB_TS-TESTTBSP_FNO-130
Reenabling controlfile options for auxiliary database
Executing: alter database force logging
contents of Memory Script:
{
sql clone 'alter system set "_system_trig_enabled"=FALSE';
Alter clone database open resetlogs;
sql clone 'alter system reset "_system_trig_enabled"';
}
executing Memory Script
sql statement: alter system set "_system_trig_enabled"=FALSE
database opened
PL/SQL package SYS.DBMS_BACKUP_RESTORE version 19.14.00.00 in AUXILIARY database is not current
PL/SQL package SYS.DBMS_RCVMAN version 19.14.00.00 in AUXILIARY database is not current
sql statement: alter system reset "_system_trig_enabled"
Executing: drop pluggable database "PDB02" including datafiles
contents of Memory Script:
{
sql clone "alter pluggable database all open";
}
executing Memory Script
sql statement: alter pluggable database all open
Dropping offline and skipped tablespaces
Executing: drop tablespace "USERS" including contents cascade constraints
Executing: drop tablespace "TEST" including contents cascade constraints
Executing: drop tablespace "TBSP_XTTS" including contents cascade constraints
Executing: drop tablespace "PDB01_USERS" including contents cascade constraints
Cannot remove created server parameter file
Finished Duplicate Db at

RMAN>

 Now check the PDB details 

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
5 PDB01 READ WRITE NO
SQL>

RMAN> report schema;

using target database control file instead of recovery catalog
Report of database schema for database with db_unique_name MYPDB

List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 1230 SYSTEM YES //data_D-MYPDB_TS-SYSTEM_FNO-1
3 1610 SYSAUX NO />/data_D-MYPDB_TS-SYSAUX_FNO-3
5 360 PDB$SEED:SYSTEM NO //data_D-MYPDB_TS-SYSTEM_FNO-5
6 450 PDB$SEED:SYSAUX NO //data_D-MYPDB_TS-SYSAUX_FNO-6
19 300 UNDO_NEW YES //data_D-MYPDB_TS-UNDO_NEW_FNO-19
115 100 PDB$SEED:UNDO_SEED NO //data_D-MYPDB_TS-UNDO_SEED_FNO-115
116 100 PDB$SEED:UNDOTBS1 NO //data_D-MYPDB_TS-UNDOTBS1_FNO-116
121 380 PDB01:SYSTEM NO //data_D-MYPDB_TS-SYSTEM_FNO-121
122 540 PDB01:SYSAUX NO //data_D-MYPDB_TS-SYSAUX_FNO-122
123 100 PDB01:UNDOTBS1 NO //data_D-MYPDB_TS-UNDOTBS1_FNO-123
124 100 PDB01:UNDO_SEED NO //data_D-MYPDB_TS-UNDO_SEED_FNO-124
125 100 USERS NO ///data_D-MYPDB_TS-USERS_FNO-125
127 50 PDB01:ABCD NO //data_D-MYPDB_TS-ABCD_FNO-127
130 1600 TESTTBSP NO //data_D-MYPDB_TS-TESTTBSP_FNO-130

List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 300 TEMP 300 ///data_D-MYPDB_TS-TEMP_FNO-1
2 200 TEMP 200 ///data_D-MYPDB_TS-TEMP_FNO-2
3 100 PDB01:TEMP 100 ///data_D-MYPDB_TS-TEMP_FNO-3
7 100 PDB$SEED:TEMP 100 ///data_D-MYPDB_TS-TEMP_FNO-7

RMAN> 

HOW TO PERFORM RMAN PARTIAL DUPLICATE SKIPPING NOT REQUIRED TABLESPACES FROM TAPE/ZDLRA BACKUP (Doc ID 2914588.1) ​编辑To Bottom

恢复数据库 NBU ZDLRA Backup_第3张图片


恢复数据库 NBU ZDLRA Backup_第4张图片

In this Document

Goal
Solution
References

APPLIES TO:

Oracle Database - Enterprise Edition - Version 12.2.0.1 and later
Information in this document applies to any platform.

GOAL

For duplicate partial database skipping not required tablespace to new database using Tape/ZDLRA backups.This doc is useful incase of skipping only those tablespace name which are not needed while Duplicate.
In this doc one can include only those tablespaces which are not needed for business data.By default, RMAN duplicates the root and the seed database of the CDB that contains the listed PDBs.
In this doc, after duplicate new CDB is created with required tabelspace (and root and the seed database of the CDB).
This doc can also useful incase of PITR restore / recovery of Multi Tenant database to extract information from the dropped / truncated tables of specific PDB.

SOLUTION

 
NOTE: In the images and/or the document content below, the user information and environment data used represents fictitious data from the Oracle sample schema(s), Public Documentation delivered with an Oracle database product or other training material. 
Any similarity to actual environments, actual persons, living or dead, is purely coincidental and not intended in any manner.
For the purposes of this document, the following fictitious environment is used as an example to describe the procedure:
 
DEST_TNS                    : Destination database TNS Alias.
DEST_DB_NAME                : Destination database name.
DEST_PATH                   : Path of CDB and PDb datafiles in Destination database.
PDB01                       : Pluggable database name which needs to be duplicate from source CDB.ss
SKIPPED_TABLESPACE          : Tablespace name or list which needs to be skipped from required Pluggable database .
ABCD                        : This is the tablespace_name which is required tablespace for PDB which we inetrested for restore/recover.
BACKUP_LOCATION             : Path of Source database backup.
SOURCE_DB_NAME              : Source database name
DEST_DB_UNIQUE_NAME         : Destination database DB_UNIQUE_NAME
DEST_SID                    : Destination database ORACLE_SID
SOURCE_DB_UNIQUE_NAME       : Source DB_UNIQUE_NAME.
SOURCE_DB_DATAFILE_LOCATION : Path of CDB and PDb datafiles in Destination database.
--In destination server ensure client for MML is installed
--For ZDLRA ensure :
wallet is created for access source db VPC owner.
Valid libra.so copied to destination server
Make necessary changes to sqlnet.ora for WALLET_LOCATION

On the destination DB parameter file :

-- set db_create_file_dest for destination datafile path
-- set db_create_online_log_dest_1 for destination db Online Redo Log File Path.
-- set DB_UNIQUE_NAME for destination database DB_UNIQUE_NAME

On the destination Server :

-- set the ORACLE_SID and bring the database to nomount stage.
-- restore the spfile from backup and create pfile from it.

PDB01_USERS tablespace we are Skipping in below example.

When Duplicate finished, it will only restore root,PDB$SEED,PDB01 and it will skip PDB01:PDB01_USERS tablespace.
New Db will include root,PDB$SEED,PDB01 excluding PDB01_USERS tablespace.

-- Below is Source Database REPORT SCHEMA

RMAN> report schema;

Report of database schema for database with db_unique_name

List of Permanent Datafiles
===========================
File Size(MB) Tablespace RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1 1080 SYSTEM YES //data_D-ORCL19CD_TS-SYSTEM_FNO-1
3 1470 SYSAUX NO //data_D-ORCL19CD_TS-SYSAUX_FNO-3
5 360 PDB$SEED:SYSTEM NO //pdbseed/data_D-ORCL19CD_TS-SYSTEM_FNO-5
6 450 PDB$SEED:SYSAUX NO //pdbseed/data_D-ORCL19CD_TS-SYSAUX_FNO-6
19 300 UNDO_NEW YES //data_D-ORCL19CD_TS-UNDO_NEW_FNO-19
115 100 PDB$SEED:UNDO_SEED NO ///../o1_mf_undo_see_krtq53jm_.dbf
116 100 PDB$SEED:UNDOTBS1 NO ///../o1_mf_undotbs1_krtq6r09_.dbf
117 360 PDB02:SYSTEM NO ///../o1_mf_system_krtqh73b_.dbf
118 450 PDB02:SYSAUX NO ///../o1_mf_sysaux_krtqh73d_.dbf
119 100 PDB02:UNDOTBS1 NO ///../o1_mf_undotbs1_krtqh73f_.dbf
120 100 PDB02:UNDO_SEED NO ///../o1_mf_undo_see_krtqh73f_.dbf
121 360 PDB01:SYSTEM NO ///../o1_mf_system_krtqkjh9_.dbf
122 460 PDB01:SYSAUX NO ///../o1_mf_sysaux_krtqkjhd_.dbf
123 100 PDB01:UNDOTBS1 NO ///../o1_mf_undotbs1_krtqkjhf_.dbf
124 100 PDB01:UNDO_SEED NO ///../o1_mf_undo_see_krtqkjhh_.dbf
125 100 USERS NO ///../o1_mf_users_krtqplgg_.dbf
126 100 PDB01:PDB01_USERS NO ///../o1_mf_pdb01_us_krtqs8vb_.dbf
127 50 PDB01:ABCD NO ///../o1_mf_abcd_krtqt7q2_.dbf
128 50 PDB02:PDBO2_USERS NO ///../o1_mf_pdbo2_us_krtr0rgg_.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 300 TEMP 300 ///datafile/o1_mf_temp_krsmjlmb_.tmp
2 200 TEMP 200 ///datafile/o1_mf_temp_krsmjlkw_.tmp
3 100 PDB01:TEMP 100 ///../o1_mf_temp_krtqmqkz_.tmp
4 100 PDB02:TEMP 100 ///../o1_mf_temp_krtqn4xb_.tmp
7 100 PDB$SEED:TEMP 100 ///../o1_mf_temp_krtqnhgm_.tmp

In destination database need to connect with auxiliary (without target connection) and catalog .

Here we used ZDLRA catalog.

In below syntax we need to mention pluggable database name which needs after duplicate and skip Tablespace Name which are not needed while Duplicate.

In below example, used "set newname for database".(For ASM, we can give only DISK_GROUP name)

"set newname for database" at RMAN run block will have precedence over init/spfile parameters.

RMAN syntax is like below example :

rman auxiliary 'sys/XXX$'@DEST_TNS catalog /@ <==In case of NON ZDLRA, one can mention catalog user credentials.
set dbid ;
RMAN> run
{
set until time "to_date('XX-XX-XXX XX:XX:XX','dd-mm-yyyy hh24:mi:ss')";
set newname for database to '//%U';
allocate auxiliary channel c1 type sbt_tape parms "SBT_LIBRARY=//libra.so, ENV=(RA_WALLET=location=file:/ CREDENTIAL_ALIAS=) " FORMAT '%U_%D';
allocate auxiliary channel c2 type sbt_tape parms "SBT_LIBRARY=//libra.so, ENV=(RA_WALLET=location=file:/ CREDENTIAL_ALIAS=) " FORMAT '%U_%D';
allocate auxiliary channel c3 type sbt_tape parms "SBT_LIBRARY=//libra.so, ENV=(RA_WALLET=location=file:/ CREDENTIAL_ALIAS=) " FORMAT '%U_%D';
DUPLICATE DATABASE TO pluggable database pdb01,root
SKIP TABLESPACE :;
}

 
rman auxiliary 'sys/XXX$'@DEST_TNS catalog /@ <==In case of NON ZDLRA, one can mention catalog user credentials.
set dbid ;
RMAN> run
{
set until time "to_date('XX-XX-XXX XX:XX:XX','dd-mm-yyyy hh24:mi:ss')";
set newname for database to '//%U';
allocate auxiliary channel c1 type sbt_tape parms "SBT_LIBRARY=//libra.so, ENV=(RA_WALLET=location=file:/ CREDENTIAL_ALIAS=) " FORMAT '%U_%D';
allocate auxiliary channel c2 type sbt_tape parms "SBT_LIBRARY=//libra.so, ENV=(RA_WALLET=location=file:/ CREDENTIAL_ALIAS=) " FORMAT '%U_%D';
allocate auxiliary channel c3 type sbt_tape parms "SBT_LIBRARY=//libra.so, ENV=(RA_WALLET=location=file:/ CREDENTIAL_ALIAS=) " FORMAT '%U_%D';
DUPLICATE DATABASE ORCL19CD TO mypdb pluggable database pdb01,root
SKIP TABLESPACE PDB01:PDB01_USERS;
}
...
allocated channel: c1
channel c1: SID=428 device type=SBT_TAPE
channel c1: RA Library (ZDLRA) SID=EF42066792092A97E0533432410A371F
allocated channel: c2
channel c2: SID=426 device type=SBT_TAPE
channel c2: RA Library (ZDLRA) SID=EF4214B9591D2B69E0533432410AA6ED
allocated channel: c3
channel c3: SID=429 device type=SBT_TAPE
channel c3: RA Library (ZDLRA) SID=EF4214F9B8752B6FE0533432410A77D6
executing command: SET until clause
executing command: SET NEWNAME
Starting Duplicate Db at
contents of Memory Script:
{
sql clone "create spfile from memory";
}
executing Memory Script
sql statement: create spfile from memory
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers
allocated channel: c1
channel c1: SID=424 device type=SBT_TAPE
channel c1: RA Library (ZDLRA) SID=EF421830B0072C0DE0533432410A6CF4
allocated channel: c2
channel c2: SID=428 device type=SBT_TAPE
channel c2: RA Library (ZDLRA) SID=EF421873691A2C13E0533432410AAC8F
allocated channel: c3
channel c3: SID=429 device type=SBT_TAPE
channel c3: RA Library (ZDLRA) SID=EF4218B7A70E2C19E0533432410AD17D
duplicating Online logs to Oracle Managed File (OMF) location
contents of Memory Script:
{
set until scn XXXX;
sql clone "alter system set db_name =
'''' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
'''' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile;
alter clone database mount;
}
executing Memory Script
executing command: SET until clause
sql statement: alter system set db_name = '''' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = '''' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers
allocated channel: c1
channel c1: SID=424 device type=SBT_TAPE
channel c1: RA Library (ZDLRA) SID=EF421B8206142CB3E0533432410A8C0D
allocated channel: c2
channel c2: SID=428 device type=SBT_TAPE
channel c2: RA Library (ZDLRA) SID=EF421BC7044A2CBDE0533432410ABB59
allocated channel: c3
channel c3: SID=429 device type=SBT_TAPE
channel c3: RA Library (ZDLRA) SID=EF421C0DA7F22CC9E0533432410A549D
Starting restore at 07-DEC-22
channel c1: starting datafile backup set restore
channel c1: restoring control file
channel c1: reading from backup piece c-3687178233-20221207-01
channel c1: piece handle=c-3687178233-20221207-01 tag=TAG20221207T180829
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:00:04
output file name=/refresh/home/app/19.3.0.0/oracle/oradata/mypdb/control01.ctl
output file name=/refresh/home/app/19.3.0.0/oracle/oradata/mypdb/control02.ctl
Finished restore at 07-DEC-22
database mounted
Skipping pluggable database PDB02
Not connected to TARGET or TARGET not open, cannot verify that subset of tablespaces is self-contained
Automatically adding tablespace PDB$SEED:SYSTEM
Automatically adding tablespace PDB$SEED:SYSAUX
Skipping tablespace PDB01:PDB01_USERS
Not connected to TARGET, cannot verify that set of tablespaces being duplicated does not have SYS objects
contents of Memory Script:
{
set until scn XXXX;
sql clone 'alter database flashback off';
set newname for datafile 1 to
"//data_D-MYPDB_TS-SYSTEM_FNO-1";
set newname for datafile 3 to
"//data_D-MYPDB_TS-SYSAUX_FNO-3";
set newname for datafile 5 to
"//data_D-MYPDB_TS-SYSTEM_FNO-5";
set newname for datafile 6 to
"//data_D-MYPDB_TS-SYSAUX_FNO-6";
set newname for datafile 19 to
"//data_D-MYPDB_TS-UNDO_NEW_FNO-19";
set newname for datafile 115 to
"//data_D-MYPDB_TS-UNDO_SEED_FNO-115";
set newname for datafile 116 to
"//data_D-MYPDB_TS-UNDOTBS1_FNO-116";
set newname for datafile 121 to
"//data_D-MYPDB_TS-SYSTEM_FNO-121";
set newname for datafile 122 to
"//data_D-MYPDB_TS-SYSAUX_FNO-122";
set newname for datafile 123 to
"//data_D-MYPDB_TS-UNDOTBS1_FNO-123";
set newname for datafile 124 to
"//data_D-MYPDB_TS-UNDO_SEED_FNO-124";
set newname for datafile 125 to
"//data_D-MYPDB_TS-USERS_FNO-125";
set newname for datafile 127 to
"//data_D-MYPDB_TS-ABCD_FNO-127";
restore
clone database
skip forever tablespace "PDB02":"UNDO_SEED",
"PDB02":"UNDOTBS1",
"PDB02":"SYSTEM",
"PDB02":"SYSAUX",
"PDB01":"PDB01_USERS",
"PDB02":"PDBO2_USERS" ;
}
executing Memory Script
executing command: SET until clause
sql statement: alter database flashback off
executing command: SET NEWNAME
executing command: SET NEWNAME
..
Starting restore at
..
channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00001 to //data_D-MYPDB_TS-SYSTEM_FNO-1
channel c1: reading from backup piece VB$_4108437090_331812_1
channel c2: starting datafile backup set restore
channel c2: specifying datafile(s) to restore from backup set
channel c2: restoring datafile 00006 to //data_D-MYPDB_TS-SYSAUX_FNO-6
channel c2: reading from backup piece VB$_4108437090_331825_6
..
channel c3: restore complete, elapsed time: 00:04:13
Finished restore at
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=14 STAMP=1122835011 file name=//data_D-MYPDB_TS-SYSTEM_FNO-1
datafile 3 switched to datafile copy
input datafile copy RECID=15 STAMP=1122835011 file name=//data_D-MYPDB_TS-SYSAUX_FNO-3
datafile 5 switched to datafile copy
input datafile copy RECID=16 STAMP=1122835011 file name=//data_D-MYPDB_TS-SYSTEM_FNO-5
datafile 6 switched to datafile copy
input datafile copy RECID=17 STAMP=1122835011 file name=//data_D-MYPDB_TS-SYSAUX_FNO-6
datafile 19 switched to datafile copy
input datafile copy RECID=18 STAMP=1122835012 file name=//data_D-MYPDB_TS-UNDO_NEW_FNO-19
datafile 115 switched to datafile copy
input datafile copy RECID=19 STAMP=1122835012 file name=//data_D-MYPDB_TS-UNDO_SEED_FNO-115
datafile 116 switched to datafile copy
input datafile copy RECID=20 STAMP=1122835012 file name=//data_D-MYPDB_TS-UNDOTBS1_FNO-116
datafile 121 switched to datafile copy
input datafile copy RECID=21 STAMP=1122835012 file name=//data_D-MYPDB_TS-SYSTEM_FNO-121
datafile 122 switched to datafile copy
input datafile copy RECID=22 STAMP=1122835012 file name=//data_D-MYPDB_TS-SYSAUX_FNO-122
datafile 123 switched to datafile copy
input datafile copy RECID=23 STAMP=1122835012 file name=//data_D-MYPDB_TS-UNDOTBS1_FNO-123
datafile 124 switched to datafile copy
input datafile copy RECID=24 STAMP=1122835012 file name=//data_D-MYPDB_TS-UNDO_SEED_FNO-124
datafile 125 switched to datafile copy
input datafile copy RECID=25 STAMP=1122835012 file name=//data_D-MYPDB_TS-USERS_FNO-125
datafile 127 switched to datafile copy
input datafile copy RECID=26 STAMP=1122835013 file name=//data_D-MYPDB_TS-ABCD_FNO-127
contents of Memory Script:
{
set until time "to_date('XXX XX XXXX XX:XX:XX', 'MON DD YYYY HH24:MI:SS')";
recover
clone database
skip forever tablespace "PDB02":"UNDO_SEED",
"PDB02":"UNDOTBS1",
"PDB02":"SYSTEM",
"PDB02":"SYSAUX",
"PDB01":"PDB01_USERS",
"PDB02":"PDBO2_USERS" delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 
Executing: alter database datafile 120 offline drop
Executing: alter database datafile 119 offline drop
Executing: alter database datafile 117 offline drop
Executing: alter database datafile 118 offline drop
Executing: alter database datafile 126 offline drop
Executing: alter database datafile 128 offline drop
starting media recovery
archived log for thread 1 with sequence 47 is already on disk as file /1_47_1122568973.dbf
archived log for thread 1 with sequence 48 is already on disk as file /1_48_1122568973.dbf
archived log file name=/1_47_1122568973.dbf thread=1 sequence=47
archived log file name=/1_48_1122568973.dbf thread=1 sequence=48
media recovery complete, elapsed time:
Finished recover at 07-DEC-22
released channel: c1
released channel: c2
released channel: c3
Oracle instance started
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers
contents of Memory Script:
{
sql clone "alter system set db_name =
'''' comment=
''Reset to original value by RMAN'' scope=spfile";
sql clone "alter system reset db_unique_name scope=spfile";
}
executing Memory Script
sql statement: alter system set db_name = '''' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset db_unique_name scope=spfile
Oracle instance started
Total System Global Area 838858856 bytes
Fixed Size 9140328 bytes
Variable Size 226492416 bytes
Database Buffers 599785472 bytes
Redo Buffers 3440640 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "" RESETLOGS ARCHIVELOG
MAXLOGFILES 50
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 21 SIZE 100 M ,
GROUP 22 SIZE 100 M ,
GROUP 23 SIZE 100 M
DATAFILE
'//data_D-MYPDB_TS-SYSTEM_FNO-1',
'//data_D-MYPDB_TS-SYSTEM_FNO-5',
'//data_D-MYPDB_TS-SYSTEM_FNO-121'
CHARACTER SET AL32UTF8
contents of Memory Script:
{
set newname for tempfile 1 to
"//data_D-MYPDB_TS-TEMP_FNO-1";
set newname for tempfile 2 to
"//data_D-MYPDB_TS-TEMP_FNO-2";
set newname for tempfile 3 to
"//data_D-MYPDB_TS-TEMP_FNO-3";
set newname for tempfile 7 to
"//data_D-MYPDB_TS-TEMP_FNO-7";
switch clone tempfile all;
catalog clone datafilecopy "//data_D-MYPDB_TS-SYSAUX_FNO-3",
"//data_D-MYPDB_TS-SYSAUX_FNO-6",
"//data_D-MYPDB_TS-UNDO_NEW_FNO-19",
"//data_D-MYPDB_TS-UNDO_SEED_FNO-115",
"//data_D-MYPDB_TS-UNDOTBS1_FNO-116",
"//data_D-MYPDB_TS-SYSAUX_FNO-122",
"//data_D-MYPDB_TS-UNDOTBS1_FNO-123",
"//data_D-MYPDB_TS-UNDO_SEED_FNO-124",
"//data_D-MYPDB_TS-USERS_FNO-125",
"//data_D-MYPDB_TS-ABCD_FNO-127";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
renamed tempfile 1 to //data_D-MYPDB_TS-TEMP_FNO-1 in control file
renamed tempfile 2 to //data_D-MYPDB_TS-TEMP_FNO-2 in control file
renamed tempfile 3 to //data_D-MYPDB_TS-TEMP_FNO-3 in control file
renamed tempfile 7 to //data_D-MYPDB_TS-TEMP_FNO-7 in control file
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-SYSAUX_FNO-3 RECID=1 STAMP=1122835107
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-SYSAUX_FNO-6 RECID=2 STAMP=1122835107
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-UNDO_NEW_FNO-19 RECID=3 STAMP=1122835107
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-UNDO_SEED_FNO-115 RECID=4 STAMP=1122835108
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-UNDOTBS1_FNO-116 RECID=5 STAMP=1122835108
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-SYSAUX_FNO-122 RECID=6 STAMP=1122835108
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-UNDOTBS1_FNO-123 RECID=7 STAMP=1122835108
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-UNDO_SEED_FNO-124 RECID=8 STAMP=1122835108
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-USERS_FNO-125 RECID=9 STAMP=1122835108
cataloged datafile copy
datafile copy file name=//data_D-MYPDB_TS-ABCD_FNO-127 RECID=10 STAMP=1122835108
datafile 3 switched to datafile copy
input datafile copy RECID=1 STAMP=1122835107 file name=//data_D-MYPDB_TS-SYSAUX_FNO-3
datafile 6 switched to datafile copy
input datafile copy RECID=2 STAMP=1122835107 file name=//data_D-MYPDB_TS-SYSAUX_FNO-6
datafile 19 switched to datafile copy
input datafile copy RECID=3 STAMP=1122835107 file name=//data_D-MYPDB_TS-UNDO_NEW_FNO-19
datafile 115 switched to datafile copy
input datafile copy RECID=4 STAMP=1122835108 file name=//data_D-MYPDB_TS-UNDO_SEED_FNO-115
datafile 116 switched to datafile copy
input datafile copy RECID=5 STAMP=1122835108 file name=//data_D-MYPDB_TS-UNDOTBS1_FNO-116
datafile 122 switched to datafile copy
input datafile copy RECID=6 STAMP=1122835108 file name=//data_D-MYPDB_TS-SYSAUX_FNO-122
datafile 123 switched to datafile copy
input datafile copy RECID=7 STAMP=1122835108 file name=//data_D-MYPDB_TS-UNDOTBS1_FNO-123
datafile 124 switched to datafile copy
input datafile copy RECID=8 STAMP=1122835108 file name=//data_D-MYPDB_TS-UNDO_SEED_FNO-124
datafile 125 switched to datafile copy
input datafile copy RECID=9 STAMP=1122835108 file name=//data_D-MYPDB_TS-USERS_FNO-125
datafile 127 switched to datafile copy
input datafile copy RECID=10 STAMP=1122835108 file name=//data_D-MYPDB_TS-ABCD_FNO-127
Reenabling controlfile options for auxiliary database
Executing: alter database force logging
contents of Memory Script:
{
sql clone 'alter system set "_system_trig_enabled"=FALSE';
Alter clone database open resetlogs;
sql clone 'alter system reset "_system_trig_enabled"';
}
executing Memory Script
sql statement: alter system set "_system_trig_enabled"=FALSE
database opened
sql statement: alter system reset "_system_trig_enabled"
Executing: alter database flashback on
Executing: drop pluggable database "PDB02" including datafiles
contents of Memory Script:
{
sql clone "alter pluggable database all open";
}
executing Memory Script
...
RMAN>

Now check the PDB details

SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
5 PDB01 READ WRITE YES

Now check the required data and can take export backup of required tables if needed

你可能感兴趣的:(oracle)