Search This Blog

Thursday, October 27, 2022

Restoring single Pluggable database (PDB )from CDB backup

  



In this post , we will see how we can restore a single Pluggable database from the CDB backup without need to restore the complete CDB.

Environment setup :

RAC Database         : VO19CDB (vo19cdb1 and vo19cdb2)
GRID Home                 : /u01/app/19.3.0.0/grid
RDBMS Home : /u01/app/oracle/product/19.14.0.0/dbhome_1
Version                         : Oracle Database 19c EE - Production Version 19.14.0.0.0
Scan IP                 : rac19cp-scan
hosts         : 19cracp1 & 19cracp2

CDB and PDB database details.












In this exercise, we will follow below steps.

1) create one test table called, PDB2TEST1_Before_backup in PDB2 and insert one row
2) Take RMAN backup of the CDB,vol9cdb
3) connect to PDB2 and insert 2nd row into the table, PDB2TEST1_Before_backup
4) Also, Create 2nd test table called,  on PDBand insert a row into it.
5) Restore PDB2 from the CDB taken in step 2
6) Once the restore completes of PDB2 pluggable database, we should only see one table , PDB2TEST1_Before_backup and with only 1 row.


Step 1)  Create one test table called, PDB2TEST1_Before_backup in PDB2 and insert one row


In this step, we will connect to the pluggable database, PDB2 with a user and create the table.
























Step 2) Take RMAN backup of the CDB, vol9cdb

In this step, we will connect to the catalog and then take the backup of the CDB using below rman command.






Backup command and its output.




















































Step 3) connect to PDB2 and insert 2nd row into the table, PDB2TEST1_Before_backup
















Step 4) Also, Create 2nd test table called, PDB2TEST2_after_backup  on PDB and insert a row into it.


























Step 5) Restore PDB2 from the CDB taken in step 2

Below is the RMAN recover command, I have used the set until time clause and the time I used is just about the time when our backup got completed.









Below is the RMAN recover process along with the output.































Step 6) Once the restore completes of PDB2 pluggable database, we should only see one table , PDB2TEST1_Before_backup and with only 1 row.























As you can see from the above output, we can see only one table and that table has only one row that we inserted before taking the backup.

 We will run into below error if we use incorrect time in set until time clause in the recover command.






















Hope this helps few people who wants to recover the PDB from CDB backup.

Thanks
Sambaiah Sammeta








No comments:

Post a Comment