Oracle JAVAVM 组件 Reload 说明

 

一.JAVAVM 组件 说明

 

有关Oracle 所有组件的概述,参考:

Oracle 8i/9i/10g/11g 组件(Components) 说明

http://blog.csdn.net/tianlesoftware/article/details/5937382

 

现在我们查看组件的信息:

SQL> col comp_id for a15

SQL> col version for a15

SQL> col comp_name for a30

SQL> select comp_id,comp_name,version from dba_registry ;

 

COMP_ID         COMP_NAME                      VERSION

--------------------------------------------- ---------------

XDB             Oracle XML Database            11.2.0.3.0

AMD             OLAP Catalog                   11.2.0.3.0

EM              Oracle Enterprise Manager      11.2.0.3.0

SDO            Spatial                        11.2.0.3.0

ORDIM           Oracle Multimedia              11.2.0.3.0

CONTEXT         Oracle Text                    11.2.0.3.0

ODM             Oracle Data Mining             11.2.0.3.0

EXF             Oracle Expression Filter       11.2.0.3.0

RUL             Oracle Rules Manager           11.2.0.3.0

OWM             Oracle Workspace Manager       11.2.0.3.0

CATALOG         Oracle Database Catalog Views  11.2.0.3.0

 

COMP_ID         COMP_NAME                      VERSION

--------------------------------------------- ---------------

CATPROC         Oracle Database Packages and T11.2.0.3.0

                ypes

 

JAVAVM          JServer JAVA Virtual Machine   11.2.0.3.0

XML             Oracle XDK                     11.2.0.3.0

CATJAVA         Oracle Database Java Packages  11.2.0.3.0

XOQ             Oracle OLAP API                11.2.0.3.0

APS             OLAP Analytic Workspace        11.2.0.3.0

 

17 rows selected.

 

MOS 对JAVAVM组件的描述:

JVM is aplatform-independent execution environment that converts Java bytecode intomachine language and executes it. Most programming languages compile sourcecode directly into machine code that is designed to run on a specificmicroprocessor architecture or operating system, such as Windows or UNIX.

--JVM 是一个独立的执行环境平台,其可以直接将Java源码编译成机器码,然后在特定的处理器架构或者系统下执行。

 

A JVM -- amachine within a machine -- mimics a real Java processor, enabling Javabytecode to be executed as actions or operating system calls on any processorregardless of the operating system.

--JVM 是机器中的机器,其有执行的Java 进程软件,可以执行Java bytecode。因为其是一个虚拟的machine,因此可以在任何操作系统上安装JVM并执行Java bytecode。

 

For example,establishing a socket connection from a workstation to a remote machineinvolves an operating system call. Since different operating systems handlesockets in different ways, the JVM translates the programming code so that thetwo machines that may be on different platforms are able to connect. 

 

Oracle JServerOption is a Java Virtual Machine (Java VM) which runs within the Oracle databaseserver's address space. Oracle also provides a JServer Accelerator to compileJava code natively. This speeds up the execution of Java code by eliminatinginterpreter overhead. 

--Oracle JServer 是Java VM 一个可选的组件,其运行在Oracle DB 的address space。 Oracle 也提供一个JServerAccelerator 来在本地编译Java Code。

 

NCOMP 说明:

The Javalanguage was designed for a platform-independent,  secure developmentmodel. Translating Java  bytecodes into machine instructions degradesperformance.  To regain some of the performance loss, you may chooseto  natively compile certain classes.

 

For example, youmay decide to natively compile code with CPU intensive classes and thiscan be achived using NCOMP.

 

In 10g one caninstall NCOMP from companion CD if they are really using JAVA intensiveapplication an facing any performance issues because of the reason given above.

 

MOS 文档说明:

How to use JServer Accelerator and theNCOMP Utility [ID 134985.1]

 

JVM 组件使用的用户:

SYS 

 

官方文档对JVM说明:

Overviewof the Java Virtual Machine (JVM)

Master Note for Oracle JVM [ID 1098505.1]

 

 

二.JVM 重建

MOS 相关文档:

Note.153271.1 Howto manually install JVM into 8i database 
Note.126029.1 Howto Remove the Jserver (JVM) in versions 8.1.5 and 8.1.6 of the rdbms 
Note.175472.1 Howto Reload the JVM in 8.1.7.X 
Note.202914.1 Howto Reload the JVM in 9.0.1.X 
Note.209870.1 Howto Reload the JVM in 9.2.0.X 
Note.276554.1 Howto Reload the JVM in 10.1.0.X and 10.2.0.X 
Note.457279.1 Howto Reload the JVM in 11.1.0.x 
Note.1112983.1 Howto Reload the JVM in 11.2.0.x

 

2.1 Oracle 10g Reload

(1) Verify that the ORACLE_HOMEand ORACLE_SID environment variables are set correctly in the environment, andthat the following system requirements are available: 

--验证ORACLE_HOME,ORACLE_SID等环境变量,及如下的要求:

      The SharedPool has at least 50Mb of free space. 
      The Java Pool has at least 20Mb of free space 
      The SYSTEM tablespace has at least 70Mb of freespace 
      The SYSTEM RBS has at least 100Mb of free space 

 

The initjvm.sqlscript in 10g will check these resources are available when it is run, and ifthey aren't available the execution of the script will terminate with an errorindicating which resource needs to be increased.

--在Oracle 10g中,initjvm.sql 会检查这些要求,只有符合才能继续。

 

(2).  Verify that theJAccelerator (NCOMP) is installed in the Oracle home.  The JAccelerator(NCOMP) is a recommended installation component in 10g when using the JVM asspecified in the patchset release notes.  Failure to install theJAccelerator (NCOMP) will result in an ORA-29558 error being signaled duringthe JVM installation and dramatically reduced performance when executing Javacode, see Note:293658.1

       --验证JAccelerator(NCOMP)安装。 JAccelerator 是推荐安装的。如果没有安装JAccelerator,那么在JVM安装时会触发ORA-29558错误。

 

(3).  Shutdown the instance andthen create and run the following sql script from a new sqlplus session:

--shutdown 实例,然后执行如下脚本:

-- Start of File full_rmjvm.sql 
 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/catnoexf.sql 
 @?/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 ando2.type#=29; 
 shutdown immediate 
 set echo off 
 spool off 
 exit 
-- End of File full_rmjvm.sql 

 

The actions above are required to resolvesome known issues, such as bug:1365707

 

IMPORTANT NOTES 

注意事项:

a)  TheSHUTDOWN command is needed here to ensure that the database is synchronized todisk after running rmjvm.sql.  Failure to perform this action can resultin spurious errors such as:

ORA-29549: class%s.%s has changed, Java session state cleared 
when running initjvm.sql. 

b)  The EXIT command is needed here to ensure that the sqlplus sessionresynchronizes its cache with the database, again to prevent spurious errorsoccurring when running the JVM initialization scripts. 

 

(4).  Check that the previousscript completed ok.  You can ignore object doesn't exist type errors heresuch as: 

--确认之前的脚本执行完毕,可以忽略类似如下的错误:

ORA-04043: object XMLGEN does not exist 
ORA-01432: public synonym to be dropped does not exist 


raised when running rmxml.sql.  Also, ORA-39705 errors from the executionof catnoexf.sql, e.g.:
ORA-39705: component 'EXF' not found in registry


can be ignored, as these are expected.

 

The last threeselect statements should show no java objects remaining, and that theSYS.JAVA$CLASS$MD5$TABLE was removed successfully before proceeding. 

 

In some cases you may see some rowsreturned by the last but one query, e.g:

SQL> select obj#, name fromobj$ where type#=28 or type#=29 or type#=30 or namespace=32;

OBJ# NAME 
---------- ------------------------------ 
44909 JAVA$POLICY$SHARED$00000001 
44910 JAVA$POLICY$SHARED$00000002 
2 rows selected. 

 

These can besafely ignored if they only reference object names of the form'JAVA$POLICY$SHARED$<sequence number>', providing they no longer appearonce the instance is restarted.  If any other rows are returned, or if youhave any doubts, stop at this point and contact Oracle Support supplying thelog file generated above.

If you encounteran OCI-21500 "internal error code, arguments: [koxsihread1]" error,then please see Note:350972.1 toresolve that error.

 

If you encounter an ORA-20000 "JServer is not operational in the database; JServer isrequired to remove CATJAVA from the database" error, then please see Note:757771.1 toresolve that error. 

If the abovecommands completed successfully, then create and run the following sql script,ensuring that you disable any password verification scripts you have enabled,otherwise you may encounter ORA-28003/ORA-20001 errors when executing the catexf.sqlscript which uses a hard coded password for the EXFSYS user:

-- Start of Filefull_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; 
 @?/rdbms/admin/catexf.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 

 

If you encounter an OCI-21500"internal error code, arguments: [koxsihread1]" error, then pleasesee Note:350972.1 toresolve that error.

(5).  Once the database has beenrestarted, resolve any invalid objects by running the utlrp.sql script e.g.:TheJVM should now be fully installed (including the XDK & XSU).  The countof Java objects returned above should be around 14987 (on NT) for the SYSuser. 

In a full JVMinstallation depending upon the platform and products installed, the objectscan be broken down by owner as follows:

  @?/rdbms/admin/utlrp.sql 

 

The JVM shouldnow be fully installed (including the XDK & XSU). The count of Java objectsreturned above should be around 14987 (on NT) for the SYS user.  In a fullJVM installation depending upon the platform and products installed, theobjects can be broken down by owner as follows:

SQL> select owner, count(*) fromall_objects where object_type like '%JAVA%' group by owner; 

OWNER COUNT(*) 
------------------------------ ---------- 
DMSYS 467 
EXFSYS 40 
MDSYS 117 
ORDSYS 1354 
SYS 14987 
WKSYS 20 

NOTE: These count totals may be slightly higher on 10gR2 than on 10g R1. 

 

If you previously had the InterMedia (ORDSYS), UltraSearch (WKSYS) Data Mining(DMSYS), Spatial (MDSYS) or (EXFSYS) options installed, then these will need tobe re-installed to reload their java dependencies. 

 

This can be achieved by executing thefollowing commands:

 spool jvm_refresh.log 
 connect / as sysdba 
 @?/ord/im/admin/iminst.sql; 
 connect / as sysdba 
 @?/dm/admin/dminst1.sql SYSAUX TEMP <Your $ORACLE_HOME/dm/admindirectory>; 
 connect / as sysdba 
 @?/md/admin/mdinst.sql; 
 connect / as sysdba 
 @?/dm/admin/dminst2.sql; 
 connect / as sysdba 
 @?/ultrasearch/admin/wk0deinst.sql SYS change_on_install ""; 
 connect / as sysdba 
 @?/ultrasearch/admin/wk0install.sql SYS change_on_installchange_on_install 
 SYSAUX TEMP "" PORTAL false; 
 connect / as sysdba 
 alter user WKSYS account unlock identified by change_on_install; 
 @?/ultrasearch/admin/wk0config.sql change_on_install 
   (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP) 
   (HOST=<Your hostname>)(PORT=1521)) 
   (CONNECT_DATA=(SERVER=DEDICATED) 
   (SERVICE_NAME=<Your SID NAME>.<Your Domain Name>))) 
   false " "; 
 spool off 

 

2.2 Oracle 11gR2 Reload

 

(1). Verify the following systemrequirements are available: 

The Shared Pool has at least 96Mb of freespace. 
The Java Pool has at least 50Mb of free space 
The SYSTEM tablespace has at least 70Mb of free space 
The SYSTEM RBS has at least 100Mb of free space 

The initjvm.sqlscript in 11g will check these resources are available when it is run, and ifthey aren't available the execution of the script will terminate with an errorindicating which resource needs to be increased. 

 

(2). Shutdown the instance and thencreate and run the following sql script from a new sqlplus session: 

 

-- Start of File full_rmjvm.sql
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/catnoexf.sql
@?/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

 

The actions above are required to resolvesome known issues, such as: 

Bug1365707 ORA-955 ON CREATE OR REPLACE JAVA SYSTEM (INITJVM) AFTER FULLREMOVAL 

Unpublished Bug 1744593 TRYING TO INSTALLJVM IN SAME SESSION AS IT WAS REMOVED FROM GENERATES ORA-29549 

 

IMPORTANT NOTES 

注意事项:

=============== 
a) The SHUTDOWN command is needed here to ensure that the database issynchronized to disk after running rmjvm.sql. Failure to perform this actioncan result in spurious errors when running initjvm.sql such as: 
ORA-29549: class %s.%s has changed, Java session state cleared 

 

