12c PDB backup and recovery



The first thing i want to really find out after the initial database creation with a new version is how does that affect my backup/restore strategy - this is the most important job the DBA has - making sure that the database can always be raised from the dead.

With the change to multitenant there are loads of new things to try out but i thought initially i just try a relatively simple full backup and restore of a PDB.

Now this needs a little thought - with the new architecture redo is shared between everything in the container but rman lets us backup a pdb seemingly 'on its own'. The syntax lets us do this and indeed it will backup the datafiles belonging to the pdb but in the event you need to restore you will need the files from the shared redo stream of course,

Anyway here is a simple demo of a backup and restore of a pdb - as everything is so small and i didnt do much there to no mention of archive redo and recover just needs online redo which doesnt really get mentioned.

Lets backup a PDB called TEST

RMAN> backup pluggable database 'TEST';

Starting backup at 22-JAN-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=/oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_sysaux_9g0d93lt_.dbf
input datafile file number=00006 name=/oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_system_9g0d93ls_.dbf
channel ORA_DISK_1: starting piece 1 at 22-JAN-14
channel ORA_DISK_1: finished piece 1 at 22-JAN-14
piece handle=/oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/backupset/2014_01_22/o1_mf_nnndf_TAG20140122T210829_9g0dtftz_.bkp tag=TAG20140122T210829 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 22-JAN-14

Starting Control File and SPFILE Autobackup at 22-JAN-14
piece handle=/oracle/ENDCON/oradata/DEMO/autobackup/2014_01_22/o1_mf_s_837551316_9g0dto4d_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 22-JAN-14


Then try and restore it

RMAN> restore pluggable database 'TEST';

Starting restore at 22-JAN-14
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00006 to /oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_system_9g0d93ls_.dbf
channel ORA_DISK_1: restoring datafile 00007 to /oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_sysaux_9g0d93lt_.dbf
channel ORA_DISK_1: reading from backup piece /oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/backupset/2014_01_22/o1_mf_nnndf_TAG20140122T210829_9g0dtftz_.bkp
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 01/22/2014 21:10:50
ORA-19870: error while restoring backup piece /oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/backupset/2014_01_22/o1_mf_nnndf_TAG20140122T210829_9g0dtftz_.bkp
ORA-19573: cannot obtain exclusive enqueue for datafile 7


And we cant as the PDB is still open and has locks/enqueues open on the files

Lets close it


RMAN> alter pluggable database 'TEST' close;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of sql statement command at 01/22/2014 21:11:28
RMAN-00600: internal error, arguments [7530] [] [] [] []

RMAN> exit


Hmm that didnt work....

Lets try sqlplus

SQL> alter pluggable database 'TEST' close;
alter pluggable database 'TEST' close
                         *
ERROR at line 1:
ORA-65000: missing or invalid pluggable database name


Ah OK - so i shouldnt have quoted it - lets try again in rman (think the error throwing is a minor bug)

RMAN> alter pluggable database TEST close;

using target database control file instead of recovery catalog
Statement processed


Now restore

RMAN> restore pluggable database 'TEST';

Starting restore at 22-JAN-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=502 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00006 to /oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_system_9g0d93ls_.dbf
channel ORA_DISK_1: restoring datafile 00007 to /oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_sysaux_9g0d93lt_.dbf
channel ORA_DISK_1: reading from backup piece /oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/backupset/2014_01_22/o1_mf_nnndf_TAG20140122T210829_9g0dtftz_.bkp
channel ORA_DISK_1: piece handle=/oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/backupset/2014_01_22/o1_mf_nnndf_TAG20140122T210829_9g0dtftz_.bkp tag=TAG20140122T210829
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 22-JAN-14


ANd recover

RMAN> recover pluggable database 'TEST';

Starting recover at 22-JAN-14
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 22-JAN-14


This generates new 'stuff' in the alert log

