catcon.pl on Windows - run scripts on all PDBs within a CDB
-- Run catcon.pl in Windows
--

set ORACLE_HOME=D:\oracle\product\12.2.0\dbhome_1
cd %ORACLE_HOME%/rdbms/admin/
 
-- ensure perl works:
%ORACLE_HOME%\perl\bin\perl -v

This is perl 5, version 22, subversion 0 (v5.22.0) built for MSWin32-x64-multi-thread

Copyright 1987-2015, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

-- Run test.sql on each pdb of the cdb:
set ORACLE_SID=DBTEST
%ORACLE_HOME%\perl\bin\perl %ORACLE_HOME%\rdbms\admin\catcon.pl -u SYS -d D:\dba\sql -b catcon_out.txt test.sql
Enter Password: xxxx

-- Run utlrp.sql on each pdb of the cdb:
set ORACLE_SID=DBTEST
%ORACLE_HOME%\perl\bin\perl %ORACLE_HOME%\rdbms\admin\catcon.pl --n 1 --e --b utlrp --d '''.''' utlrp.sql

$ORACLE_HOME/perl/bin/perl catcon.pl --n 1 --e --b utlrp --d '''.''' utlrp.sql
-- Run test.sql on each pdb of the cdb and include -c (lower case) some pdbs:
set ORACLE_SID=DBTEST
%ORACLE_HOME%\perl\bin\perl %ORACLE_HOME%\rdbms\admin\catcon.pl -u SYS -d D:\dba\sql -c "P1DBINFOTST" -b catcon_out.txt test.sql
Enter Password: xxxx

Options
 -u for username and password connect with PDB’s or CDB for execute SQL queries or scripts.
 -U for username and password with special privileges to perform internal tasks like modified metadata.
 -d Directory containing SQL script
 -l directory on which log file written.
 -c list the containers in which SQL script is run.
 -C list the containers in which SQL script is not run.
 -p degree of parallelism.
 -e means echo on when script running.
 -s spool on
 -E When ON, errors are written to the table SPERRORLOG in the current schema.
 -I Identifier for Error logging option
 -g generating debugging information.
 -f ignore if PDB’s database is closed.
 -b base name of log file (mandatory)