Answer By Gemini
When working with Oracle Pluggable Databases (PDBs), it's essential to know how to check their status. Here's a breakdown of how to do that, primarily using SQL*Plus:
Key Views:
- CDB_PDBS or DBA_PDBS:
- These views provide general information about PDBs within a Container Database (CDB), including their status.
- V$PDBS:
- This dynamic performance view displays the open mode of each PDB, which is crucial for determining if a PDB is available for use.
Steps to Check PDB Status:
-
Connect to the CDB:
- Use SQL*Plus to connect to the CDB as a user with appropriate privileges (e.g., SYSDBA).
- Ensure you are connected to the root container (CDB$ROOT).
-
Check General PDB Information:
- To get a general overview of the PDBs and their status, execute the following SQL query:
SELECT pdb_name, status FROM cdb_pdbs;- This query will display the names of the PDBs and their current status.
- Check Open Mode:
- To specifically check the open mode of the PDBs, use this query:
SELECT pdb_name, open_mode FROM v$pdbs;- This will show whether a PDB is open in READ WRITE, READ ONLY, or MOUNTED mode.
- Using the show pdbs command:
- Another simple way to view the basic PDB status is to use the following SQL plus command.
show pdbs
- This will display the CON_ID, CON_NAME and OPEN MODE of the PDB's.
- Another simple way to view the basic PDB status is to use the following SQL plus command.
Important Considerations:
- Container Context:
- When working with PDBs, it's vital to be aware of the container context. Some queries and commands are executed from the root container, while others might be executed within a specific PDB.
- Privileges:
- You'll need appropriate database privileges to query the system views mentioned above.
By using these methods, you can effectively monitor the status of your PDBs and ensure they are operating as expected.