b) The EXIT command is needed here toensure that the sqlplus session resynchronizes its cache with the database,again to prevent spurious errors occurring when running the JVM initializationscripts. 

c) There is a known unpublished bug 9711406 that causes ORA-600[17037] whenrunning the rmxml.sql portion of the removal scripts above. 
This can be fixed by applying patch for unpublished Base Bug 8940094 to any11.2.0.1 installations. This is fixed in 11.2.0.2. 
These errors will not prevent a successful removal/reinstall though so stepscan still be carried out without patch applied. 


(3). Check that the previous scriptcompleted successfully. 

 

You can ignore object doesn't exist typeerrors here such as: 
ORA-04043: object XMLGEN does not exist 
ORA-01432: public synonym to be dropped does not exist 

raised when running rmxml.sql. The lastthree select statements should show no java objects remaining. 

 

In some cases you may see some rows returnedby the last but one query, e.g: 

SQL> select obj#, name from obj$ 
2> where type#=28 or type#=29 or type#=30 or namespace=32; 

OBJ# NAME 
---------- ------------------------------ 
44909 JAVA$POLICY$SHARED$00000001 
44910 JAVA$POLICY$SHARED$00000002 

These objectscan be safely ignored if they only reference object names in the form ofJAVA$POLICY$SHARED$<sequence number>', providing they no longer appearonce the instance is restarted. If any other rows are returned, or if you haveany doubts, stop at this point and contact Oracle Support Services (OSS)supplying the log file generated above. 

If the above commands completed successfully, then create and run the following sqlscript: 

 

-- 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;
@?/rdbms/admin/catexf.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


If theinitjvm.sql script errors with an ORA-955 error executing the "create orreplace java system" command, then see the following note on Metalink fordetails on how to resolve this. 

Note276457.1 How to Resolve ORA-955 Errors When Running initjvm.sql 


(4). Once the database has beenrestarted, resolve any invalid objects. 

 

This can be performed by running theutlrp.sql script e.g.: 
@?/rdbms/admin/utlrp.sql 

The JVM shouldnow be fully installed. The count of Java objects returned above should bearound 21223 (on Windows XP) for the SYS user. 

In a full JVM installation the following default objects should exist. 

SQL> select owner, count(*) from all_objects 
2 where object_type like '%JAVA%' group by owner; 

OWNER COUNT(*) 
------------------------------ ---------- 

SYS 21313 

EXFSYS 48 

 

NOTE: Theseobject counts can vary by a few hundred on different Operating Systems anddifferent flavors of Operating Systems. As a general rule if the object countfor SYS is in the region of 21000 with no invalid SYS objects then this wouldbe considered a full JVM installation. 

If youpreviously had the InterMedia (ORDSYS), UltraSearch (WKSYS) Data Mining(DMSYS), Spatial (MDSYS) or (EXFSYS) options installed, then these will need tobe re-installed to reload their java dependencies. This can be achieved bycontacting the respective support teams for each product by logging a newService Request. 

 

 

三.常见问题参考

HOW DOES ORACLE STORE JAVA CLASSES INTODATABASE [ID 156439.1]

How To Find The Java Source Of A Java StoredProcedure [ID 265293.1]
How to Check Oracle JVM is Installed in the Database [ID 397770.1]

Simple Java Stored Procedure to Check thatthe Oracle JVM is Operating Correctly [ID 471867.1]

 

 

 

 

 

 

-------------------------------------------------------------------------------------------------------

版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!

Skype: tianlesoftware

Email:   tianlesoftware@gmail.com

Blog:     http://www.tianlesoftware.com

Weibo: http://weibo.com/tianlesoftware

Twitter: http://twitter.com/tianlesoftware

Facebook: http://www.facebook.com/tianlesoftware

Linkedin: http://cn.linkedin.com/in/tianlesoftware

 


-------加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请----

DBA1 群:62697716(满);   DBA2 群:62697977(满)  DBA3 群:62697850(满)  

DBA 超级群:63306533(满);  DBA4 群:83829929   DBA5群: 142216823

DBA6 群:158654907    DBA7 群:172855474   DBA总群:104207940

posted @ 2012-03-08 20:51  hibernate我最强  阅读(679)  评论(0编辑  收藏  举报