Oracle JVM、XDB的安装于卸载

博客首页 » Oracle JVM、XDB的安装于卸载

发布于 08 Jun 2014 03:29
标签 blog
来自于StackOverflow的安装、卸载说明
Here are the steps that needs to be carried out to re-install the JAVA Virtual Machine.

http://stackoverflow.com/questions/11788194/how-to-install-jvm-in-oracle

1.To uninstall (if already installed) the current installation of JAVA Virtual Machine, execute the following scripts at the SQL prompt connected as sys user.

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;
Once all the above commands have been executed successfully, restart the database. Shutdown of the database is necessary to ensure that the changes are synchronized with the disk after removal of JAVA Virtual Machine.

2.To install the JAVA Virtual Machine execute the following scripts at the SQL prompt connected as sys user.

startup mount
alter system set "_system_trig_enabled" = false scope=memory;
alter database open;
@?/javavm/install/initjvm.sql
@?/xdk/admin/initxml.sql
@?/xdk/admin/xmlja.sql
@?/rdbms/admin/catjava.sql
shutdown immediate;
3.Start the database and resolve any INVALID objects by executing the utlrp.sql script.

@?/rdbms/admin/utlrp.sql

Now the JVM should be fully installed and functional.

SQL> select comp_name, version, status from dba_registry;

Please go through Knowlege Mgmt Note ID 757771.1 How to Reload the JVM in 10.1.0.X and 10.2.0.X in Oracle Support (formerly metalink ) to go through a much detailed step by step process (with video) to resolve any issues that you may be facing. This note also consists of several other Notes that resolve different issues.

另外,这里有一个更加详细的Java级XDB的安装、卸载说明

Oracle JAVAVM 组件 Reload 说明

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

一.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: moc.liamg|erawtfoselnait#moc.liamg|erawtfoselnait
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 XDB 组件 重建 说明

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

一. XDB 组件说明
1.1 官网说明:
XDB 全称XML DB,官网的说明如下:
http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb01int.htm

Overviewof Oracle XML DB
OracleXML DB Architecture
OracleXML DB Features
OracleXML DB Benefits
SearchXML Data using Oracle Text
BuildMessaging Applications using Oracle Streams Advanced Queuing
StandardsSupported by Oracle XML DB
OracleXML DB Technical Support
OracleXML DB Examples Used in This Manual
FurtherOracle XML DB Case Studies and Demonstrations

这里我们简单的看一下overview,具体内容,感兴趣的自己研究。

OracleXML DB is a set of Oracle Database technologies related tohigh-performance handling of XML data: storing, generating, accessing,searching, validating, transforming, evolving, and indexing. Itprovides native XML support by encompassing both the SQL and XML data models inan interoperable way. Oracle XML DB is included as part of Oracle Databasestarting with Oracle9i Release 2 (9.2).
- - Oracle 从9.2中引入XDB,XDB 是关于高性能处理XML 数据的一个技术的集合,其包含storing,generating, accessing,searching, validating, transforming, evolving, and indexing。 XDB提供本地XML支持。

1.2 MOS 说明:
Oracle8i/9i/10g/11g 组件(Components) 说明
http://blog.csdn.net/tianlesoftware/article/details/5937382

ExtensibleMarkup Language (XML) is a tag-based markup language that lets developerscreate their own tags to describe data that's exchanged between applicationsand systems. XML is widely adopted as the common language of informationexchange between companies. It is human-readable; that is, it is plain text.Because it is plain text, XML documents and XML-based messages can be senteasily using common protocols, such as HTTP or FTP.
Oracle XML DBtreats XML as a native datatype in the database. Oracle XML DB is not aseparate server. The XML data model encompasses both unstructured content andstructured data. Applications can use standard SQL and XML operators togenerate complex XML documents from SQL queries and to store XML documents.
Oracle XML DB provides capabilities forboth content-oriented and data-oriented access. For developers who see XML asdocuments (news stories, articles, and so on), Oracle XML DB provides an XMLrepository accessible from standard protocols and SQL.
The Oracle XMLdeveloper's kits (XDK) contain the basic building blocks for reading,manipulating, transforming, and viewing XML documents, whether on a file systemor stored in a database. They are available for Java, C, and C++. Unlike manyshareware and trial XML components, the production Oracle XDKs are fullysupported and come with a commercial redistribution license.

