In previous article we have seen various methods of connecting to and starting and shutting down pluggable databases. This article focuses on steps to unplug the database from container database and then plugging it back to same or another container. Here I have demonstrated the method using command prompt, whereas you can also manage the plugging and unplugging through Database Configuration Assistance (DBCA).
Before unplugging database make sure you are connected to appropriate database and close the pluggable database.
Here, it is important to understand that when we unplug the database, some repository needs to crated that will provide the metadata about the database when we wish to plug the same database back to container database. The statement you see in following screen shot to unplug the database generates xml file. This xml file stores the information about name, full paths of tablespaces and datafiles.
In our scenario, we are plugging back the unplugged database to the same container database. But in case where you need to unplugged database to another container database, it is always essential to verify the compatibility of pluggable database with container database. The verification can be done with Oracle Package and Stored Procedure.
”DB_PDB.CHECK_PLUG_COMPATIBILITY”. This can be simply verified using PL/SQL code written below:
As we seen, the output results that unplugged database is compatible we can proceed further plugging it. Here the xml file will be used generated while unplugging database, for creation and plugging the database.
Once pluggable database is created and plugged, you can see that newly created database is in mount state.
Shift to pluggable database and open it.
Here we are done with unplugging and plugging databases. To see the logs of complete process from unplugging database to plugging it back again, you can refer to alert log file. This will help you clearly understand the internals of plugging and unplugging databases.
That’s all with basics of multi-tenant database, we have seen so far with the series of articles from introduction to this point. Next we shall go through the multi-tenant database with Oracle other technologies like Data Guard.