This article focuses on steps to unplug the database from the container database and then plugging it back to the same or another container.
Here I have explained the method of using command prompt, whereas you can also manage the plugging and unplugging through Database Configuration Assistance (DBCA).
Let’s begin with Unplugging the Database.
Before unplugging database make sure that you are connected to an appropriate database and close the pluggable database.
Make a note, when we unplug the database, some repository needs to be created that will provide the metadata about the database when we wish to plug the same database back to the container database.
See the screenshot below to unplug the database generates XML file. This XML file stores the information about name, full paths of tablespaces and datafiles.
Now, after unplugging DB, we are plugging back the unplugged database to the same container database. But in the case when you need to unplugged the database to another container database, it is always essential first to verify the compatibility of the pluggable database with a 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 shown below:
As per the output results, we saw that the unplugged database is compatible and we can proceed further to plug it.
Here the XML file will be generated while unplugging the database, for the creation and plugging the database.
Once the pluggable database is created and plugged in, you can see the newly created database is in mount state.
Shift to the pluggable database and open it.
That’s it! We are done with unplugging and plugging databases.
To check the logs of the entire process from unplugging the database to plugging it back again, you can refer to the alert log file. This will help you clearly understand the internals of plugging and unplugging databases.
I hope the article was helpful to you. To know more stay tuned with us.