Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • get_vmstat.ksh Linux/Unix
  • Postgres DB user and OS user. POSTGRESQL
  • Good Oracle Architecture In Short and point to point Oracle
  • Directory wise folder wise space usage Linux/Unix
  • My FTP Job Scheduling for www.pvmehta.com PHP/MYSQL/Wordpress
  • ORA-01220 Oracle
  • crontab syntax Linux/Unix
  • sql_plan9i.sql Oracle
  • Is It Recommended To Apply Patch Bundles When PSU Is Available? -ID 743554.1 Oracle
  • How to change hostname in Linux Linux/Unix
  • How to find where datafile is created dbf_info.sql Oracle
  • Python class import from different folders Python/PySpark
  • Oracle 10g for solaris 10 Oracle
  • Good Link from metalink 1 Oracle
  • Create type and Grant on it. Oracle

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

  • Creating a Container Database using dbaascli Uncategorized
  • SAT Mathematics 10 questions and answer at the end. Uncategorized
  • find_encr_wallet.sql Uncategorized
  • top 10 AI news today 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
  • Index Range Scan Oracle
  • ORA-4031 issue and solution on 09-MAY-2008 Oracle
  • how to find VIP from ifconfig Linux/Unix
  • For Perl DBI installation and testing program PHP/MYSQL/Wordpress
  • Load SPM baseline from AWR Oracle
  • Adding Datafile on Primary Server and Impact on Standby Server Oracle
  • ORA-8031 issue and solution if it is occuring due to truncate. Oracle
  • Pending Transaction Neighbors Script Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme