当前位置: 首页 > 工具软件 > XDK > 使用案例 >

Oracle XDK 组件 说明

华懿轩
2023-12-01

 

一.Oracle XDK 组件 说明

 

在说明之前,我们先用如下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,versionfrom 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 说明:

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

http://www.cndba.cn/Dave/article/1445

 

Oracle OracleXML Developer's Kit (XDK) is a versatile set of components that enables you tobuild and deploy C, C++, and Java software programs that process XML. You canassemble these components into an XML application that serves your businessneeds. 

--Oracle XDK 组件是一个多功能集合的组件,其可以构建和部署C,C++,Java 程序来处理XML。

 

Oracle XDKprovides the foundation for the Oracle XML solution. The XDK supports OracleXML DB, which is a set of technologies used for storage and processing of XMLin the database. You can use the XDK in conjunction with Oracle XML DB to buildapplications that run in Oracle Database. You can also use the XDKindependently of XML DB. 

--Oracle XDK 为XML的解决方案提供了基础。 XDK 支持XML DB,XDB是一个技术的集合,其可以用来在DB中存储和处理XML。 我们可以使用XDK 和XDB来构建应用在DB中运行,也可以单独使用XDK。

 

OracleXDB 组件 重建 说明

http://www.cndba.cn/Dave/article/1324

 

The Oracle XDKis fully supported by Oracle Corporation and comes with a commercialredistribution license. The standard installation of Oracle Database includesthe XDK. 

 

注意:

(1)Customersusing Oracle XDK with PL/SQL and migrating from Oracle Database Release 8.1 or9.2 are strongly encouraged to use AL32UTF8 as the database character set.Otherwise, issues can arise during PL/SQL processing of XML data that containsescaped entities. 

--在Oracle 8.1和9.2中强烈建议AL32UTF8字符集。

 

(2)9206 XDKshould be installed in 9204 database, 9207 XDK should be installed in 9205database and 9208 XDK should be installed in 9206 server. That is why in9.2.0.8 installation you will see XDK version 9.2.0.10

 

XDK 用户:

SYS: In 9.2 XDK should be installed in SYSschema, as 9.2.0.* patchsets upgrade XDK installed in SYS schemaonly.  

       --从Oracle 9.2 开始,XDK 只安装到SYS 用户。

 

官网的其他文档:

 XML DB Developer's Guide,10g Release 2 (10.2) 
Introduction to Oracle XMLDeveloper's Kit (11gR2)

 

 

二. XDK 卸载

MOS:

Note.317176.1 Howto De-install corrupted pl/sql XDK in 9.2 and Install the right version 

Note.171658.1 HowTo Install and Uninstall the XML Developers Toolkit 

 

1)     Let's check which user owns theXDK. To find out execute this query as SYS

--检查XDK 用户:

SQL> select owner,dbms_java.longname(object_name), object_type, status from all_objects where dbms_java.longname(object_name)like  ('%XMLParser%') and object_type like '%JAVA%';

 

Note:- If the packagesshow up as INVALID then XDK is corrupt and you need to follow  re-installsteps

--如果这里包显示无效,那么XDK 就corrupt,需要重建XDK。

 

2) For each user that owns XDK executebelow function to find out the version

--每个XDK用户执行如下函数,来确认版本信息:

SQL> CREATE OR REPLACE FUNCTIONXMLVersion RETURN VARCHAR2
  IS LANGUAGE JAVA NAME  'oracle.xml.parser.v2.XMLParser.getReleaseVersion()returns java.lang.String';

 /

SQL> select xmlversion from dual;


3) 9206 XDK should be installed in 9204 database, 9207 XDK should be installedin 9205 database and 9208 XDK should be installed in 9206 server.

IF the XDK isinstalled in only SYS schema and you have right XDK version then no need tocontinue further ....

 

4) In 9.2, the XDK should be installed inthe SYS schema, as 9.2.0.* patchsets upgrade the XDK installed in the SYSschema only.

       --在Oracle 9.2 中,XDK 需要安装在SYS用户下。

 

5) If you have XDK installed in any schemaother than SYS, then follow below steps to successfully install the rightversion of XDK in SYS schema

       --如果XDK 已经安装到了其他目录,那么使用如下步骤可以转移到SYS 用户。

 

a) If the user owning XDK just has XDKcomponents and no custom code then drop the user owning XDK using cascadeoption

 

b) Now, as SYS, check if any other schemahas XDK installed

