JAVAVM and XML Clean Up in Oracle Database 11.2-12.2

JAVAVM and XML Clean Up in Oracle Database 11.2-12.2JAVAVM and XML clean up in Oracle Database 11.2-12.2 is a tough topic. Many have suffered from the rolling patch upgrade issues with the OJVM (Oracle Java Virtual Machine) even though most of the issues have been cured with the recent patches.

Please see my previous blog posts starting here:

And please see also this very important MOS Note: 2217053.1 – RAC Rolling Install Process for the “Oracle JavaVM Component Database PSU” (OJVM PSU) Patches explaining the improved process for OJVM patching avoiding downtime in many cases.

JAVAVM and XML Clean Up in Oracle Database 11.2-12.2

JAVAVM and XML Clean Up in Oracle Database 11.2-12.2Before you start removing anything from your database please make sure you read my introductory blog post about how to Remove and Clean Up Components from Oracle 11.2 – 12.2 . You’ll find links to monitor proper component removal there as well as in the SQL Scripts Repository on this blog.

In the database’s registry, the two components JAVAVM and XML are bound closely together. I will describe below how to remove both at the same time.

Please be aware that the removal of JAVAVM and XML will invalidate the dependent components:

  • Oracle Multimedia
  • Oracle Spatial
  • Oracle OLAP

as well. Please check and understand my blog post OJVM Removal from Jun 22, 2015 explaining more about dependent objects and components.

If you want to read and learn more about Oracle’s JVM please check this link:

Oracle Database 11.2.0.4

You will find the process for the JAVAVM removal in Oracle Database 11.2.0.4 clearly described in MOS Note:1112983.1 –  How to Reload the JVM in 11.2.0.x. Please check this note as it contains extra steps for verification. Basically the removal process looks like this:

$ sqlplus / as sysdba
SQL> @?/rdbms/admin/catnojav.sql
SQL> @?/xdk/admin/rmxml.sql
SQL> @?/javavm/install/rmjvm.sql
SQL> @?/rdbms/admin/utlrp.sql
SQL> delete from registry$ where status='99' and cid in ('XML','JAVAVM','CATJAVA');
SQL> commit;

The recompilation is required. In my environments the database doesn’t have to be restarted or in upgrade mode as the above note implies. But as you’ll test this first in a test environment you may consider extra steps from the above note.

Oracle Database 12.1.0.2

In Oracle Database 12.1.0.2 the process to remove JAVAVM and XML is more or less the same as in Oracle 11.2.0.4. The only difference: you must clean up two objects after removal manually.

$ sqlplus / as sysdba
SQL> @?/rdbms/admin/catnojav.sql
SQL> @?/xdk/admin/rmxml.sql
SQL> @?/javavm/install/rmjvm.sql
SQL> @?/rdbms/admin/utlrp.sql
SQL> delete from registry$ where status='99' and cid in ('XML','JAVAVM','CATJAVA');
SQL> commit;

As the process will result in two leftover packages you will have to clean up these manually:

$ sqlplus / as sysdba
SQL> drop package SYS.JVMRJBCINV;
SQL> drop package SYS.JAVAVM_SYS;

Then the removal process has been completed successfully.

Oracle Database 12.2.0.1

non-CDB

The removal process in Oracle Database 12.2.0.1 for a non-CDB is exactly the same as in Oracle Database 12.1.0.2 for a non-CDB:

$ sqlplus / as sysdba
SQL> @?/rdbms/admin/catnojav.sql
SQL> @?/xdk/admin/rmxml.sql
SQL> @?/javavm/install/rmjvm.sql
SQL> @?/rdbms/admin/utlrp.sql
SQL> delete from registry$ where status='99' and cid in ('XML','JAVAVM','CATJAVA');
SQL> commit;

As the process will result in two leftover packages you will have to clean up these manually:

$ sqlplus / as sysdba
SQL> drop package SYS.JVMRJBCINV;
SQL> drop package SYS.JAVAVM_SYS;

Then the removal process has been completed successfully.

CDB

The removal process from a container database looks differently due to the need to execute the removal scripts with catcon.pl.

First of all you must execute the removal scripts. You can run them in all containers.

$ cd $ORACLE_HOME/rdbms/admin
$ $ORACLE_HOME/perl/bin/perl catcon.pl -n 1 -b catnojav -d /u01/app/oracle/product/12.2.0.1/rdbms/admin catnojav.sql
$ $ORACLE_HOME/perl/bin/perl catcon.pl -n 1 -b rmxml -d /u01/app/oracle/product/12.2.0.1/xdk/admin rmxml.sql
$ $ORACLE_HOME/perl/bin/perl catcon.pl -n 1 -b rmjvm -d /u01/app/oracle/product/12.2.0.1/javavm/install rmjvm.sql
$ $ORACLE_HOME/perl/bin/perl catcon.pl -n 1 -e -b utlrp -d '''.''' utlrp.sql

After the mandatory recompilation is completed you need to create a script to remove the component entries from REGISTRY$. This script needs to be executed in each container separately to avoid ORA-65023 errors:

$ vi reg.sql
    delete from registry$ where status='99' and cid in ('XML','JAVAVM','CATJAVA');
    commit;

Execute the script in each container, one after another:

$ $ORACLE_HOME/perl/bin/perl catcon.pl -c 'PDB2' -n 1 -b reg_pdb2 -d /u01/app/oracle/product/12.2.0.1/rdbms/admin reg.sql
$ $ORACLE_HOME/perl/bin/perl catcon.pl -c 'PDB1' -n 1 -b reg_pdb1 -d /u01/app/oracle/product/12.2.0.1/rdbms/admin reg.sql
$ $ORACLE_HOME/perl/bin/perl catcon.pl -c 'PDB$SEED' -n 1 -b reg_seed -d /u01/app/oracle/product/12.2.0.1/rdbms/admin reg.sql
$ $ORACLE_HOME/perl/bin/perl catcon.pl -c 'CDB$ROOT' -n 1 -b reg_cdb -d /u01/app/oracle/product/12.2.0.1/rdbms/admin reg.sql

And interesting enough, you don’t have to cleanup anything afterwards. All set.

Component Clean Up Series

Finally download a slide deck about the Component Clean Up on this blog:
https://mikedietrichde.com/slides/

Leave a Reply

Your email address will not be published. Required fields are marked *