Restore JAVA Virtual Machine and Oracle Multimedia

SYMPTOM

When installing 12.1.0.2 Oracle options from DBCA, there are memory issues during install JVM and Oracle multimedia, so the installation failed by leaving those two options with status ‘LOADING’, those two unhealthy options could not be removed cleanly by DBCA, so manual removing and reinstalling are required for fixing it.

SQL> select COMP_NAME,VERSION,STATUS,SCHEMA 
from dba_registry
order by 3;

COMP_ID COMP_NAME VERSION STATUS SCHEMA ------- ------------------------ ------------ -------- ------ JServer JAVA Virtual Machine LOADING SYS Oracle Multimedia LOADING ORDSYS Oracle Database Catalog Views 12.1.0.2.0 VALID SYS Oracle Database Packages and Types 12.1.0.2.0 VALID SYS Oracle Workspace Manager 12.1.0.2.0 VALID WMSYS Oracle Text 12.1.0.2.0 VALID CTXSYS Oracle XML Database 12.1.0.2.0 VALID XDB
7 rows selected.

Please note your issue and situation might be different. Please raise a SR to Oracle Support to get advice for critical environment, otherwise it may cause issue worse and results in database unrecoverable which will need full database restore and recover, because manually removing and installing JVM and Multimedia is a  highly destructive action according to Oracle Support.

Remove and Reinstall Oracle JVM

  • Cold backup of whole database.
  • Removing Oracle unhealthy JVM :
Shutdown the database instance
Create the following REMOVAL script, full_rmjvm.sql
Run it from a new SQL*Plus session

spool full_rmjvm.log
set echo on
connect / as sysdba
startup mount
alter system set "_system_trig_enabled" = false scope=memory;
alter system enable restricted session;
alter database open;
@?/rdbms/admin/catnojav.sql
@?/xdk/admin/rmxml.sql
@?/javavm/install/rmjvm.sql
truncate table java$jvm$status;
select * from obj$ where obj#=0 and type#=0;
delete from obj$ where obj#=0 and type#=0;
commit;
select owner, count(*) from all_objects
where object_type like '%JAVA%' group by owner;
select obj#, name from obj$
where type#=28 or type#=29 or type#=30 or namespace=32;
select o1.name from obj$ o1,obj$ o2
where o1.type#=5 and o1.owner#=1 and o1.name=o2.name and o2.type#=29;
shutdown immediate
set echo off
spool off
exit
-- End of File full_rmjvm.sql
  • Check the log full_rmjvm.log, we can see JVM was not installed at all, in this case, we just reload it in next step.
SQL> Rem =====================================================================
SQL> Rem Check CATJAVA and JAVAVM status; conditionally abort the script
SQL> Rem =====================================================================
SQL> 
SQL> WHENEVER SQLERROR EXIT;
SQL> 
SQL> BEGIN
 2 IF dbms_registry.status('CATJAVA') IS NULL THEN
 3 RAISE_APPLICATION_ERROR(-20000,
 4 'CATJAVA has not been loaded into the database.');
 5 END IF;
 6 IF dbms_registry.is_loaded('JAVAVM') != 1 THEN
 7 RAISE_APPLICATION_ERROR(-20000,
 8 'JServer is not operational in the database; ' ||
 9 'JServer is required to remove CATJAVA from the database.');
 10 END IF;
 11 END;
 12 /