SQL> select owner,dbms_java.longname(object_name), object_type, status from all_objects where dbms_java.longname(object_name)like  ('%XMLParser%') and object_type like '%JAVA%';

 

c) If the above query show that SYS hasalready the right version of XDK installed then stop here ..... 

otherwise continue

For both Unix and Windows as SYS executebelow command

   SQL>[ORACLE_HOME]/rdbms/admin/initxml.sql

d) Installation complete and no need tocontinue further ..

 

6) IF current XDK in SYS is corrupted oryou have wrong version of XDK in SYS schema then follow below steps tode-install and install

       --如果XDK 已经正确安装到了SYS用户,但是XDK 版本错误,那么需要卸载XDK 然后重新安装。

 

I) To de-install XDKinstalled from Technet you need to have right version of jar files I.e say you have 9.2.0.6 XDK installed in a 9.2.0.6 database (RightXDK should be 9.2.0.8) then you need to have 9.2.0.6 XDK files to drop thecurrent XDK. With below steps I will assume you have 9.2.0.6 XDK in 9.2.0.6database and we are going to de-install 9.2.0.6 XDK and install 9.2.0.8 XDK

  

a) Download 9.2.0.6 XDK from Technet

http://www.oracle.com/technology/tech/xml/xdk/software/prod/xdk_plsql.html

Install it in some directory on thedatabase box.

 

b) Cd to XDK_HOME/xdk/admin directory

 

c) Log in as SYS and execute below commands

SQL> @xmldrop.sql
 
SQL> drop package dbms_xmlquery;
SQL> drop package dbms_xmlsave;
SQL> drop package xmlgen;
SQL> drop public synonym dbms_xmlquery;
SQL> drop public synonym dbms_xmlsave;
SQL> drop public synonym xmlgen;
SQL> exit


d) Cd to XDK_HOME/lib and issue a dropjava command for each of the followingjava archives
  
   ./xdk/lib/xschema.jar
   ./xdk/lib/xsu12.jar 
   ./xdk/lib/classgen.jar
   ./xdk/lib/xmlparserv2.jar
   ./xdk/lib/xmlplsql.jar

   eg.  dropjava -v -uuser/password xdk/lib/xschema.jar

 

e) Deinstall is complete. Now you can loginand check if any version of XDK is installed

 

f) To install XDK as SYS executebelow command

   SQL> [ORACLE_HOME]/rdbms/admin/initxml.sql


II) To de-install corrupt 9.2 XDK that is installedfrom $OH follow below steps

a) Cd to $OH

b) Log in as SYS and execute below commands

SQL> @rdbms/admin/rmxml.sql
 
SQL> drop package dbms_xmlquery;
SQL> drop package dbms_xmlsave;
SQL> drop package xmlgen;
SQL> drop public synonym dbms_xmlquery;
SQL> drop public synonym dbms_xmlsave;
SQL> drop public synonym xmlgen;
SQL> exit


d) Cd to $OH and issue a dropjava command for each of the following javaarchives
  
   ./lib/xschema.jar
   ./lib/xsu12.jar 
   ./lib/classgen.jar
   ./lib/xmlparserv2.jar
   ./rdbms/jlib/xdb.jar
   ./rdbms/jlib/servlet.jar
   ./lib/xmlplsql.jar

   eg.  dropjava -v -uuser/password ./lib/xschema.jar

 

e) Deinstall is complete. Now you can loginand check if any version of XDK is installed

 

f) To install XDK as SYS executebelow command

   SQL>[ORACLE_HOME]/rdbms/admin/initxml.sql



注意事项:

In 9iR2, the xdkfor pl/sql written in java has been deprecated and in 10i it is no longersupported

Starting with9.2 Oracle introduced XDK for pl/sql written in C/C++ which is referred asXDB/XMLTYPE. The packages XMLDOM, XMLPARSER and XSLPROCESSOR have been replacedby the new names as DBMS_XMLDOM, DBMS_XMLPARSER and DBMS_XSLPROCESSOR.

The new packageshave the same methods and functionality and support the same interfaces using Cinstead of Java.  In 10i there will be synonyms created to the oldpackages to provide backward compatibility.

In 9.2 you havethe option to either use pl/sql XDK written in C or Java.

In order toinstall XDB refer to Note 1292089.1

 

 

三. XDK 组件安装

