Thursday, July 18, 2013

DB12c - update java to version 7

Why I used topic like that? I just wanted to post how to update java on Oracle Database 12c from version 6 to version 7. This is simple topic for some people, but it was something new for me today. As we know, Oracle 12c database default java version is 6.
Why do we have to update Java to version 7? Actually, It depends on what application java you write and load into Oracle Database. Unfortunately, it's a bad thing for existing database, you must shutdown database before!!!
SQL> select dbms_java.get_jdk_version() from dual;
DBMS_JAVA.GET_JDK_VERSION()
--------------------------------------------------------------------------------
1.6
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit;
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oracle@linux01 ~]$
[oracle@linux01 ~]$
[oracle@linux01 ~]$ /u01/app/oracle/product/12.1.0/dbhome_1/perl/bin/perl  $ORACLE_HOME/javavm/install/update_javavm_binaries.pl 1.7
Invalid version 1.7 ... Valid options are: 6 7
[oracle@linux01 ~]$ /u01/app/oracle/product/12.1.0/dbhome_1/perl/bin/perl  $ORACLE_HOME/javavm/install/update_javavm_binaries.pl 7
[oracle@linux01 ~]$
[oracle@linux01 ~]$
[oracle@linux01 ~]$
[oracle@linux01 ~]$ cd $ORACLE_HOME/rdbms/lib
[oracle@linux01 lib]$ ls -l ins_rdbms.mk
-rw-r--r--. 1 oracle oinstall 43646 Apr 29 09:07 ins_rdbms.mk 
[oracle@linux01 lib]$ make -f ins_rdbms.mk ioracle
chmod 755 /u01/app/oracle/product/12.1.0/dbhome_1/bin
 - Linking Oracle
rm -f /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/lib/oracle
/u01/app/oracle/product/12.1.0/dbhome_1/bin/orald  -o /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/lib/oracle -m64 -z noexecstack -Wl,--disable-new-dtags -L/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/lib/ -L/u01/app/oracle/product/12.1.0/dbhome_1/lib/ -L/u01/app/oracle/product/12.1.0/dbhome_1/lib/stubs/   -Wl,-E /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/lib/opimai.o /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/lib/ssoraed.o /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/lib/ttcsoi.o -Wl,--whole-archive -lperfsrv12 -Wl,--no-whole-archive /u01/app/oracle/product/12.1.0/dbhome_1/lib/nautab.o /u01/app/oracle/product/12.1.0/dbhome_1/lib/naeet.o /u01/app/oracle/product/12.1.0/dbhome_1/lib/naect.o /u01/app/oracle/product/12.1.0/dbhome_1/lib/naedhs.o /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/lib/config.o  -lserver12 -lodm12 -lcell12 -lnnet12 -lskgxp12 -lsnls12 -lnls12  -lcore12 -lsnls12 -lnls12 -lcore12 -lsnls12 -lnls12 -lxml12 -lcore12 -lunls12 -lsnls12 -lnls12 -lcore12 -lnls12 -lclient12  -lvsn12 -lcommon12 -lgeneric12 -lknlopt `if /usr/bin/ar tv /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/lib/libknlopt.a | grep xsyeolap.o > /dev/null 2>&1 ; then echo "-loraolap12" ; fi` -lskjcx12 -lslax12 -lpls12  -lrt -lplp12 -lserver12 -lclient12  -lvsn12 -lcommon12 -lgeneric12 `if [ -f /u01/app/oracle/product/12.1.0/dbhome_1/lib/libavserver12.a ] ; then echo "-lavserver12" ; else echo "-lavstub12"; fi` `if [ -f /u01/app/oracle/product/12.1.0/dbhome_1/lib/libavclient12.a ] ; then echo "-lavclient12" ; fi` -lknlopt -lslax12 -lpls12  -lrt -lplp12 -ljavavm12 -lserver12  -lwwg  `cat /u01/app/oracle/product/12.1.0/dbhome_1/lib/ldflags`    -lncrypt12 -lnsgr12 -lnzjs12 -ln12 -lnl12 -lnro12 `cat /u01/app/oracle/product/12.1.0/dbhome_1/lib/ldflags`    -lncrypt12 -lnsgr12 -lnzjs12 -ln12 -lnl12 -lnnzst12 -lzt12 -lztkg12 -lmm -lsnls12 -lnls12  -lcore12 -lsnls12 -lnls12 -lcore12 -lsnls12 -lnls12 -lxml12 -lcore12 -lunls12 -lsnls12 -lnls12 -lcore12 -lnls12 -lztkg12 `cat /u01/app/oracle/product/12.1.0/dbhome_1/lib/ldflags`    -lncrypt12 -lnsgr12 -lnzjs12 -ln12 -lnl12 -lnro12 `cat /u01/app/oracle/product/12.1.0/dbhome_1/lib/ldflags`    -lncrypt12 -lnsgr12 -lnzjs12 -ln12 -lnl12 -lnnzst12 -lzt12 -lztkg12   -lsnls12 -lnls12  -lcore12 -lsnls12 -lnls12 -lcore12 -lsnls12 -lnls12 -lxml12 -lcore12 -lunls12 -lsnls12 -lnls12 -lcore12 -lnls12 `if /usr/bin/ar tv /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/lib/libknlopt.a | grep "kxmnsd.o" > /dev/null 2>&1 ; then echo " " ; else echo "-lordsdo12"; fi` -L/u01/app/oracle/product/12.1.0/dbhome_1/ctx/lib/ -lctxc12 -lctx12 -lzx12 -lgx12 -lctx12 -lzx12 -lgx12 -lordimt12 -lclsra12 -ldbcfg12 -lhasgen12 -lskgxn2 -lnnzst12 -lzt12 -lxml12 -locr12 -locrb12 -locrutl12 -lhasgen12 -lskgxn2 -lnnzst12 -lzt12 -lxml12  -lgeneric12 -loraz -llzopro -lorabz2 -lipp_z -lipp_bz2 -lippdcemerged -lippsemerged -lippdcmerged  -lippsmerged -lippcore  -lippcpemerged -lippcpmerged  -lsnls12 -lnls12  -lcore12 -lsnls12 -lnls12 -lcore12 -lsnls12 -lnls12 -lxml12 -lcore12 -lunls12 -lsnls12 -lnls12 -lcore12 -lnls12 -lsnls12 -lunls12  -lsnls12 -lnls12  -lcore12 -lsnls12 -lnls12 -lcore12 -lsnls12 -lnls12 -lxml12 -lcore12 -lunls12 -lsnls12 -lnls12 -lcore12 -lnls12 -lasmclnt12 -lcommon12 -lcore12  -laio -lons    `cat /u01/app/oracle/product/12.1.0/dbhome_1/lib/sysliblist` -Wl,-rpath,/u01/app/oracle/product/12.1.0/dbhome_1/lib -lm    `cat /u01/app/oracle/product/12.1.0/dbhome_1/lib/sysliblist` -ldl -lm   -L/u01/app/oracle/product/12.1.0/dbhome_1/lib
test ! -f /u01/app/oracle/product/12.1.0/dbhome_1/bin/oracle ||\
           mv -f /u01/app/oracle/product/12.1.0/dbhome_1/bin/oracle /u01/app/oracle/product/12.1.0/dbhome_1/bin/oracleO