Schema:
- - - - - - - - -
XDB: Stores XML database related schema objects.
- - XDB compent 对应的用户,其用来存储相关对象。

1.3 使用XDB 组件的注意事项
(1)Please note that 9.2.0.3 is a mandatoryminimum patch level for XDB. Customers using XDB must be on Oracle databaseversion 9.2.0.3 or higher.
(2)It is recommended to take a fullbackup of the database before removing / reinstalling XDB.
(3)Before installing or upgrading XDB,make sure the LD_LIBRARY_PATH / LIBPATH / SHLIB_PATH environment variable isset correctly. That is, the first directory referenced should be$ORACLE_HOME/lib. This environment variable is used to resolve thelocation of the shared library "libxdb.so".
(4)XDB must have execute permissionson the DBMS_LOB and UTL_FILE packages. XDB automatically has theseprivileges because they are granted to PUBLIC by default. If theseprivileges have been revoked from PUBLIC for security reasons, errors will be reportedduring the installation / upgrade of XDB and many XDB objects will becomeinvalid, making the component itself invalid. Therefore, grant executeprivileges on these packages back to PUBLIC before installing / upgrading XDBor if you do not wish for PUBLIC to have these permissions, after the install /upgrade, grant execute permissions on these packages directly to XDB and run$ORACLE_HOME/rdbms/admin/utlrp.sql to recompile the invalid objects.

1.4 查看XDB 组件
可以用如下SQL 查看一下DB中的组件:
SQL> col comp_id for a15
SQL> col version for a15
SQL> col comp_name for a30

SQL> select comp_id,comp_name,version,status from dba_registry;

COMP_ID COMP_NAME VERSION STATUS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AMD OLAP Catalog 11.2.0.3.0 VALID
EM Oracle Enterprise Manager 11.2.0.3.0 VALID
SDO Spatial 11.2.0.3.0 VALID
ORDIM Oracle Multimedia 11.2.0.3.0 INVALID
XDB Oracle XML Database 11.2.0.3.0 INVALID
CONTEXT Oracle Text 11.2.0.3.0 VALID
ODM Oracle Data Mining 11.2.0.3.0 VALID
EXF Oracle Expression Filter 11.2.0.3.0 VALID
RUL Oracle Rules Manager 11.2.0.3.0 VALID
OWM Oracle Workspace Manager 11.2.0.3.0 VALID
CATALOG Oracle Database Catalog Views 11.2.0.3.0 VALID

COMP_ID COMP_NAME VERSION STATUS
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CATPROC Oracle Database Packages and T11.2.0.3.0 INVALID
JAVAVM JServer JAVA Virtual Machine 11.2.0.3.0 VALID
XML Oracle XDK 11.2.0.3.0 VALID
CATJAVA Oracle Database Java Packages 11.2.0.3.0 VALID
XOQ Oracle OLAP API 11.2.0.3.0 VALID
APS OLAP Analytic Workspace 11.2.0.3.0 VALID

17 rows selected.

注意这里的2个组件:
(1)XDB 是无效的。
(2)ORDIM 也是无效的。

OracleMultimedia (11g之前叫 interMedia)is a feature of Oracle Database Standard Edition and Enterprise Edition thatenables efficient management and retrieval of multimedia (images, audio, andvideo) data in an integrated fashion with other enterprise information. OracleMultimedia provides comprehensive support for DICOM, the widely adoptedstandard for medical images, videos and structured reports in Oracle Database.Oracle Multimedia extends Oracle Database reliability, availability, security,and data management capabilities to multimedia content in traditional,Internet, electronic commerce, medical, and media-rich applications.
- - Oracle Multimedia 是Oracle 标准版和企业版里的一个特性,其可以用来管理images, audio, and video.

更多内容参考MOS:
Master Note forOracle Multimedia/interMedia [ID 1078222.1]

这里ORDIM 无效是因为XDB 导致的,因为Oracle Multimedia组件的信息是保存在XDB Schemas中的,所以XDB无效,也会导致Multimedia 组件无效。在我们重建XDM组件之后,在reload 一下ORDIM组件就可以了。

二. 重建XDB 组件
XDB 组件的重建,参考:
Master Note for Oracle XML Database (XDB)Install / Deinstall [ID 1292089.1]

