Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Histogram information Oracle
  • Good link for LIO in Oracle ( Logical IOs) Oracle
  • Generate SSH without password authentication. Linux/Unix
  • Find Time Consuming SQL Statements in Oracle 10g Oracle
  • Multiple listeners Oracle
  • Jai Shree Ram Oracle
  • Kill a session dynanically using execute immediate Oracle
  • create database syntax Oracle
  • Sequence Resetting Oracle
  • To see how much time or progress of long transaction Oracle
  • longtx.sql Oracle
  • how to find VIP from ifconfig Linux/Unix
  • longtx.sql with the flag whether session is blocking any DML locks or not. Oracle
  • shr1.sql for MTS or Shared server configuration Oracle
  • SCRIPT TO LIST RECURSIVE DEPENDENCY BETWEEN OBJECTS UTLDTREE.sql 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
  • find_encr_wallet.sql Uncategorized

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Django (0)
  • GIT (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (402)
  • 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 (3)
  • Videos (0)

Recent Posts

  • 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
  • Creating a Container Database using dbaascli08-Apr-2026
  • track_autoupgrade_copy_progress.sql01-Apr-2026
  • refre.sql for multitenant01-Apr-2026

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • tblwopk.sql /* Find Tables Without PK */ Oracle
  • v$backup.status information Oracle
  • Multiple listeners Oracle
  • How to analyze statspack or AWR report. Oracle
  • Roles and Stored Procs II Oracle
  • Good Oracle Architecture In Short and point to point Oracle
  • Drop specific SQL plan baseline – spm Oracle
  • checking connectivity between two servers Linux/Unix

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme