<<Back to DB Administration Main Page
How to Add the JVM Component to an Existing Oracle Database
Followed oracle Doc ID 1461562.1 and installed oracle JVM component in multitenant database, the script installed JVM component in CDB$ROOT container only and the component was still missing in PDB$SEED and all pluggable database. Since the script and steps mentioned in Doc ID 1461562.1 did not install the component in PDB$SEED , all future PDBs create in the container also inherited the issue and eventually JVM component was not installed in any of the PDBs.Scroll down to see how to install JVM component in a Multitenant Database environment using catcon.pl
How to Verify if JVM component is installed or not
select comp_name, version, status from dba_registry where comp_name like '%JAVA%' ;
COMP_NAME VERSION STATUS
------------------------------------------------------------ ------------------------------ ---------------
JServer JAVA Virtual Machine 12.1.0.2.0 VALID
COMP_NAME VERSION STATUS
------------------------------------------------------------ ------------------------------ ---------------
JServer JAVA Virtual Machine 12.1.0.2.0 VALID
select count(*), object_type from all_objects
where object_type like '%JAVA%' group by object_type;
where object_type like '%JAVA%' group by object_type;
COUNT(*) OBJECT_TYPE
---------- -----------------------
300 JAVA DATA
912 JAVA RESOURCE
27924 JAVA CLASS
2 JAVA SOURCE
---------- -----------------------
300 JAVA DATA
912 JAVA RESOURCE
27924 JAVA CLASS
2 JAVA SOURCE
select count(obj#) from obj$ where type#=28 or type#=29 or type#=30 or namespace=32 ;
COUNT(OBJ#)
-----------
29138
-----------
29138
NOTE: The above query will return no rows if JVM component not installed
Installing JVM Component to an Existing Non-Multitenant Oracle Database
sqlplus "/as sysdba"
startup mount
spool full_jvminst.log;
set echo on
set echo on
alter system set "_system_trig_enabled" = false scope=memory;
alter database open;
alter database open;
@?/javavm/install/initjvm.sql
@?/xdk/admin/initxml.sql
@?/xdk/admin/xmlja.sql
@?/rdbms/admin/catjava.sql
@?/rdbms/admin/catexf.sql
select count(*), object_type from all_objects
where object_type like '%JAVA%' group by object_type;
where object_type like '%JAVA%' group by object_type;
shutdown immediate
set echo off
spool off
exit
set echo off
spool off
exit
NOTE: Above steps will install JVM only in CDB$ROOT container and therefore useless to follow the steps for 12c Multitenant environment.
How to Add the JVM Component to an Existing Multitenant (12c) Oracle Database
After doing some research I come across another document (Doc ID 2366476.1) which is talking about the steps and scripts to install JVM in multitenant environment1> Verify if JVM is already installed
SQL> alter session set container=PDB$SEED ;
Session altered.
SQL> select count(*), object_type from all_objects where object_type like '%JAVA%' group by object_type;
no rows selected
select comp_name, version, status from dba_registry where comp_name like '%JAVA%' ;
no rows selected
select count(obj#) from obj$ where type#=28 or type#=29 or type#=30 or namespace=32 ;
COUNT(OBJ#)
no rows selected
SQL> alter session set container=PDB01;
QL> select count(*), object_type from all_objects where object_type like '%JAVA%' group by object_type;
no rows selected
select comp_name, version, status from dba_registry where comp_name like '%JAVA%' ;
no rows selected
select count(obj#) from obj$ where type#=28 or type#=29 or type#=30 or namespace=32 ;
COUNT(OBJ#)
COUNT(OBJ#)
no rows selected
SQL>alter pluggable database all open;
SQL>alter system set "_system_trig_enabled" = false scope=memory;
SQL>host $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -l /home/oracle -b initjvm $ORACLE_HOME/javavm/install/initjvm.sql;
SQL>host $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -l /home/oracle -b initxml $ORACLE_HOME/xdk/admin/initxml.sql;
SQL>host $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -l /home/oracle -b xmlja $ORACLE_HOME/xdk/admin/xmlja.sql;
SQL>host $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -l /home/oracle -b catjava $ORACLE_HOME/rdbms/admin/catjava.sql;
SQL>shutdown immediate
SQL>set echo off
SQL>spool off
Let us See if the Step Works
SQL> host $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -l /home/oracle -b initjvm $ORACLE_HOME/javavm/install/initjvm.sql;catcon: ALL catcon-related output will be written to /home/oracle/initjvm_catcon_30040.lst
catcon: See /home/oracle/initjvm*.log files for output generated by scripts
catcon: See /home/oracle/initjvm_*.lst files for spool files, if any
catcon.pl: completed successfully
catcon: See /home/oracle/initjvm*.log files for output generated by scripts
catcon: See /home/oracle/initjvm_*.lst files for spool files, if any
catcon.pl: completed successfully
SQL> select count(*), object_type from all_objects
where object_type like '%JAVA%' group by object_type;
where object_type like '%JAVA%' group by object_type;
COUNT(*) OBJECT_TYPE
---------- -----------------------
300 JAVA DATA
912 JAVA RESOURCE
27924 JAVA CLASS
2 JAVA SOURCE
---------- -----------------------
300 JAVA DATA
912 JAVA RESOURCE
27924 JAVA CLASS
2 JAVA SOURCE
SQL> host $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -l /home/oracle -b initxml $ORACLE_HOME/xdk/admin/initxml.sql;
catcon: ALL catcon-related output will be written to /home/oracle/initxml_catcon_6175.lst
catcon: See /home/oracle/initxml*.log files for output generated by scripts
catcon: See /home/oracle/initxml_*.lst files for spool files, if any
catcon.pl: completed successfully
catcon: See /home/oracle/initxml*.log files for output generated by scripts
catcon: See /home/oracle/initxml_*.lst files for spool files, if any
catcon.pl: completed successfully
SQL> select count(*), object_type from all_objects
where object_type like '%JAVA%' group by object_type;
where object_type like '%JAVA%' group by object_type;
COUNT(*) OBJECT_TYPE
---------- -----------------------
300 JAVA DATA
912 JAVA RESOURCE
27924 JAVA CLASS
2 JAVA SOURCE
---------- -----------------------
300 JAVA DATA
912 JAVA RESOURCE
27924 JAVA CLASS
2 JAVA SOURCE
SQL> host $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -l /home/oracle -b xmlja $ORACLE_HOME/xdk/admin/xmlja.sql;
catcon: ALL catcon-related output will be written to /home/oracle/xmlja_catcon_11322.lst
catcon: See /home/oracle/xmlja*.log files for output generated by scripts
catcon: See /home/oracle/xmlja_*.lst files for spool files, if any
catcon.pl: completed successfully
catcon: See /home/oracle/xmlja*.log files for output generated by scripts
catcon: See /home/oracle/xmlja_*.lst files for spool files, if any
catcon.pl: completed successfully
SQL>select count(*), object_type from all_objects
where object_type like '%JAVA%' group by object_type;
COUNT(*) OBJECT_TYPE
---------- -----------------------
300 JAVA DATA
912 JAVA RESOURCE
27924 JAVA CLASS
2 JAVA SOURCE
where object_type like '%JAVA%' group by object_type;
COUNT(*) OBJECT_TYPE
---------- -----------------------
300 JAVA DATA
912 JAVA RESOURCE
27924 JAVA CLASS
2 JAVA SOURCE
SQL> host $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -l /home/oracle -b catjava $ORACLE_HOME/rdbms/admin/catjava.sql;
catcon: ALL catcon-related output will be written to /home/oracle/catjava_catcon_11745.lst
catcon: See /home/oracle/catjava*.log files for output generated by scripts
catcon: See /home/oracle/catjava_*.lst files for spool files, if any
catcon.pl: completed successfully
SQL>select count(*), object_type from all_objects
where object_type like '%JAVA%' group by object_type;
where object_type like '%JAVA%' group by object_type;
COUNT(*) OBJECT_TYPE
---------- -----------------------
300 JAVA DATA
912 JAVA RESOURCE
27924 JAVA CLASS
2 JAVA SOURCE
---------- -----------------------
300 JAVA DATA
912 JAVA RESOURCE
27924 JAVA CLASS
2 JAVA SOURCE
SQL>set echo off
SQL>spool off
SQL>spool off
SQL>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
Database dismounted.
ORACLE instance shut down.
SQL> startup
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 READ WRITE NOSQL> alter session set container=PDB01;
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB01 READ WRITE NOSQL> alter session set container=PDB01;
Session altered.
SQL>select count(*), object_type from all_objects
where object_type like '%JAVA%' group by object_type;
where object_type like '%JAVA%' group by object_type;
COUNT(*) OBJECT_TYPE
---------- -----------------------
299 JAVA DATA
912 JAVA RESOURCE
27877 JAVA CLASS
2 JAVA SOURCE
---------- -----------------------
299 JAVA DATA
912 JAVA RESOURCE
27877 JAVA CLASS
2 JAVA SOURCE
SQL> alter session set container=PDB$SEED ;
Session altered.
SQL> select count(*), object_type from all_objects where object_type like '%JAVA%' group by object_type;
COUNT(*) OBJECT_TYPE
---------- -----------------------
299 JAVA DATA
912 JAVA RESOURCE
27877 JAVA CLASS
2 JAVA SOURCE
---------- -----------------------
299 JAVA DATA
912 JAVA RESOURCE
27877 JAVA CLASS
2 JAVA SOURCE
SQL> alter session set container=PDB01;
Session altered.
SQL>select count(*), object_type from all_objects
where object_type like '%JAVA%' group by object_type;
where object_type like '%JAVA%' group by object_type;
COUNT(*) OBJECT_TYPE
---------- -----------------------
299 JAVA DATA
912 JAVA RESOURCE
27877 JAVA CLASS
2 JAVA SOURCE
---------- -----------------------
299 JAVA DATA
912 JAVA RESOURCE
27877 JAVA CLASS
2 JAVA SOURCE
SQL>exit
Comments
Post a Comment