In Oracle Database, a Pluggable Database (PDB) is a self-contained unit of storage with its own data and metadata that can be plugged into and unplugged from a Container Database (CDB). To stop and start a Pluggable Database, you can follow these steps:
Stopping a Pluggable Database:
Connect to the Container Database (CDB): Open a command-line interface or a SQL client and connect to the CDB as a user with administrative privileges, typically a user with the SYSDBA role.
# sqlplus sys as sysdba
Ensure you are in the CDB context: Check if you are in the context of the CDB, not a specific PDB, by running:
SHOW CON_NAME;
If the result is the CDB’s name, you are in the right context.
You can shut down a PDB using the ALTER PLUGGABLE DATABASE statement:
ALTER PLUGGABLE DATABASE pdb_name CLOSE;
Replace pdb_name with the name of the PDB you want to shut down.
You can check the status of the PDB using:
SELECT name, open_mode FROM v$pdbs;
The OPEN_MODE should be set to MOUNTED or READ ONLY depending on whether you want to access the PDB in a read-only state.
Starting a Pluggable Database:
If you are not already connected to the CDB, connect as a user with administrative privileges.
Again, ensure you are in the context of the CDB, not a specific PDB.
You can start a PDB using the ALTER PLUGGABLE DATABASE statement:
ALTER PLUGGABLE DATABASE pdb_name OPEN;
Replace pdb_name with the name of the PDB you want to start.
Verify the PDB Status: Check the status of the PDB again using the query:
SELECT name, open_mode FROM v$pdbs;
The OPEN_MODE should now be set to READ WRITE if the PDB has been successfully started.
Remember that the above steps should be executed with proper administrative privileges, and you should be cautious while performing these operations on production databases.
Some start/stop database usage syntax has been listed as below:
STARTUP [NOMOUNT | MOUNT | RESTRICT | UPGRADE | FORCE | READ ONLY]
SHUTDOWN [IMMEDIATE | ABORT]
The ALTER PLUGGABLE DATABASE command can be used from the CDB or the PDB.
The following commands are available to open and close the current PDB when connected to the PDB as a privileged user.
ALTER PLUGGABLE DATABASE OPEN READ WRITE [RESTRICTED] [FORCE];
ALTER PLUGGABLE DATABASE OPEN READ ONLY [RESTRICTED] [FORCE];
ALTER PLUGGABLE DATABASE OPEN UPGRADE [RESTRICTED];
ALTER PLUGGABLE DATABASE CLOSE [IMMEDIATE];

Yorum bırakın