2.1 Reloading XDB
The reloadprocedure recreates all of the PL/SQL packages and types. An XDB reload isalways preferred over an XDB removal and reinstall. Since xdbrelod.sql iscalled in xdbpatch.sql, you can alternatively run xdbpatch.sql to recreate allof the XDB related packages.
- - Reload 过程将重建所有的PL/SQL 包和类型,Reload 比removal和reinstall 更具有优势。在考虑重建之前可以先尝试Reload。 因为xdbreload.sql 在xdbpatch.sql脚本中会自动调用,所以也可以运行xdbpatch.sql 来创建所有的XDB 关联包。

2.1.1 Oracle 9i - XDB Reload
SQL> spool xdbreload.log
SQL> connect / as sysdba
SQL> set echo on;
SQL> shutdown immediate;
SQL> startup migrate;
SQL> @?/rdbms/admin/xdbrelod.sql
SQL> shutdown immediate;
SQL> startup;
SQL> @?/rdbms/admin/utlrp.sql
SQL> spool off

2.1.2 Oracle 10.1 and above(10g 以上版本) - XDBReload
SQL> spool xdbreload.log
SQL> connect / as sysdba
SQL> set echo on;
SQL> shutdown immediate;
SQL> startup upgrade;
SQL> @?/rdbms/admin/xdbrelod.sql
SQL> shutdown immediate;
SQL> startup;
SQL> @?/rdbms/admin/utlrp.sql
SQL> spool off

2.2 Deinstalling and Reinstalling XDB

2.2.1 相关的注意事项
(1) Use XDB removal and reinstallonly if not using this feature or under the direction of Oracle Support afterit has been verified which objects will need to be recreated.
(2) For database releases 10.1.xand above, XDB is mandatory in order to use any of the XMLTYPE functions. Thisis true even if the XDB repository is not being used and/or there are noregistered schemas.
(3) Prior to Oracle 11.1, a validinstallation of JAVA Virtual Machine (JVM).
(4) Prior to Oracle 10.2, a validinstallation of XDK is also required
(5) Allocate at least 200 MB forthe XDB repository tablespace datafile.
(6) Ensure that theSHARED_POOL_SIZE and JAVA_POOL_SIZE is set to at least 150 MB.
(7) If you have any doubts/concernswith reinstalling XDB or you need further assistance, please contact OracleSupport and log a Service Request.

2.2.2 Oracle 9.2 - XDB Removal and Reinstall

(1)XDB Removal

The catnoqm.sql script drops XDB.

SQL> spool xdb_removal.log
SQL> set echo on;
SQL> connect / as sysdba
SQL> shutdown immediate;
SQL> startup
SQL> @?/rdbms/admin/catnoqm.sql
SQL> spool off;

(2)XDB Installation

The catqm.sql script requires the following parameters be passed to it whenrun:

A. XDB user password
B. XDB user default tablespace
(Any tablespace other than SYSTEM, UNDO and TEMP can be specified. Thespecified tablespace must already exist prior to running the script.)
C. XDB user temporary tablespace

Therefore, the syntax to run catqm.sql is thefollowing:
SQL> @?/rdbms/admin/catqm.sql A B C

For example:
SQL> @?/rdbms/admin/catqm.sql XDB XDB TEMP

## IMPORTANT: You must shutdown and restart thedatabase between removal and reinstall ##
- - 注意:在removal 和reinstall 之间必须重启DB.

SQL> spool xdb_install.log
SQL> set echo on;
SQL> connect / as sysdba
SQL> shutdown immediate;
SQL> startup;
SQL> @?/rdbms/admin/catqm.sql <XDB pwd> <XDB default tbs><XDB temporary tbs>
SQL> @?/rdbms/admin/catxdbj.sql
SQL> @?/rdbms/admin/utlrp.sql
SQL> spool off

2.2.3 Oracle 10g - XDB Removal and Reinstall
(1)XDB Removal

The catnoqm.sql script drops XDB.

SQL> spool xdb_removal.log
SQL> set echo on;
SQL> connect / as sysdba
SQL> shutdown immediate;
SQL> startup
SQL> @?/rdbms/admin/catnoqm.sql
SQL> spool off;

(2)XDB Installation

The catqm.sql script requires the following parameters be passed to it whenrun:

A. XDB user password
B. XDB user default tablespace
(Any tablespace other than SYSTEM, UNDO and TEMP can bespecified.
The specified tablespace must already exist prior torunning the script.)
C. XDB user temporary tablespace

Therefore, the syntax to run catqm.sql is the following:
SQL> @?/rdbms/admin/catqm.sql A B C

For example:
SQL> @?/rdbms/admin/catqm.sql XDB XDB TEMP

## IMPORTANT: You must shutdown and restart the database between removal andreinstall ##
- - 注意:在removal 和reinstall 之间必须重启DB.

SQL> spool xdb_install.log
SQL> set echo on;
SQL> connect / as sysdba
SQL> shutdown immediate;
SQL> startup;
SQL> @?/rdbms/admin/catqm.sql <XDB pwd> <XDB default tbs><XDB temporary tbs>
SQL> @?/rdbms/admin/utlrp.sql
SQL> spool off

2.2.4 Oracle 11g - XDB Removal and Reinstall
2.2.4.1 注意事项:
(1)When a binary XMLType is created,the data is stored in a proprietary format on disk that represents a post parsepersistence model. This requires the need to store information about how totransverse the XML data without having to parse it again. The data that isstored in order to accomplish this is maintained in dictionary type tables inthe XDB user schema, not in the user schema that created the table. What thismeans is that the removal script drops the XDB user and in turn loses thisinformation from both Binary and Object-Relational xmltype tables/columns.So if directed to remove and reinstall XDB with the catnoqm.sql and catqm.sqlscripts, run the following code block to verify that no Binary and/or ObjectRelational XMLType tables and columns exist:

connect / as sysdba
- -
- - Check the storage of XMLType tables.
- -
select owner, table_name
from dba_xml_tables
where storage_type in ('OBJECT-RELATIONAL', 'BINARY');

- - A default seed database with the example schemas installed
- - will have ones owned by XDB, MDSYS and OE.
- -
- - Check the storage of XMLType columns.
- -
select owner, table_name
from dba_xml_tab_cols
where storage_type in ('OBJECT-RELATIONAL', 'BINARY');

- - A default seed database with the example schemas installed
- - will have ones owned by XDB, MDSYS, ORDDATA, APEX_030200 and OE.
- - Please see the following section as it relates to ORDDATA and APEX_030200

(2)If it is necessary to re-installXDB and you would like to put back all binary data into the database withouthaving to reload this from XML files, please review the following note on howto do this:
(Doc ID 1405457.1) How to move XMLType tables/columns withBinary XML Storage between schemas/databases

(3)What if the database is using theDICOM and/or Oracle Application Express (APEX) features?
If the above code block has objects ownedby ORDDATA and/or APEX_030200, it means those components are installed in thedatabase. If those components are being used in a production capacity, XDBshould not be removed and reinstalled as data that is maintained in the XDBuser schema will be lost.

(4)The default XMLType storage modelis used if a storage model is not specified when creating an XMLType table orcolumn. Prior to Oracle Database 11g Release 2, unstructured (CLOB) storage wasused by default. The default storage model is now binary XML storage.
Please see the following document for moreinformation:

(DocID 1207893.1) Change in default storage model of XMLType to BINARYXML in 11.2.0.2
(5)Beginning with 11g, JAVA VirtualMachine (JVM) is no longer required for a successful installation of XDB.However, if an attempt is made to run XQUERY statements which use a functionalevaluation path, an error will be thrown stating that JVM is not installed.Also note that JVM must be installed for XDK functionality.
(6)Beginning with 11.2, XDB nowsupports SecureFiles. To use SecureFiles, compatibility must be set to 11.2. IfSecureFiles will be used, the tablespace specified for the XDB repository mustbe using Automatic Segment Space Management (ASSM).

SinceSecureFiles is now supported with 11.2, an additional parameter was added tothe catqm.sql script in that release.

2.2.4.2 Oracle 11.1 - XDB Removal and Reinstall
(1)XDB Removal

The catnoqm.sql script drops XDB.

SQL> spool xdb_removal.log
SQL> set echo on;
SQL> connect / as sysdba
SQL> shutdown immediate;
SQL> startup
SQL> @?/rdbms/admin/catnoqm.sql
SQL> spool off;

(2)XDB Installation

The catqm.sql script requires the following parameters be passed to it whenrun:

A. XDB user password
B. XDB user default tablespace
(Any tablespace other than SYSTEM, UNDO and TEMP can bespecified.
The specified tablespace must already existprior to running the script.)
C. XDB user temporary tablespace

Therefore, the syntax to run catqm.sql is the following:
SQL> @?/rdbms/admin/catqm.sql A B C

For example:
SQL> @?/rdbms/admin/catqm.sql XDB XDB TEMP

## IMPORTANT: You must shutdown and restart thedatabase between removal and reinstall ##

SQL> spool xdb_install.log
SQL> set echo on;
SQL> connect / as sysdba
SQL> shutdown immediate;
SQL> startup;
SQL> @?/rdbms/admin/catqm.sql <XDB pwd> <XDB default tbs><XDB temporary tbs>
SQL> @?/rdbms/admin/utlrp.sql
SQL> spool off

2.2.4.3 Oracle 11.2 - XDB Removal and Reinstall
(1)XDB Removal

The catnoqm.sql script drops XDB.

SQL> spool xdb_removal.log
SQL> set echo on;
SQL> connect / as sysdba
SQL> shutdown immediate;
SQL> startup
SQL> @?/rdbms/admin/catnoqm.sql
SQL> spool off;

(2)XDB Installation

The catqm.sql script requires the following parameters be passed to it whenrun:

A. XDB user password
B. XDB user default tablespace
(Any tablespace other than SYSTEM, UNDO and TEMP canbe specified.
The specified tablespace must already exist prior torunning the script.)
C. XDB user temporary tablespace
D. SecureFiles = YES or NO
(If YES is specified, the XDB repository will useSecureFile storage.
If NO is specified, LOBS will beused.
To use SecureFiles, compatibility must beset to 11.2.
The tablespace specified for the XDBrepository must be using
Automatic Segment Space Management (ASSM)for SecureFiles to be used.)

Therefore the syntax to run catqm.sql is the following:
SQL> catqm.sql A B C D

For Example:
SQL> @?/rdbms/admin/catqm.sql XDB XDB TEMP YES

## IMPORTANT: You must shutdown and restart the database between removal andreinstall ##

SQL> spool xdb_install.log
SQL> set echo on;
SQL> connect / as sysdba
SQL> shutdown immediate;
SQL> startup;
SQL> @?/rdbms/admin/catqm.sql <XDB pwd> <XDB default tbs><XDB temporary tbs> <SecureFiles = YES/NO>
SQL> @?/rdbms/admin/utlrp.sql
SQL> spool off


2.3 Verify XDB Installation –验证XDB 安装

spool xdb_status.txt

set echo on;
connect / as sysdba
set pagesize 1000
col comp_name format a36
col version format a12
col status format a8
col owner format a12
col object_name format a35
col name format a25

- - Check status of XDB

select comp_name, version, status
from dba_registry
where comp_id = 'XDB';

- - Check for invalid objects owned by XDB

select owner, object_name, object_type, status
from dba_objects
where status = 'INVALID'
and owner = 'XDB';

spool off;


三. Reload ORDIM 组件
在前面提到Oracle Multimedia(ORDIM)组件需要使用XDB组件,在我们重建XDB组件之后需要Reload 一些ORDIM组件。

Oracle 11g参考:
How To Reload Oracle Multimedia RelatedInformation When XML Database (=XDB) Has Been Reinstalled [ID 965892.1]

Oracle 10g:参考:
How To Re-register XML Schemas After XDBHas Been Re-installed? [ID 558834.1]

3.1 Oracle 10g 版本
The XDB schemais also used by other products like interMedia and Spatial to register theirXML Schemas. When XDB has been deinstalled and reinstalled for whatever reasonthe XML Schemas for these products will have to be reinstalled as well.
- - XDB Schema 被其他的组件所用,比如interMedia(11g中叫Multimedia)和Spatial组件,他们注册自己的信息在XML Schemas中。 当XDB 被删除或者重建时,其他组件在XML中的信息也被卸载,这就导致其他组件的无效。

- - Register XML Schemas for the Rules Manager component (part of CATPROC)
- - 在XMLSchemas中注册Rules Manager 组件信息:
connect / as sysdba
alter session setcurrent_schema = EXFSYS;
@?/rdbms/admin/rulpbs.sql

