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:
you ran a script once:
With Multitenant:
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:
Check:
Common path:
Basic Syntax
Example:
Where:
-b= base name for logs-d= script directorytest.sql= SQL script to execute
Execute Script on All PDBs
Example:
The script runs across all open containers.
Run Script Only in Specific PDB
Here:
is processed.
Run in Multiple PDBs
Example:
Exclude Specific PDBs
Example:
Common Options
| Option | Description |
|---|---|
| -b | Base log file name |
| -d | Script location |
| -c | Include containers |
| -C | Exclude containers |
| -n | Parallel execution |
| -l | Log directory |
| -u | Username |
| -p | Password |
Parallel Execution
Suppose you have 20 PDBs.
Without parallelism:
Runs one at a time.
Use:
to execute in parallel across 8 PDBs.
Example: Gather Dictionary Statistics
Oracle commonly uses:
During Database Upgrade
After upgrading Oracle software, Oracle internally runs scripts such as:
using catcon.
Example:
internally calls:
to process all PDBs.
Relationship:
Example: Recompile Invalid Objects in All PDBs
Instead of:
Use:
Oracle recompiles invalid objects in all PDBs automatically.
Log Files
Suppose:
Oracle generates:
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:
When executed through catcon, each container processes the script independently.
Typical Oracle Scripts Executed with catcon
Best Practices for DBAs
Execute on all open PDBs
Keep separate log directory
Validate PDB status before execution
Review logs after completion
Exclude PDB$SEED unless Oracle documentation requires it
catcon.pl vs catctl.pl
| Utility | Purpose |
|---|---|
catcon.pl | Execute scripts across CDB/PDBs |
catctl.pl | Database upgrade orchestration tool |
dbupgrade | Wrapper around catctl.pl |
datapatch | Applies 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.
No comments:
Post a Comment