Note.435999.1 HowTo Install XDK 10.2.0.x ? 
Note.277152.1 Howto install XDK 9.2.0.x in an 8.1.7 Database Cleanly 
Note.453050.1 Howto Verify the XDK Installation
Installing the XDK (11gR2) 

There is no needto install XDK Java in 10g database as it comes with XDB schema. In 10g, muchabout XDK has been included in Oracle XML Database (XDB). 

--从Oracle10g 开始,不需要安装XDK组件,其已经包含在XDB组件中。

 

So, to install the XDK Java, XDB should beinstalled first . 

--所以如果要安装XDK,XDB 需要先安装。

 

关于XDB安装,参考:

OracleXDB 组件 重建 说明

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

 

 If theJServer is installed correctly but the XDK component is not, for example it isinvalid, (which can be shown by the following SQL statement):

--如果JServer 安装正确,但是XDK 无效,可以通过如下SQL 查询:

COLUMN comp_name format a30
COLUMN version format a20
COLUMN status format a20

select comp_name,version,status from dba_registry where comp_name='Oracle XDK';


注:这里的Jserver 是JVM组件的一个子集。

 

Then execute the following scripts tore-install the XDK component.

--可以执行如下脚本重建XDK 组件:

Connected as SYSDBA.

$ORACLE_HOME/xdk/admin/rmxml.sql
$ORACLE_HOME/xdk/admin/initxml.sql

 

 

But afterrunning initxml.sql, if following error is encountered , then theJavaVM  is not installed correctly :

--如果执行initxml.sql,遇到如下错误,可能JavaVM组件没有正确安装。

BEGIN dbms_java.loadjava('-v -r -grantPUBLIC -s rdbms/jlib/servlet.jar'); END; 


ERROR at line 1: 
ORA-29532: Java call terminated by uncaught Java exception: 
java.lang.NullPointerException 
ORA-06512: at "SYS.DBMS_JAVA", line 222 
ORA-06512: at line 1 


BEGIN dbms_java.loadjava('-v -r -install -grant PUBLIC -s lib/xmlparserv2.jar 
rdbms/jlib/xdb.jar'); END; 


ERROR at line 1: 
ORA-29532: Java call terminated by uncaught Java exception: 
java.lang.NullPointerException 
ORA-06512: at "SYS.DBMS_JAVA", line 222 
ORA-06512: at line 1 


BEGIN dbms_java.loadjava('-v -r -grant PUBLIC -s lib/xsu12.jar'); END; 


ERROR at line 1: 
ORA-29532: Java call terminated by uncaught Java exception: 
java.lang.NullPointerException 
ORA-06512: at "SYS.DBMS_JAVA", line 222 
ORA-06512: at line 1 

 

重装JavaVM组件即可,具体参考:

OracleJAVAVM 组件Reload 说明

http://www.cndba.cn/Dave/article/1328

 

 

四.验证XDK 安装

 

1. Verify there are no invalid Java classesthat start with name "oracle/xml"  by querying the ALL_OBJECTSview. 
SQL> Select substr(dbms_java.longname(object_name),1, 30) as class, statusfrom all_objects where object_type = 'JAVA CLASS' and status = 'INVALID'; 

2. Verify installation of the Oracle XML Parser for JAVA (i.e xmlparserv2.jar) 
SQL> select substr(dbms_java.longname(object_name),1, 30) as class, statusfrom all_objects where object_type = 'JAVA CLASS' and object_name =dbms_java.shortname('oracle/xml/parser/v2/DOMParser'); 



You should see the following result: 

CLASS Status 
-------------------------------- --------- 
oracle/xml/parser/v2/DOMParser Valid 



3. Verify the PL/SQL wrapper packages are created for the Oracle XML Parser 
for PL/SQL 

DESC XMLPARSER; 
or 
DESC XMLDOM; 



4. Verify the PL/SQL wrapper packages are created for the Oracle XML SQLUtility 

DESC DBMS_XMLQUERY; 
or 
DESC DBMS_XMLSAVE; 

 

 

XML 与XDK 的常见问题参考:

Note 250288.1 XDK For PL/SQL API Has Been Deprecated from 9.2 Database
Note.103871.1 XML Parser for PL/SQL FAQs 
Note.103872.1 XML Parser for Java Version 2 - Frequently Asked Questions 

 

 

 

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

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

QQ:492913789

Email:ahdba@qq.com

Blog:  http://www.cndba.cn/dave

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

 类似资料: