Tuesday, September 8, 2026

Atharv - A45 - Value Your Virtues – National Level Contest 2026 #futureleaders

 🌟 Please support and encourage young talent!


Proud to share Atharv’s participation in the“Value Your Virtues” National Level Contest 2026

Every opportunity to speak, perform, and express ideas helps children become more confident and prepared for the future.

🎥 Watch the video:


Speech Video : 

            🔗  https://www.youtube.com/watch?v=DMswOoRW0D8



Please share your encouragement and best wishes in the comments. 🙏


#ValueYourVirtues #YoungTalent #NationalLevelContest #ProudMoment #PublicSpeaking #ConfidenceBuilding #ChildDevelopment

Wednesday, August 26, 2026

what is catcon.pl (Catalog Container Script) and why very useful for Oracle Multitenant Database ?

 catcon.pl (Catalog Container Script) is an Oracle utility introduced with the Multitenant Architecture (CDB/PDB) to execute SQL scripts across one or more containers (CDB root, PDBs, or all PDBs).

It is heavily used during:

  • Database upgrades
  • Patching (RU, RUR, OJVM)
  • Running Oracle supplied scripts
  • Component installation
  • Post-upgrade tasks
  • Custom DBA scripts across all PDBs

Why Oracle Created catcon.pl

Before Multitenant, if you had:

ORCL

you ran a script once:

@script.sql

With Multitenant:

CDB1
├── PDB1
├── PDB2
├── PDB3
└── PDB4

The script may need to run in:

  • CDB$ROOT
  • PDB1
  • PDB2
  • PDB3
  • PDB4

Instead of connecting manually to each container, Oracle uses catcon.pl to automate the execution.


Location

Usually located under:

$ORACLE_HOME/rdbms/admin

Check:

find $ORACLE_HOME -name catcon.pl

Common path:

$ORACLE_HOME/rdbms/admin/catcon.pl


Basic Syntax

perl catcon.pl [options] script.sql

Example:

$ORACLE_HOME/perl/bin/perl </span>
$ORACLE_HOME/rdbms/admin/catcon.pl </span>
-b test </span>
-d /tmp </span>
test.sql

Where:

  • -b = base name for logs
  • -d = script directory
  • test.sql = SQL script to execute

Execute Script on All PDBs

Example:

$ORACLE_HOME/perl/bin/perl </span>
$ORACLE_HOME/rdbms/admin/catcon.pl </span>
-b gather_stats </span>
-d /tmp </span>
gather_stats.sql

The script runs across all open containers.


Run Script Only in Specific PDB

$ORACLE_HOME/perl/bin/perl </span>
$ORACLE_HOME/rdbms/admin/catcon.pl </span>
-c 'PDB1' </span>
-b test </span>
-d /tmp </span>
script.sql

Here:

PDB1 only

is processed.


Run in Multiple PDBs

-c 'PDB1 PDB2 PDB3'

Example:

catcon.pl -c 'PDB1 PDB2 PDB3' script.sql


Exclude Specific PDBs

-C 'PDB$SEED'

Example:

catcon.pl -C 'PDB$SEED' script.sql
``


Common Options

OptionDescription
-bBase log file name
-dScript location
-cInclude containers
-CExclude containers
-nParallel execution
-lLog directory
-uUsername
-pPassword

Parallel Execution

Suppose you have 20 PDBs.

Without parallelism:

catcon.pl script.sql

Runs one at a time.

Use:

catcon.pl -n 8 script.sql

to execute in parallel across 8 PDBs.


Example: Gather Dictionary Statistics

Oracle commonly uses:

$ORACLE_HOME/perl/bin/perl </span>
$ORACLE_HOME/rdbms/admin/catcon.pl </span>
-n 4 </span>
-l /tmp/logs </span>
-b gatherstats </span>
-d $ORACLE_HOME/rdbms/admin </span>
gather_stats.sql


During Database Upgrade

After upgrading Oracle software, Oracle internally runs scripts such as:

catupgrd.sql
utlrp.sql

using catcon.

Example:

catctl.pl

internally calls:

catcon.pl

to process all PDBs.

Relationship:

catctl.pl
|
+-- catcon.pl
|
+-- Executes scripts in all containers


Example: Recompile Invalid Objects in All PDBs

Instead of:

ALTER SESSION SET CONTAINER=PDB1;
@utlrp.sql

ALTER SESSION SET CONTAINER=PDB2;
@utlrp.sql

Use:

$ORACLE_HOME/perl/bin/perl </span>
$ORACLE_HOME/rdbms/admin/catcon.pl </span>
-b utlrp </span>
-d $ORACLE_HOME/rdbms/admin </span>
utlrp.sql
``

Oracle recompiles invalid objects in all PDBs automatically.


Log Files

Suppose:

-b test
-l /tmp/logs

Oracle generates:

test0.log
test1.log
test2.log
test3.log
``

along with spool files for each container.

Very useful during:

  • Upgrades
  • PSU/RU patching
  • Component installation

How catcon Knows the Current Container

Within the SQL script, you can identify the current container:

SELECT SYS_CONTEXT('USERENV','CON_NAME')
FROM dual;
``