BEGIN
*
ERROR at line 1:
ORA-20000: CATJAVA has not been loaded into the database. 
ORA-06512: at line 3
  • Install the JVM
    Be sure the REMOVAL script, full_rmjvm.sql, completed successfully
    Create the following INSTALL script, full_jvminst.sql
    Run it from a new SQL*Plus session
    
    -- Start of File full_jvminst.sql
    spool full_jvminst.log;
    set echo on
    connect / as sysdba
    startup mount
    alter system set "_system_trig_enabled" = false scope=memory;
    alter database open;
    select obj#, name from obj$
    where type#=28 or type#=29 or type#=30 or namespace=32;
    @?/javavm/install/initjvm.sql
    select count(*), object_type from all_objects
    where object_type like '%JAVA%' group by object_type;
    @?/xdk/admin/initxml.sql
    select count(*), object_type from all_objects
    where object_type like '%JAVA%' group by object_type;
    @?/xdk/admin/xmlja.sql
    select count(*), object_type from all_objects
    where object_type like '%JAVA%' group by object_type;
    @?/rdbms/admin/catjava.sql
    select count(*), object_type from all_objects
    where object_type like '%JAVA%' group by object_type;
    shutdown immediate
    set echo off
    spool off
    exit
    -- End of File full_jvminst.sql
  • Check log and found no errors.
$ls -ltr full*jvm*
-rw-r--r--. 1 oracle oinstall 784 Nov 15 21:51 full_rmjvm.sql
-rw-r--r--. 1 oracle oinstall 2948 Nov 15 21:52 full_rmjvm.log
-rw-r--r--. 1 oracle oinstall 855 Nov 15 21:58 full_jvminstall.sql
-rw-r--r--. 1 oracle oinstall 9885882 Nov15 22:06 full_jvminst.log