mv /u01/app/oracle/product/12.1.0/dbhome_1/rdbms/lib/oracle /u01/app/oracle/product/12.1.0/dbhome_1/bin/oracle
chmod 6751 /u01/app/oracle/product/12.1.0/dbhome_1/bin/oracle
[oracle@linux01 lib]$
-- Make sure You startup database from Oracle Home, that uses version 7 -- 
[oracle@linux01 ~]$ sqlplus  / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Thu Jul 18 21:13:56 2013
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup 
ORACLE instance started.
Total System Global Area 1636814848 bytes
Fixed Size                  2288904 bytes
Variable Size            1040188152 bytes
Database Buffers          587202560 bytes
Redo Buffers                7135232 bytes
Database mounted.
Database opened.
SQL>
SQL> @?/javavm/install/update_javavm_db.sql
SQL> SET FEEDBACK 1
SQL> SET NUMWIDTH 10
SQL> SET LINESIZE 80
SQL> SET TRIMSPOOL ON
SQL> SET TAB OFF
SQL> SET PAGESIZE 100
SQL>
SQL> -- If Java is installed, do CJS.
SQL>
SQL> -- If CJS can deal with the SROs inconsistent with the new JDK,
SQL> -- the drop_sros() call here can be removed.
SQL> call initjvmaux.drop_sros();
Call completed.
SQL>
SQL> create or replace java system;
  2  /
Java created.
SQL>
SQL> update dependency$
  2    set p_timestamp=(select stime from obj$ where obj#=p_obj#)
  3    where (select stime from obj$ where obj#=p_obj#)!=p_timestamp and
  4          (select type# from obj$ where obj#=p_obj#)=29  and
  5          (select owner# from obj$ where obj#=p_obj#)=0;
0 rows updated.
SQL>
SQL> select dbms_java.get_jdk_version() from dual;
DBMS_JAVA.GET_JDK_VERSION()
--------------------------------------------------------------------------------
1.7
1 row selected.

5 comments:

Anonymous said...

Thank You! This was extremely helpful.

Crow said...

Thank you so much!
This article helped me getting around a number of issues.

Please keep posting.

Unknown said...

Thanks lot this is very help full for me.

Please share any doc id related to this process if you have.

Thanks in advance.

Surachart Opun said...

Please check Oracle Doc

https://docs.oracle.com/database/121/JJDEV/chone.htm#JJDEV01100

Anonymous said...

thanks Surachart,
it was really helpful for me. I have searched a lot w.r.t. update java, but your document gave me right answer.