When executed through catcon, each container processes the script independently.


Typical Oracle Scripts Executed with catcon

utlrp.sql
catalog.sql
catproc.sql
utluiobj.sql
dbmsupgnv.sql
gather_stats.sql


Best Practices for DBAs

Execute on all open PDBs

catcon.pl -n 8 script.sql

Keep separate log directory

-l /u01/logs

Validate PDB status before execution

SHOW PDBS;

Review logs after completion

grep -i "ORA-" *.log

Exclude PDB$SEED unless Oracle documentation requires it

-C 'PDB$SEED'


catcon.pl vs catctl.pl

UtilityPurpose
catcon.plExecute scripts across CDB/PDBs
catctl.plDatabase upgrade orchestration tool
dbupgradeWrapper around catctl.pl
datapatchApplies SQL patch changes using catcon internally

In One Line

catcon.pl is Oracle's Multitenant utility that executes SQL scripts simultaneously across one or more PDBs/CDB containers, making patching, upgrades, and administrative operations manageable in environments with many PDBs.

Why SAVE STATE is Required in Oracle PDB ?

In Oracle Multitenant architecture, SAVE STATE is a feature that allows a Pluggable Database (PDB) to remember its open mode across a CDB restart.

Without SAVE STATE, when the Container Database (CDB) is restarted, all PDBs (except PDB$SEED) typically remain in MOUNTED state and must be opened manually.


The PDB SAVE STATE feature was introduced in Oracle Database 12c Release 1 Patch Set 1 (12.1.0.2). Prior to 12.1.0.2, PDBs did not automatically return to their previous open state after a CDB restart, and DBAs commonly used startup triggers to open PDBs automatically.

For Oracle 19c/21c/23ai/26ai, this feature remains widely used and is considered the standard method for automatic PDB startup.

Why SAVE STATE is Required

Suppose you have:

SQL> ALTER PLUGGABLE DATABASE PDBPROD OPEN;

PDBPROD is open and users can connect.

After a database restart:

SHUTDOWN IMMEDIATE;
STARTUP;

You may find:

SHOW PDBS;

Output:

PDB Name Open Mode
----------- ----------
PDB$SEED READ ONLY
PDBPROD MOUNTED

Applications cannot connect until you manually open the PDB.

To avoid this, Oracle provides SAVE STATE.


How to Save PDB State

Open the PDB first:

ALTER PLUGGABLE DATABASE PDBPROD OPEN;

Save its current state:

ALTER PLUGGABLE DATABASE PDBPROD SAVE STATE;

Oracle stores this information internally.


Verify Saved State

Query:

SELECT con_name,
state
FROM dba_pdb_saved_states;

Example:

CON_NAME STATE
--------- -----
PDBPROD OPEN


After CDB Restart

SHUTDOWN IMMEDIATE;
STARTUP;

Check:

SHOW PDBS;

Output:

PDB Name Open Mode
----------- ----------
PDB$SEED READ ONLY
PDBPROD READ WRITE

The PDB automatically opens because Oracle remembered the saved state.


Save State for All PDBs

ALTER PLUGGABLE DATABASE ALL SAVE STATE;

Very useful after patching or maintenance.


Discard Saved State

If you don't want Oracle to auto-open a PDB:

ALTER PLUGGABLE DATABASE PDBPROD DISCARD STATE;

Verify:

SELECT * FROM DBA_PDB_SAVED_STATES;

The entry will be removed.


Save Different Open Modes

Read Write

ALTER PLUGGABLE DATABASE PDBPROD OPEN READ WRITE;
ALTER PLUGGABLE DATABASE PDBPROD SAVE STATE;

Read Only

ALTER PLUGGABLE DATABASE REPORT_PDB OPEN READ ONLY;
ALTER PLUGGABLE DATABASE REPORT_PDB SAVE STATE;
``

After restart, Oracle restores the same mode.


Check Current and Saved State

Current state:

SHOW PDBS;

or

SELECT name, open_mode
FROM v$pdbs;

Saved state:

SELECT con_id,
con_name,
instance_name,
state
FROM dba_pdb_saved_states;


RAC Environment

In Oracle RAC, SAVE STATE is instance-specific.

Example:

ALTER PLUGGABLE DATABASE PDBPROD OPEN INSTANCES=ALL;
ALTER PLUGGABLE DATABASE PDBPROD SAVE STATE INSTANCES=ALL;

Check:

SELECT con_name,
instance_name,
state
FROM dba_pdb_saved_states;

You will see an entry for each RAC instance.


Best Practice

After:

  • Creating a new PDB
  • Cloning a PDB
  • Refreshable PDB setup
  • Database patching
  • Migration to a new server

Always execute:

ALTER PLUGGABLE DATABASE ALL SAVE STATE;

and verify:

SELECT con_name, state
FROM dba_pdb_saved_states;

This ensures all required PDBs automatically open after any database restart and avoids application outages caused by PDBs remaining mounted.

Atharv - A45 - Value Your Virtues – National Level Contest 2026 #futureleaders

  🌟 Please support and encourage young talent! Proud to share Atharv’s participation in the “Value Your Virtues” National Level Contest 202...