$grep ORA- full_jvminst.log
129 dbms_output.put_line('retrying because of ORA-01545');
SQL> ## ORA-00028 it means that the database has not been restarted
SQL> ## ORA-29539: Java system classes already installed
SQL> ## ORA-29554: unhandled Java out of memory condition
 17 -- If the class does not exist an ORA-29532 (Uncaught Java
 27 -- If the class does not exist, an ORA-29532 (Uncaught Java
 43 -- If the class does not exist an ORA-29532 (Uncaught Java
 59 -- If the class does not exist an ORA-29532 (Uncaught Java
543 -- If the java schema object does not exist an ORA-29532 (Uncaught Java
 32 -- exist, an ORA-29532 (Uncaught Java exception) will occur.
 42 -- exist, an ORA-29532 (Uncaught Java exception) will occur.
 58 -- exist an ORA-29532 (Uncaught Java exception) will occur.
 74 -- exist an ORA-29532 (Uncaught Java exception) will occur.
SQL> -- in the current session it will cause an ORA-29549 (session state cleared)
SQL> ## ORA-01476: divisor is equal to zero
SQL>
  • Validate the Installation
SQL> column owner format A30
-- Validation Query 1
select count(*), object_type
from all_objects
where object_type like '%JAVA%'
and owner = 'SYS'
group by object_type;

COUNT(*) OBJECT_TYPE ---------- --------------- 297 JAVA DATA 911 JAVA RESOURCE 27473 JAVA CLASS 2 JAVA SOURCE
SQL> select owner, count(*)
from all_objects 
where object_type like '%JAVA%'
and owner = 'SYS'group by owner;

OWNER   COUNT(*)
------  ---------
SYS     28683

SQL> select owner, object_type, count(*)
from all_objects 
where object_type like '%JAVA%'
and status <> 'VALID'
and owner = 'SYS'
group by owner, object_type;

no rows selected
SQL>select comp_id,COMP_NAME,VERSION,STATUS,SCHEMA 
from dba_registry
order by 3;
COMP_ID COMP_NAME VERSION STATUS SCHEMA
------- ---------------------------------- ---------- ------ ------ CATALOG Oracle Database Catalog Views 12.1.0.2.0 VALID SYS CONTEXT Oracle Text 12.1.0.2.0 VALID CTXSYS OWM Oracle Workspace Manager 12.1.0.2.0 VALID WMSYS XDB Oracle XML Database 12.1.0.2.0 VALID XDB CATJAVA Oracle Database Java Packages 12.1.0.2.0 VALID SYS CATPROC Oracle Database Packages and Types 12.1.0.2.0 VALID SYS JAVAVM JServer JAVA Virtual Machine 12.1.0.2.0 VALID SYS XML Oracle XDK 12.1.0.2.0 VALID SYS ORDIM Oracle Multimedia LOADING ORDSYS 9 rows selected.
  • ADDITIONAL REMINDER: If you previously had any of the following database options installed:
    • Oracle Multimedia (ORDSYS, ORDIM)
    • Oracle Spatial (MDSYS)
    • Oracle Warehouse Builder (OWBSYS)
    • OLAP

    These options will need to be re-installed to reload their java dependencies.  This can be achieved by contacting the respective support teams for each product by logging a new Service Request.

Reinstall Oracle Multimedia

Install Oracle Mutlmedia according  to “Multimedia User’s Guide” section B Managing Oracle Multimedia Installations

  1. Check the prerequisites are existed including PL/SQL, Oracle JVM, Oracle XML Database, and Oracle XDK.
    SQL> select version,status 
    from dba_registry
    where comp_id='JAVAVM'; SQL> select version, status from dba_registry where comp_id='XDB'; SQL> select version, status from dba_registry where comp_id='XML';
  2. Go to /rdbms/admin directory and run catcon.pl  script to create the users and grant the appropriate privileges. The first parameter is the tablespace for Oracle Multimedia; the second parameter is the tablespace for Oracle Spatial and Graph.

    $ perl catcon.pl -u SYS -d $ORACLE_HOME/ord/admin -b ordinst ordinst.sql '--pSYSAUX' '--pSYSAUX' 
    catcon: ALL catcon-related output will be written to ordinst_catcon_14555.lst
    catcon: See ordinst*.log files for output generated by scripts
    catcon: See ordinst_*.lst files for spool files, if any
    Enter Password: 
    catcon.pl: completed successfully
  3. Run the script to install the Oracle Multimedia types and packages.
    $ perl catcon.pl -u SYS -d $ORACLE_HOME/ord/im/admin -b catim catim.sql
    catcon: ALL catcon-related output will be written to catim_catcon_14649.lst
    catcon: See catim*.log files for output generated by scripts
    catcon: See catim_*.lst files for spool files, if any
    Enter Password: 
    catcon.pl: completed successfully
  4. Verify the installation of Oracle Multimedia.
SQL> CONNECT sys as sysdba
SQL> execute sys.validate_ordim;
PL/SQL procedure successfully completed.

If the validation procedure detects invalid objects, it lists the first few invalid objects and sets the registry entry to INVALID; otherwise, it silently sets the Oracle Multimedia registry entry  VALID.

SQL> select version, status 
from dba_registry
where comp_id='ORDIM';
VERSION STATUS ------------ ------- 12.1.0.2.0 VALID
  • Check options validations.
SQL>select comp_id,COMP_NAME,VERSION,STATUS,SCHEMA 
from dba_registry
order by 4;
COMP_ID COMP_NAME VERSION STATUS SCHEMA --------- --------------------- ------------ ---------- ------ ------ ORDIM Oracle Multimedia 12.1.0.2.0 VALID ORDSYS CONTEXT Oracle Text 12.1.0.2.0 VALID CTXSYS OWM Oracle Workspace Manager 12.1.0.2.0 VALID WMSYS XDB Oracle XML Database 12.1.0.2.0 VALID XDB CATJAVA Oracle Database Java Packages 12.1.0.2.0 VALID SYS CATPROC Oracle Database Packages and Types 12.1.0.2.0 VALID SYS JAVAVM JServer JAVA Virtual Machine 12.1.0.2.0 VALID SYS XML Oracle XDK 12.1.0.2.0 VALID SYS CATALOG Oracle Database Catalog Views 12.1.0.2.0 VALID SYS 9 rows selected. SQL> select count(*) from dba_objects where status!='VALID'; COUNT(*) ---------- 0
Advertisement

One thought on “Restore JAVA Virtual Machine and Oracle Multimedia”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: