XML DB for XML Data Processing


Oracle XML DB is ideal for any application that processes or accesses XML data. Oracle XML DB is suitable for Internet applications, high-performance search applications (such as online libraries), business-to-business (B2B) applications, content management applications, and for interoperability with any other databases. The database user XDB owns all the metadata for managing the Oracle XML DB repository in the database. Oracle XML DB includes DBMS_XDB, a PL/SQL package, to allow resources to be created, modified, and deleted programmatically.

A good place to learn more about using XML DB is Oracle XML DB Developer's Guide 10g.


Installing XML DB

Oracle XML DB can be installed with or without Database Configuration Assistant (DBCA). It is a part of the default seed database installed by DBCA.

Using DBCA to Install XML DB

As part of the default installation, DBCA creates an Oracle XML DB tablespace for the XML DB repository, enables all needed protocols (FTP, HTTP, and WebDAV), and configures FTP at port 2100 and HTTP/WebDAV at port 8080. The Oracle XML DB repository is set up inside the Oracle XML DB tablespace. (You should not drop the Oracle XML DB tablespace; doing so will make all your repository data inaccessible). If you select the Advanced Database Configuration option in DBCA, you can change the Oracle XML DB tablespace and FTP, HTTP, and WebDAV port numbers to your requirements.

Oracle XML DB installation has a dynamic protocol registration feature that registers FTP and HTTP services with the local listener. You can change the FTP or HTTP port numbers by altering the <ftp-port> and <http-port> tags in the xdbconfig.xml file in the Oracle XML DB repository. After you have changed the port numbers, dynamic protocol registration will automatically stop the FTP/HTTP service on old port numbers and restart them on new port numbers, provided the local listener is up and running. If the local listener is not up, restart the listener after updating the port numbers. Use lsnrctl <start/stop/status> commands for these operations.

If your application allows unauthenticated HTTP access to the Oracle XML DB repository data (as in an online content-management application), then you must unlock the ANONYMOUS user account.

Listener Configuration on a Nonstandard Port

If your database listener is running on a nonstandard port (that is, a port other than 1521), then your initSID.ora file should contain a local_listener entry for the protocols to register accurately with the correct listener. After you edit the initSID.ora parameter file, regenerate the SPFILE using the CREATE SPFILE command.


Manual Installation of XML DB

To manually install Oracle XML DB without using DBCA, perform the following steps:

1.

After the database installation, connect as SYS and create a new tablespace for the Oracle XML DB repository. Run the catqm.sql script in the ORACLE_HOME/rdbms/admin directory to create the tables and views needed for XML DB:

 catqm.sql <XDB_password> <XDB_Tablespace_Name> <TEMP_Tablespace_Name> 

If you get ORA-22973 error during this step, make sure your NLS_LENGTH_SEMANTICS variable is set to CHAR. It should be set to BYTE (using ALTER SYSTEM SET NLS_LENGTH_ SEMANTICS = BYTE;) as a workaround. NLS_LENGTH_SEMANTICS does not apply to data dictionary tables because they use BYTE semantics.

2.

Reconnect as SYS and run catxdbj.sql in the ORACLE_HOME/rdbms/admin directory to load the XDB Java library. The database should be set up with a compatibility of 9.2.0 or higher, and Java Virtual Machine (JVM) should be installed.

3.

Once you have completed the manual installation, add the following dispatcher entry to the initSID.ora file:

 dispatchers="(PROTOCOL=TCP) (SERVICE=<sid>XDB)" 

4.

Restart the database and listener. If your application allows unauthenticated HTTP access to the Oracle XML DB repository data, unlock the ANONYMOUS user account.

Manual Removal of Oracle XML DB

To manually remove the XML DB, remove the XML DB dispatcher entry from the initSID.ora file. If SPFILE is used, run the following command as SYS while the instance is up:

 ALTER SYSTEM RESET dispatchers scope=spfile sid='<XML_SID>'; 

Run catnoqm.sql and the following steps to drop the user XDB and tablespace XDB:

 @ORACLE_HOME/rdbms/admin/catnoqm.sql alter tablespace <XDB_Tablespace_Name> offline; drop tablespace <XDB_Tablespace_Name> including contents; 

If you need to reinstall XML DB, you may want to shut down and restart the database to have a clean database for the installation. Use the steps described in the section titled "Manual Installation of XML DB" for the installation process. For more details on reinstalling or upgrading an existing XML DB, please refer to Oracle XML DB Developer's Guide 10g.

Changing the Timeout Levels

As a DBA, you may have to adjust the timeout levels for accessing large XML files over a Web browser and/or FTP server. Timeout is expressed in centiseconds (1/100 of a second). Call-TimeOut is the amount of time allowed to load an XML document using DBUri. Session-TimeOut is the amount of time allowed for a session to be connected before being disconnected. All these times can be altered using the dbms_xdb.cfg_update procedure. To manually edit these values, get the xdbconfig.xml file via FTP from the XML DB repository, edit the values for the timeouts, save the file, and reload it into the XML DB repository. After reloading the changed xsd file, refresh the xdbconfig.xml file using the exec dbms_xdb.cfg_refresh; command. For more details on the DBUri and dbms_xdb package, refer to Oracle XML DB Developer's Guide 10g.


XQuery Support in Oracle Database 10g R2

In Oracle Database 10g Release 2, XQuery support is introduced in the database server through a SQL-centric approach using XMLTable by breaking the XQuery values into XML and relational values. The SQL * Plus command XQUERY is provided to use XQuery expressions directly with the Oracle XML DB.

To initialize XQuery support in the database, run initxqry.sql as SYSDBA. After running this script, enable XQuery support for your database instance and provide the required Java pool size (40MB).

 SQL> $ORACLE_HOME/rdbms/admin/initxqry.sql SQL> ALTER SYSTEM SET EVENT = '19119 trace name context forever, level 1' scope=SPFILE; SQL> ALTER SYSTEM SET java_pool_size = 41943040 scope=both; 

The database instance has to be restarted for the changes to take effect. After restarting the database instance, verify that XQuery has been enabled as follows:

 SQL> set long 8000 SQL> ALTER SYSTEM SET java_pool_size = 41943040 scope=both; SQL> xquery for $q in <xmlquery>4</xmlquery> return $q / Result Sequence -------------------------------------------- < xmlquery>4</xmlquery> 

These details have been provided to give an overview of the updates available in Release 2 of the database.



    Oracle Database 10g Insider Solutions
    SUSE LINUX Enterprise Server 9 Administrators Handbook
    ISBN: 672327910
    EAN: 2147483647
    Year: 2006
    Pages: 214

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net