alter pluggable database TEST close
ALTER SYSTEM: Flushing buffer cache inst=0 container=3 local
Pluggable database TEST closed
Completed: alter pluggable database TEST close
2014-01-22 21:12:24.353000 +00:00
Full restore complete of datafile 6 /oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_system_9g0d93ls_.dbf.  Elapsed time: 0:00:01
  checkpoint is 1802334
2014-01-22 21:12:25.557000 +00:00
Full restore complete of datafile 7 /oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_sysaux_9g0d93lt_.dbf.  Elapsed time: 0:00:02
  checkpoint is 1802334
  last deallocation scn is 1365681
2014-01-22 21:12:45.210000 +00:00
alter database recover datafile list clear
Completed: alter database recover datafile list clear
alter database recover if needed
 datafile 6 , 7
Media Recovery Start
Serial Media Recovery started
Recovery of Online Redo Log: Thread 1 Group 2 Seq 78 Reading mem 0
  Mem# 0: /oracle/ENDCON/oradata/DEMO/onlinelog/o1_mf_2_9fx3jco1_.log
Media Recovery Complete (DEMO)
Completed: alter database recover if needed
 datafile 6 , 7


The database is all done but is not open for use so lets do that

SQL> sho pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 TEST                           MOUNTED
SQL> alter pluggable database test open;

Pluggable database altered.

SQL>


And there we have it - nice and simple

For bonus points i decided to do a PDBPITR as I'm calling it (restoring a PDB to a previous point in time - needs something catchier i feel).

Lets try out that syntax

RMAN>  recover pluggable database 'TEST' until scn 1802623;

Starting recover at 22-JAN-14
current log archived
using channel ORA_DISK_1
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 SYS_UNDOTS

Creating automatic instance, with SID='nzFz'

initialization parameters used for automatic instance:
db_name=DEMO
db_unique_name=nzFz_pitr_TEST_DEMO
compatible=12.0.0
db_block_size=8192
db_files=200
sga_target=1G
processes=80
diagnostic_dest=/oracle
#No auxiliary destination in use
enable_pluggable_database=true
_clone_one_pdb_recovery=true
control_files=/oracle/ENDCON/oradata/DEMO/controlfile/o1_mf_9g0frfnp_.ctl
#No auxiliary parameter file used


starting up automatic instance DEMO

Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2296576 bytes
Variable Size                293602560 bytes
Database Buffers             767557632 bytes
Redo Buffers                   5480448 bytes
Automatic instance created

contents of Memory Script:
{
# set requested point in time
set until  scn 1802623;
# restore the controlfile
restore clone controlfile;
# mount the controlfile
sql clone 'alter database mount clone database';
}
executing Memory Script

executing command: SET until clause

Starting restore at 22-JAN-14
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=128 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /oracle/ENDCON/oradata/DEMO/autobackup/2014_01_22/o1_mf_s_837551316_9g0dto4d_.bkp
channel ORA_AUX_DISK_1: piece handle=/oracle/ENDCON/oradata/DEMO/autobackup/2014_01_22/o1_mf_s_837551316_9g0dto4d_.bkp tag=TAG20140122T210836
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/oracle/ENDCON/oradata/DEMO/controlfile/o1_mf_9g0frfnp_.ctl
Finished restore at 22-JAN-14

sql statement: alter database mount clone database

contents of Memory Script:
{
# set requested point in time
set until  scn 1802623;
# switch to valid datafilecopies
switch clone datafile  6 to datafilecopy
 "/oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_system_9g0d93ls_.dbf";
switch clone datafile  7 to datafilecopy
 "/oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_sysaux_9g0d93lt_.dbf";
# set destinations for recovery set and auxiliary set datafiles
set newname for datafile  1 to
 "/oracle/ENDCON/oradata/DEMO/datafile/o1_mf_system_9g0frnxl_.dbf";
set newname for datafile  5 to
 "/oracle/ENDCON/oradata/DEMO/datafile/o1_mf_sys_undo_9g0frnxt_.dbf";
set newname for datafile  3 to
 "/oracle/ENDCON/oradata/DEMO/datafile/o1_mf_sysaux_9g0frny0_.dbf";
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile  1, 5, 3;
switch clone datafile all;
}
executing Memory Script

executing command: SET until clause

datafile 6 switched to datafile copy
input datafile copy RECID=1 STAMP=837552282 file name=/oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_system_9g0d93ls_.dbf

datafile 7 switched to datafile copy
input datafile copy RECID=2 STAMP=837552282 file name=/oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_sysaux_9g0d93lt_.dbf

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 22-JAN-14
using channel ORA_AUX_DISK_1

creating datafile file number=1 name=/oracle/ENDCON/oradata/DEMO/datafile/o1_mf_system_9g0frnxl_.dbf

Removing automatic instance
shutting down automatic instance
Oracle instance shut down
Automatic instance removed
auxiliary instance file /oracle/ENDCON/oradata/DEMO/controlfile/o1_mf_9g0frfnp_.ctl deleted
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 01/22/2014 21:24:44
RMAN-03015: error occurred in stored script Memory Script
RMAN-06136: ORACLE error from auxiliary database: ORA-01180: can not create datafile 1
ORA-01110: data file 1: '/oracle/ENDCON/oradata/DEMO/datafile/o1_mf_system_9fx3jdfl_.dbf'

RMAN>


And we can see it has failed as it wants to overwrite the CDB system datafile - which of course is in use. This is an important thing to understand - in much the same way as you cant directly do a point in time recovery of a tablespace directly in a database the same is true of a PDB.

The way it gets round this is the same as for tablespace point in time recovery - a whole new database has to be created and a subset of the original restored to that - this is then recovered using the shared archive to the correct point in time and then plugged back in to the original.

However when i try again it still fails with the same error.

What has happened is (and the error is not that great) is that i have not backed up the CDB at all so there is no old copy of the CDB datafiles from before the scn i want to restore to the aux instance.

Lets do a full backup and choose an SCN just after that to restore to.

RMAN> backup database;

Starting backup at 22-JAN-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/oracle/ENDCON/oradata/DEMO/datafile/o1_mf_sys_undo_9fx3jk19_.dbf
input datafile file number=00003 name=/oracle/ENDCON/oradata/DEMO/datafile/o1_mf_sysaux_9fx3jhv7_.dbf
input datafile file number=00001 name=/oracle/ENDCON/oradata/DEMO/datafile/o1_mf_system_9fx3jdfl_.dbf
channel ORA_DISK_1: starting piece 1 at 22-JAN-14
channel ORA_DISK_1: finished piece 1 at 22-JAN-14
piece handle=/oracle/ENDCON/oradata/DEMO/backupset/2014_01_22/o1_mf_nnndf_TAG20140122T214355_9g0gwvdk_.bkp tag=TAG20140122T214355 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/oracle/ENDCON/oradata/DEMO/F07D6AFD0AD613A4E0430200007F615E/datafile/o1_mf_sysaux_9fx3jj6p_.dbf
input datafile file number=00002 name=/oracle/ENDCON/oradata/DEMO/F07D6AFD0AD613A4E0430200007F615E/datafile/o1_mf_system_9fx3jf1g_.dbf
channel ORA_DISK_1: starting piece 1 at 22-JAN-14
channel ORA_DISK_1: finished piece 1 at 22-JAN-14
piece handle=/oracle/ENDCON/oradata/DEMO/F07D6AFD0AD613A4E0430200007F615E/backupset/2014_01_22/o1_mf_nnndf_TAG20140122T214355_9g0gx2hz_.bkp tag=TAG20140122T214355 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=/oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_sysaux_9g0d93lt_.dbf
input datafile file number=00006 name=/oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_system_9g0d93ls_.dbf
channel ORA_DISK_1: starting piece 1 at 22-JAN-14
channel ORA_DISK_1: finished piece 1 at 22-JAN-14
piece handle=/oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/backupset/2014_01_22/o1_mf_nnndf_TAG20140122T214355_9g0gx5n7_.bkp tag=TAG20140122T214355 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 22-JAN-14

