Relocating a PDB is an online action instead of unplugging and plugging a database.
The source can be open for read and write, and there is minimal or no downtime.
The files that are associated with the PDB are moved to a new location, and the PDB is added in the target CDB and then opened.
The change over to the PDB in the target CDB depends on the listener as the part of the stages for relocating.
If this is a shared listener for the source and target PDB, additional connection handling is not needed, and the new connections are automatically routed to the new locations.
If the PDBs use different listeners, there needs to be a cross-registration of their respective listeners through the parameters local_ listener and remote_listener.
The following command starts the relocation:
SQL> create pluggable database mmpdb_re from mmpdb@mmconnect relocate availability max;
After this completes, you can open the target PDB for read-write.
This relocation can also be performed in DBCA for an interface, or you can run it in silent mode and code it if you have a list of PDBs that need relocation.
Checking the Status of Pluggable Databases
After creating, cloning, or moving a PDB, you may want to check its status. You can view the status of all PDBs within a CDB while connected in the root container.
For instance, a user with DBA privileges can report on the status of all PDBs via this query:
SQL> select pdb_id, pdb_name, status from cdb_pdbs; PDB_ID
We have used examples in previous sections to just see the containers and PDBs available for the CDB.
If you run the prior queries while connected directly to a PDB, you will only get the information for the PDB currently connected to.