Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Linux CPU info. Linux/Unix
  • Reading config file from other folder inside class Python/PySpark
  • Explain Plan Output 2 Oracle
  • online_ts_bkup.sql Oracle
  • Passing from Unix to PLSQL using bind variables Linux/Unix
  • 284785.1 How to check RAC Option is currently linked into the Oracle Binary Oracle
  • Privilege to describe the table. Oracle
  • TRUNCATE table and disabling referential constraints. Oracle
  • How To Resolve Stranded DBA_2PC_PENDING Entries ID 401302.1 (Very Good prooven) Oracle
  • Passing from Unix to PLSQL using bind variables Linux/Unix
  • switchover for primary database Oracle
  • All About oracle password and security from metalink Oracle
  • oracle Dba site Oracle
  • How do I get Oracle to automatically start when my server boots up? Oracle
  • setting prompt display with .profile Linux/Unix

find_pdbs.sql

Posted on 08-Apr-2026 By Admin

Understanding Oracle Multitenant: Querying PDB Status Across Instances

As an Oracle DBA working with Container Databases (CDBs), one of the most common tasks is checking the status of your Pluggable Databases (PDBs). Today I’ll share a useful script that provides a comprehensive view of all PDBs across all instances in your Oracle RAC environment.

The Power of gv$pdbs

The gv$pdbs view is a global view that shows information about all PDBs in a CDB across all instances in an Oracle RAC environment. This is particularly useful when you need to verify the status of PDBs consistently across all nodes.

The Script Explained

Here’s the script we’ll be using:

col inst_id format 99
col con_id format 99
col name format a30
col open_mode format a30
set lines 120 pages 200

SELECT inst_id, con_id, name, open_mode
FROM gv$pdbs
ORDER BY name, inst_id;

Let me break down what each part does:

  1. Column Formatting:
  2. col inst_id format 99: Formats the instance ID to display as 2 digits
  3. col con_id format 99: Formats the container ID to display as 2 digits
  4. col name format a30: Allocates 30 characters for the PDB name
  5. col open_mode format a30: Allocates 30 characters for the open mode

  6. Output Settings:

  7. set lines 120: Sets line width to 120 characters
  8. set pages 200: Sets page size to 200 lines

  9. The Query:

  10. Selects instance ID, container ID, PDB name, and open mode
  11. From the global view gv$pdbs
  12. Orders results by PDB name and instance ID

Sample Output

When you run this script, you’ll see output similar to:

INST_ID CON_ID NAME                           OPEN_MODE
------- ------ ------------------------------ ------------------------------
      1      2 PDB$SEED                       READ ONLY
      1      3 HR_PDB                         READ WRITE
      1      4 FINANCE_PDB                    READ WRITE
      2      2 PDB$SEED                       READ ONLY
      2      3 HR_PDB                         READ WRITE
      2      4 FINANCE_PDB                    MOUNTED

Why This Script is Useful

  1. Cross-Instance Visibility: Shows PDB status across all RAC instances
  2. Quick Status Check: Immediately identifies PDBs that aren’t in the expected state
  3. Consistent Formatting: Clean, readable output regardless of PDB name length
  4. Seed Database Included: Shows the PDB$SEED database which is important for PDB creation

Advanced Usage

For more detailed information, you could enhance this query with additional columns:

SELECT inst_id, con_id, name, open_mode,
       restricted, recovery_status, creation_time
FROM gv$pdbs
ORDER BY name, inst_id;

This adds information about restricted mode, recovery status, and creation time.

Conclusion

This simple but powerful script is a must-have in your Oracle DBA toolkit. It provides immediate visibility into your PDB environment across all RAC instances, helping you quickly identify any PDBs that might need attention.

What other PDB-related queries do you find most useful in your daily DBA work? Share your favorites in the comments!

Uncategorized

Post navigation

Previous Post: Creating a Container Database using dbaascli
Next Post: find_encr_wallet.sql

Related Posts

  • top 10 AI news today Uncategorized
  • SAT Mathematics 10 questions and answer at the end. Uncategorized
  • Creating a Container Database using dbaascli Uncategorized
  • find_encr_wallet.sql Uncategorized

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Django (0)
  • GIT (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (403)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (18)
  • rman-dataguard (26)
  • shell (150)
  • SQL scripts (350)
  • SQL Server (6)
  • Uncategorized (5)
  • Videos (0)

Recent Posts

  • Key Management in Oracle: The Core Issue: Missing Master Key12-May-2026
  • SAT Mathematics 10 questions and answer at the end.30-Apr-2026
  • top 10 AI news today30-Apr-2026
  • runon_allpdbs_show_conname.sh23-Apr-2026
  • runon_allcdbs_find_pdbs.sql23-Apr-2026
  • Running PDB on single node in RAC09-Apr-2026
  • find_arc.sql09-Apr-2026
  • pvm_pre_change.sql08-Apr-2026
  • find_encr_wallet.sql08-Apr-2026
  • find_pdbs.sql08-Apr-2026

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Oracle 11g Training on 29JAN1010 Oracle
  • Specify the Rollback segment to use in Transaction Oracle
  • How to check current redo log progress redo_progress.sql Oracle
  • Best approach for Oracle database patching sequence to latest/required patchset along with CPU/PSU/any-other-one-off patch ID 865255.1 Oracle
  • Multiple listeners Oracle
  • Mutating Table Error while using database trigger Oracle
  • JSON/XML Types in Oracle Oracle
  • setting prompt display with .profile Linux/Unix

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme