A Oracle forneceu o script perl “catcon.pl” como um método para executar scripts SQL em um único contêiner ou em todos os contêineres.
No exemplo abaixo usei o script “catcon.pl” para executar o script “count.sql” e instalar o componente JAVA do diretório “$ORACLE_HOME/rdbms/admin”.
$ $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -u SYS/xxxxx -d /home/oracle/scripts -l /home/oracle/scripts/logs -b script_output count.sql catcon: ALL catcon-related output will be written to /home/oracle/scripts/logs/script_output_catcon_59455.lst catcon: See /home/oracle/scripts/logs/script_output*.log files for output generated by scripts catcon: See /home/oracle/scripts/logs/script_output_*.lst files for spool files, if any catcon.pl: completed successfully $ ls -litra total 100 520194 drwxr-xr-x 3 oracle oinstall 4096 May 8 09:45 .. 520199 -rw-r--r-- 1 oracle oinstall 410 May 8 09:47 script_output_catcon_59455.lst 520200 -rw-r--r-- 1 oracle oinstall 9605 May 8 09:47 script_output0.log 520201 -rw-r--r-- 1 oracle oinstall 9873 May 8 09:47 script_output1.log 520202 -rw-r--r-- 1 oracle oinstall 8241 May 8 09:47 script_output2.log 520203 -rw-r--r-- 1 oracle oinstall 8273 May 8 09:47 script_output3.log 520204 -rw-r--r-- 1 oracle oinstall 9733 May 8 09:47 script_output4.log 520205 -rw-r--r-- 1 oracle oinstall 8309 May 8 09:47 script_output5.log 520206 -rw-r--r-- 1 oracle oinstall 6719 May 8 09:47 script_output6.log 520207 -rw-r--r-- 1 oracle oinstall 6755 May 8 09:47 script_output7.log 520195 drwxr-xr-x 2 oracle oinstall 4096 May 8 09:47 .
Instale o componente JAVA apenas em PDBCAT_DEV
$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -u SYS/xxxxx -n 8 -c 'PDBCAT_DEV' -e -b jvminstall.log $ORACLE_HOME/javavm/install/initjvm.sql
Validar instalação
select comp_name, status, substr(version,1,10) as version from dba_registry where comp_name like '%JAVA%'; select object_name, object_type, status from dba_objects where status != 'VALID' order by object_type,object_name; @?/rdbms/admin/utlrp.sql
O Oracle mostra os seguintes argumentos disponíveis para “catcon.pl” [1]:
Referências
[1] Administrando um CDB com SQL*Plus. Disponível em:https://docs.oracle.com/database/121/ADMIN/cdb_admin.htm#ADMIN13606