Amazon Partner

Wednesday, 28 October 2015

Oracle 12c rman backup gone with drop pluggable database pdb

Today, I was testing backup and restore process for new oracle 12c pluggable database and part of test i thought to test drop and restore of pluggable database.


I have created a small two tablespace database PDB1 from PDB$SEED datbase for this test.

Before attempting the drop , i thought to backup the database so i can restore later when database is droppped and perform recovery operation.


RMAN> backup pluggable database PDB1;

Starting backup at 28-OCT-15
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=00021 name=/u01/oradata/CDBORA/232C3E643AA01E17E0530100007FCD5B/datafile/o1_mf_sysaux_c31rdofq_.dbf
input datafile file number=00020 name=/u01/oradata/CDBORA/232C3E643AA01E17E0530100007FCD5B/datafile/o1_mf_system_c31rdofp_.dbf
channel ORA_DISK_1: starting piece 1 at 28-OCT-15
channel ORA_DISK_1: finished piece 1 at 28-OCT-15
piece handle=/u01/oadata/fast_recovery_area/CDBORA/232C3E643AA01E17E0530100007FCD5B/backupset/2015_10_28/o1_mf_nnndf_TAG20151028T080754_c31s6cop_.bkp tag=TAG20151028T080754 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:36
Finished backup at 28-OCT-15

Starting Control File and SPFILE Autobackup at 28-OCT-15
piece handle=/u01/oadata/fast_recovery_area/CDBORA/autobackup/2015_10_28/o1_mf_s_894269310_c31s7gmk_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 28-OCT-15



List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5       Full    660.88M    DISK        00:00:26     28-OCT-15      
        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20151028T080754
        Piece Name: /u01/oadata/fast_recovery_area/CDBORA/232C3E643AA01E17E0530100007FCD5B/backupset/2015_10_28/o1_mf_nnndf_TAG20151028T080754_c31s6cop_.bkp
  List of Datafiles in backup set 5
  Container ID: 5, PDB Name: PDB1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  20      Full 1964340    28-OCT-15 /u01/oradata/CDBORA/232C3E643AA01E17E0530100007FCD5B/datafile/o1_mf_system_c31rdofp_.dbf
  21      Full 1964340    28-OCT-15 /u01/oradata/CDBORA/232C3E643AA01E17E0530100007FCD5B/datafile/o1_mf_sysaux_c31rdofq_.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6       Full    17.20M     DISK        00:00:00     28-OCT-15      
        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20151028T080830
        Piece Name: /u01/oadata/fast_recovery_area/CDBORA/autobackup/2015_10_28/o1_mf_s_894269310_c31s7gmk_.bkp
  SPFILE Included: Modification time: 28-OCT-15
  SPFILE db_unique_name: CDBORA
  Control File Included: Ckp SCN: 1964358      Ckp time: 28-OCT-15



SQL> SELECT CON_ID,NAME, OPEN_MODE FROM V$PDBS;

    CON_ID NAME      OPEN_MODE
---------- ------------------------------------------------------------------------------------------ ----------
2 PDB$SEED      READ ONLY
3 PDB2      READ WRITE
4 DPBSALES      READ WRITE
5 PDB1      READ WRITE





SQL> DROP PLUGGABLE DATABASE PDB1;
DROP PLUGGABLE DATABASE PDB1
*
ERROR at line 1:
ORA-65179: cannot keep datafiles for a pluggable database that is not unplugged



as it failed to drop without deleting files, I used including datafiles option.

SQL> DROP PLUGGABLE DATABASE PDB1 INCLUDING DATAFILES;

Pluggable database dropped.


now database was dropped , i thought to go back to my backup and restore .


RMAN> LIST Backup;


List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6       Full    17.20M     DISK        00:00:00     28-OCT-15      
        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20151028T080830
        Piece Name: /u01/oadata/fast_recovery_area/CDBORA/autobackup/2015_10_28/o1_mf_s_894269310_c31s7gmk_.bkp
  SPFILE Included: Modification time: 28-OCT-15
  SPFILE db_unique_name: CDBORA
  Control File Included: Ckp SCN: 1964358      Ckp time: 28-OCT-15


I couldn't find my backup in rman ,because information from controlfile is gone. Fortunately my backup file are still there, so its not big issue, i could use those to restore my database. but as current controlfile no longer knows about PDB1 i will have to restore the controlfile of time before dropping the database.



Happy Learning !!!

No comments:

Post a Comment