- - Register XML Schemas for the interMedia product
- - 在XMLSchemas 中注册interMedia组件信息:
connect / as sysdba
alter session set current_schema=ORDSYS;
@?/ord/im/admin/imxreg.sql

- - Register XML Schemas for the Locator/Spatial product
- - 在XMLSchemas中注册Locator/Spatial 组件信息

connect / as sysdba
alter session set current_schema=MDSYS;
@?/md/admin/sdogmlsc.sql
@?/md/admin/sdoepsgx.sql
@?/md/admin/sdogrxml.sql - - not to be run for a Locatorinstallation

3.2 Oracle 11g 版本
OracleMultimedia requires Oracle XML Database (=XDB) to be installed. In cases whereOracle Multimedia is not in use and XDB has been reinstalled, the below stepswill assist to reinstall the part of Oracle Multimedia that uses XDB.

- - 在进行如下操作之前,记得先备份:

(1)Run SQL*Plus and connect as SYSDBA:
SQL> alter session setcurrent_schema="ORDSYS";
SQL> @<ORACLE_HOME>/ord/im/admin/imxreg.sql;
SQL> @<ORACLE_HOME>/ord/im/admin/impbs.sql;
SQL> @<ORACLE_HOME>/ord/im/admin/impvs.sql;
SQL> @<ORACLE_HOME>/ord/im/admin/imtyb.sql;
SQL> @<ORACLE_HOME>/ord/im/admin/implb.sql;
SQL> @<ORACLE_HOME>/ord/im/admin/imxrepos.sql;

(2)Now run validate_ordim connected asSYSDBA to verify if Oracle Multimedia is valid:
SQL> set serveroutput on
SQL> exec validate_ordim;
SQL> select status, version from DBA_REGISTRY where comp_id = 'ORDIM';

This shouldshow, that Oracle Multimedia is VALID and at the same version as the database.


四.重建XDB组件后,还有无效的XDB对象
如果我们重建XDB组件后,还有有无效的XDB对象,处理方法下:
Invalid XDB Objects After XDB Install [ID429551.1]

当我们重建了XDB后,仍然有一些XDB 对象无效,比如:
DBMS_XMLDOM
DBMS_XMLPARSER
DBMS_XMLSCHEMA

当我们尝试编译时,又报如下错误:
PLS-00201: identifier 'DBMS_LOB'
or
PLS-00201: identifier 'UTL_FILE' must be declared

XDB lacks execute permissions onDBMS_LOB and UTL_FILE package. This is a permission granted bydefault.
- - 导致这个这个问题的原因是因为XDB 在DBMS_LOB和 UTL_FILE包上没有执行权限。

解决方法有两种:

(1)方法一
SQL> CONN / AS SYSDBA (Connect asSYSDBA)
SQL> DESC DBMS_LOB
SQL> DESC UTL_FILE
SQL> GRANT EXECUTE ON DBMS_LOB TO XDB;
SQL> GRANT EXECUTE ON UTL_FILE TO XDB;
SQL> @?/rdbms/admin/utlrp.sql - - Run this afew times
SQL> SELECT * FROM DBA_ERRORS;
SQL> SELECT COMP_ID, COMP_NAME, STATUS FROM DBA_REGISTRY;
SQL> SELECT OBJECT_NAME, OBJECT_TYPE, OWNER, STATUS FROM DBA_OBJECTS WHEREOWNER = 'XDB' AND STATUS != 'VALID';

(2)方法二:
a) Grant following privileges to XDBuser
SQL> GRANTEXECUTE ON DBMS_LOB TO XDB;
SQL> GRANT EXECUTE ON UTL_FILE TO XDB;

b) Reload the XDB Component (usingxdbrelod.sql).
- Refer Master Note for Oracle XMLDatabase (XDB) Installation (Doc ID 1292089.1)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!
Skype: tianlesoftware
Email: moc.liamg|erawtfoselnait#moc.liamg|erawtfoselnait
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


本页面的文字允许在知识共享 署名-相同方式共享 3.0协议和GNU自由文档许可证下修改和再使用,仅有一个特殊要求,请用链接方式注明文章引用出处及作者。请协助维护作者合法权益。


系列文章

文章列表

  • Oracle JVM、XDB的安装于卸载

这篇文章对你有帮助吗,投个票吧?

rating: 0+x

留下你的评论

Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License