Starting Control File and SPFILE Autobackup at 22-JAN-14
piece handle=/oracle/ENDCON/oradata/DEMO/autobackup/2014_01_22/o1_mf_s_837553448_9g0gx8xg_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 22-JAN-14

RMAN>





A nice trick to get the current scn (and nice that straight sql now works in rman).

RMAN> select dbms_flashback.get_current_scn() from dual;



Lets try a restore again now

RMAN> recover pluggable database 'TEST' until scn 1804214 auxiliary destination '/oracle/ENDCON/oradata/AUX';

Starting recover at 22-JAN-14
current log archived
using channel ORA_DISK_1
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 SYS_UNDOTS

Creating automatic instance, with SID='adne'

initialization parameters used for automatic instance:
db_name=DEMO
db_unique_name=adne_pitr_TEST_DEMO
compatible=12.0.0
db_block_size=8192
db_files=200
sga_target=1G
processes=80
diagnostic_dest=/oracle
db_create_file_dest=/oracle/ENDCON/oradata/AUX
log_archive_dest_1='location=/oracle/ENDCON/oradata/AUX'
enable_pluggable_database=true
_clone_one_pdb_recovery=true
#No auxiliary parameter file used


starting up automatic instance DEMO

Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2296576 bytes
Variable Size                293602560 bytes
Database Buffers             767557632 bytes
Redo Buffers                   5480448 bytes
Automatic instance created

contents of Memory Script:
{
# set requested point in time
set until  scn 1804214;
# restore the controlfile
restore clone controlfile;
# mount the controlfile
sql clone 'alter database mount clone database';
}
executing Memory Script

executing command: SET until clause

Starting restore at 22-JAN-14
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=128 device type=DISK

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /oracle/ENDCON/oradata/DEMO/autobackup/2014_01_22/o1_mf_s_837553448_9g0gx8xg_.bkp
channel ORA_AUX_DISK_1: piece handle=/oracle/ENDCON/oradata/DEMO/autobackup/2014_01_22/o1_mf_s_837553448_9g0gx8xg_.bkp tag=TAG20140122T214408
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/oracle/ENDCON/oradata/AUX/DEMO/controlfile/o1_mf_9g0h0pkn_.ctl
Finished restore at 22-JAN-14

sql statement: alter database mount clone database

contents of Memory Script:
{
# set requested point in time
set until  scn 1804214;
# switch to valid datafilecopies
switch clone datafile  6 to datafilecopy
 "/oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_system_9g0d93ls_.dbf";
switch clone datafile  7 to datafilecopy
 "/oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_sysaux_9g0d93lt_.dbf";
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile  1 to new;
set newname for clone datafile  5 to new;
set newname for clone datafile  3 to new;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile  1, 5, 3;
switch clone datafile all;
}
executing Memory Script

executing command: SET until clause

datafile 6 switched to datafile copy
input datafile copy RECID=1 STAMP=837553563 file name=/oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_system_9g0d93ls_.dbf

datafile 7 switched to datafile copy
input datafile copy RECID=2 STAMP=837553563 file name=/oracle/ENDCON/oradata/DEMO/F096642EA0730750E0430200007FE846/datafile/o1_mf_sysaux_9g0d93lt_.dbf

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 22-JAN-14
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /oracle/ENDCON/oradata/AUX/DEMO/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00005 to /oracle/ENDCON/oradata/AUX/DEMO/datafile/o1_mf_sys_undo_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /oracle/ENDCON/oradata/AUX/DEMO/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: reading from backup piece /oracle/ENDCON/oradata/DEMO/backupset/2014_01_22/o1_mf_nnndf_TAG20140122T214355_9g0gwvdk_.bkp
channel ORA_AUX_DISK_1: piece handle=/oracle/ENDCON/oradata/DEMO/backupset/2014_01_22/o1_mf_nnndf_TAG20140122T214355_9g0gwvdk_.bkp tag=TAG20140122T214355
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 22-JAN-14

datafile 1 switched to datafile copy
input datafile copy RECID=6 STAMP=837553579 file name=/oracle/ENDCON/oradata/AUX/DEMO/datafile/o1_mf_system_9g0h0w7z_.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=7 STAMP=837553579 file name=/oracle/ENDCON/oradata/AUX/DEMO/datafile/o1_mf_sys_undo_9g0h0w7m_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=8 STAMP=837553579 file name=/oracle/ENDCON/oradata/AUX/DEMO/datafile/o1_mf_sysaux_9g0h0w7r_.dbf

contents of Memory Script:
{
# set requested point in time
set until  scn 1804214;
# online the datafiles restored or switched
sql clone "alter database datafile  1 online";
sql clone "alter database datafile  5 online";
sql clone "alter database datafile  3 online";
sql clone 'TEST' "alter database datafile
 6 online";
sql clone 'TEST' "alter database datafile
 7 online";
# recover pdb
recover clone database tablespace  "SYSTEM", "SYS_UNDOTS", "SYSAUX" pluggable database
 'TEST'   delete archivelog;
sql clone 'alter database open read only';
plsql <<<begin
   add_dropped_ts;
end; >>>;
plsql <<<begin
   save_pdb_clean_scn;
end; >>>;
# shutdown clone before import
shutdown clone abort
plsql <<<begin
   pdbpitr_inspect(pdbname =>  'TEST');
end; >>>;
}
executing Memory Script

executing command: SET until clause

sql statement: alter database datafile  1 online

sql statement: alter database datafile  5 online

sql statement: alter database datafile  3 online

sql statement: alter database datafile  6 online

sql statement: alter database datafile  7 online

Starting recover at 22-JAN-14
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 78 is already on disk as file /oracle/ENDCON/oradata/DEMO/archivelog/2014_01_22/o1_mf_1_78_9g0frff7_.arc
archived log for thread 1 with sequence 79 is already on disk as file /oracle/ENDCON/oradata/DEMO/archivelog/2014_01_22/o1_mf_1_79_9g0h0h49_.arc
archived log file name=/oracle/ENDCON/oradata/DEMO/archivelog/2014_01_22/o1_mf_1_78_9g0frff7_.arc thread=1 sequence=78
archived log file name=/oracle/ENDCON/oradata/DEMO/archivelog/2014_01_22/o1_mf_1_79_9g0h0h49_.arc thread=1 sequence=79
media recovery complete, elapsed time: 00:00:00
Finished recover at 22-JAN-14

sql statement: alter database open read only



Oracle instance shut down


Removing automatic instance
Automatic instance removed
auxiliary instance file /oracle/ENDCON/oradata/AUX/DEMO/datafile/o1_mf_sysaux_9g0h0w7r_.dbf deleted
auxiliary instance file /oracle/ENDCON/oradata/AUX/DEMO/controlfile/o1_mf_9g0h0pkn_.ctl deleted
Finished recover at 22-JAN-14

RMAN>


now quickly open it

SQL> sho pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 TEST                           MOUNTED
SQL> alter pluggable database test open;

Pluggable database altered.

SQL>



And now it works - very nice!










Comments


  1. I just want to create a job on daily basis to take backup of the Oracle pdb. I found your link for taking backup and Restoring it.

    Oracle DBA Blog 2.0: 12c PDB backup and recovery

    I removed some of the Stored procedures after taking back up as described in the link and recovered it after but I didn't got it back. There was no error being observed

    Please help to take backup and schedule it.

    ReplyDelete
  2. Hi,
    So you took a backup, removed some stored procedures and then tried to restore the pdb from backup - which worked. However the stored procedures that should have some back from the backup were missing?

    Have you got the logfile from the backup/restore?

    Did you only restore the pdb to the point in time before you dropped the stored procedres - otherwise it will try and come back to 'now' using the archive redo.

    Cheers,
    Rich

    ReplyDelete

Post a Comment