Skip Headers
Oracle® XML DB Developer's Guide
11g Release 1 (11.1)

Part Number B28369-01
Go to Documentation Home
Go to Book List
Book List
Go to Table of Contents
Go to Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Go to next page
View PDF

34 Administering Oracle XML DB

This chapter describes how to administer Oracle XML DB. It includes information about installing, upgrading, and configuring Oracle XML DB.

This chapter contains these topics:

See Also:

"Configuring Resources for XLink and XInclude" for information on configuring Oracle XML DB Repository resources for use with XLink and XInclude

Installing and Reinstalling Oracle XML DB

You are required to install Oracle XML DB manually under the following conditions:

Installing or Reinstalling Oracle XML DB From Scratch

You can perform a new installation of Oracle XML DB with or without Database Configuration Assistant (DBCA). If Oracle XML DB is already installed, complete the steps in "Reinstalling Oracle XML DB".

Installing a New Oracle XML DB With Database Configuration Assistant

Oracle XML DB is part of the seed database and installed by Database Configuration Assistant (DBCA) by default. No additional steps are required to install Oracle XML DB. However, if you select the Advanced database configuration, then you can configure Oracle XML DB tablespace and FTP, HTTP(S), and WebDAV port numbers.

By default, DBCA performs the following tasks during installation:

  • Creates an Oracle XML DB tablespace for Oracle XML DB Repository

  • Enables all protocol access

The Oracle XML DB tablespace holds the data stored in Oracle XML DB Repository, including data stored using:

  • SQL, for example using RESOURCE_VIEW and PATH_VIEW

  • Protocols such as FTP, HTTP(S), and WebDAV

You can store data in tables outside this tablespace and access the data through Oracle XML DB Repository by having REFs to that data stored in the tables in this tablespace.


The Oracle XML DB tablespace should not be dropped. If dropped, then it renders all Oracle XML DB Repository data inaccessible.

See Also:

"Anonymous Access to Oracle XML DB Repository using HTTP" for information about allowing unauthenticated access to the repository

Dynamic Protocol Registration of FTP and HTTP(S) Services with Local Listener

Oracle XML DB installation, includes a dynamic protocol registration that registers FTP and HTTP(S) services with the local Listener. You can perform start, stop, and query with lsnrctl. For example:

  • start: lsnrctl start

  • stop: lsnrctl stop

  • query: lsnrctl status

Changing FTP or HTTP(S) Port Numbers

To change FTP and HTTP(S) port numbers, update elements <ftp-port>, <http-port>, and <http2-port> in file /xdbconfig.xml in the Oracle XML DB Repository.

After updating the port numbers, dynamic protocol registration automatically stops FTP/HTTP(S) service on old port numbers and starts them on new port numbers if the local Listener is up. If local Listener is not up, restart the Listener after updating the port numbers.


You must either configure the port separately for each node of a Real Application Cluster (RAC) or configure it for one node and then restart the database instances on the other nodes. See "Configuring Oracle XML DB Using xdbconfig.xml".

See Also:

Chapter 28, "Using Protocols to Access the Repository" for information about configuring protocols

As explained in the previous section, Oracle XML DB uses dynamic protocol registration to setup FTP and HTTP Listener services with the local Listener. So, make certain that the Listener is up when accessing Oracle XML DB protocols.


If the Listener is running on a port that is not standard (for example, not 1521), then, in order for the protocols to register with the correct listener, the init.ora file must contain a local_listener entry. This references a TNSNAME entry that points to the correct Listener. After editing the init.ora parameter you must regenerate the SPFILE entry using CREATE SPFILE.

Installing Oracle XML DB Manually Without DBCA

You can install Oracle XML DB manually, by running the catqm SQL script in directory rdbms/admin as database user SYS. Before running the script, you must installing the database and create a new tablespace for Oracle XML DB Repository. Here is the syntax for catqm:

catqm.sql <XDB_password> <XDB_TS_NAME> <TEMP_TS_NAME>
#Create the tables and views needed to run Oracle XML DB

For example:

catqm.sql change_on_install XDB TEMP


Make sure that the database is started with Oracle9i release 2 (9.2.0) compatibility or higher and Java Virtual Machine (JVM) is installed.


After the manual installation, carry out these tasks:

  1. Add the following dispatcher entry to the init.ora file:

    dispatchers="(PROTOCOL=TCP) (SERVICE=<sid>XDB)"
  2. Restart the database and listener to enable Oracle XML DB protocol access.

See Also:

"Anonymous Access to Oracle XML DB Repository using HTTP" for information about allowing unauthenticated access to the repository

Reinstalling Oracle XML DB


All user data stored in Oracle XML DB Repository is lost if you drop user XDB.

To reinstall Oracle XML DB follow these steps:

  1. Remove the dispatcher by removing the Oracle XML DB dispatcher entry from the init.ora file as follows:

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

    If the server parameter file is used, run the following command when the instance is up and while logged in as SYS:

    ALTER SYSTEM RESET dispatchers scope=spfile sid='*';
  2. Drop user XDB and tablespace XDB, by connecting as user SYS and running the following SQL script:

    DROP TABLESPACE <XDB_TS_NAME> including contents;
  3. Re-create tablespace XDB.

  4. Execute catnoqm.sql.

  5. Shut down, then restart the database instance.

  6. Execute catqm.sql.

  7. Install Oracle XML DB manually as described in "Installing Oracle XML DB Manually Without DBCA".

See Also:

Oracle Database 2 Day + Security Guide for information about database schema XDB

Upgrading an Existing Oracle XML DB Installation

The following considerations apply to all upgrades to Oracle Database 11g:

See Also:

"ACL Evaluation Rules" for information about conflicts among ACEs

Validation of ACL Documents and Configuration File

Access control list (ACL) documents are stored in table XDB$ACL. The Oracle XML DB configuration file, xdbconfig.xml, is stored in table XDB$CONFIG. Starting with Oracle Database 11g Release 1, these tables use the post-parse (binary XML) storage model. This implies that ACL documents and the configuration file are fully validated against their respective XML schemas. Validation takes place during upgrade, using your existing ACL documents and configuration file and the corresponding existing XML schemas.

If an ACL document fails to validate during upgrade, then the document is moved to table XDB$INVALID_ACL.

If validation of configuration file xdbconfig.xml fails during upgrade, then the file is saved in table XDB$INVALID_CONFIG, the default configuration file replaces it in table XDB$CONFIG, and the XDB component of the database is marked invalid. You must then start the database in normal mode and fix the XDB component, before trying to use the database.

To fix the XDB component, you can fix the invalid files to make them valid, and then call PL/SQL procedure RecoverUpgrade. After validating, this procedure moves the fixed files to tables XDB$ACL and XDB$CONFIG, and marks the XDB component valid.

As an option, you can call procedure RecoverUpgrade with parameter use_default set to TRUE, to abandon any invalid files. In this case, any valid files are moved to tables XDB$ACL and XDB$CONFIG, and any remaining invalid files are deleted. Default files are used in place of any invalid files: for ACLs, the default ACL document is used; for the configuration file, the default xdbconfig.xml is used (in which ACE order matters).


Use a TRUE value for parameter use_default only if you are certain that you no longer need the old ACL files or configuration file that are invalid. These files will be deleted.

Using Oracle Enterprise Manager to Administer Oracle XML DB

Oracle Enterprise Manager is a graphical tool supplied with Oracle Database that lets you perform database administration tasks easily. You can use it to perform the following tasks related to Oracle XML DB:

See Also:

The online help available with Oracle Enterprise Manager, for information about using Enterprise Manager to perform these tasks

Configuring Oracle XML DB Using xdbconfig.xml

Oracle XML DB is managed internally through a configuration file, /xdbconfig.xml, which is stored as a resource in Oracle XML DB Repository. As an alternative to using Oracle Enterprise Manager to configure Oracle XML DB, you can configure it directly using the Oracle XML DB configuration file.

The configuration file can be modified at runtime. Updating the configuration file creates a new version of this repository resource. At the start of each session, the current version of the configuration file is bound to that session. The session uses this configuration-file version for its duration, unless you make an explicit call to refresh the session to the latest version.


You must update xdbconfig.xml separately for each node of a Real Application Cluster (RAC). Changes you make to xdbconfig.xml on one node are not automatically propagated to the other nodes of a cluster. You must propagate them yourself, which you can do in either of these ways:
  • Update xdbconfig.xml on one node, and then restart the database instances on all other nodes.

  • Update xdbconfig.xml separately on each node.

Oracle XML DB Configuration File, xdbconfig.xml

The configuration of Oracle XML DB is defined and stored in an Oracle XML DB Repository resource, /xdbconfig.xml, which conforms to the Oracle XML DB configuration XML schema: To configure or reconfigure Oracle XML DB, update file /xdbconfig.xml. Its structure is described in the following sections. You need administrator privileges to access file /xdbconfig.xml.

See Also:

"xdbconfig.xsd: XML Schema for Configuring Oracle XML DB" for a complete listing of the Oracle XML DB configuration XML schema

<xdbconfig> (Top-Level Element)

Element <xdbconfig> is the top-level element. Its structure is as follows:

    <sysconfig> ... </sysconfig> 
    <userconfig> ... </userconfig> 

Element <sysconfig> defines system-specific, built-in parameters. Element <userconfig> lets you store new custom parameters.

<sysconfig> (Child of <xdbconfig>)

Element <sysconfig> is a child of <xdbconfig>. Its structure is as follows:

    general parameters
    <protocolconfig> ... </protocolconfig> 

Element <sysconfig> includes as content several general parameters that apply to all of Oracle XML DB, such as the maximum age of an access control list (ACL) and whether or not Oracle XML DB is case sensitive. Child <protocolconfig> contains protocol-specific parameters.

<userconfig> (Child of <xdbconfig>)

Element <userconfig> is a child of <xdbconfig>. It contains any parameters that you may want to add.

<protocolconfig> (Child of <sysconfig>)

Element <protocolconfig> is a child of <sysconfig>. Its structure is as follows:

  <common> ... </common> 
  <ftpconfig> ... </ftpconfig> 
  <httpconfig> ... </httpconfig> </protocolconfig> 

Under <common>, Oracle Database stores parameters that apply to all protocols, such as MIME-type information. Parameters that are specific to protocols FTP and HTTP(S) are in elements <ftpconfig> and <httpconfig>, respectively.

See Also:

Chapter 28, "Using Protocols to Access the Repository", Table 28-1, Table 28-2, and Table 28-3, for a list of protocol configuration parameters

<httpconfig> (Child of <protocolconfig>)

Element <httpconfig> is a child of <protocolconfig>. Its structure is as follows:

        <servlet> ... </servlet>
  <plsql> ... </plsql>

Element <httpconfig> has the following child elements, in addition to others:

  • <webappconfig> – used to configure Web-based applications. This includes Web application-specific parameters, such as icon name, display name for the application, and a list of servlets.

    Element <servletconfig> is a child of <webappconfig> that is used to define servlets. It has child <servlet-list>, which has child <servlet> (see "<servlet> (Descendant of <httpconfig>)").

  • <plsql>Foot 1  – used to define global configuration parameters when configuring the embedded PL/SQL gateway. Each global parameter is defined with a child element of <plsql>. The element name is the same as the global parameter name; the element content is the same as the parameter value.

    The recommended way to configure the embedded PL/SQL gateway is to use the procedures in PL/SQL package DBMS_EPG, not to edit file xdbconfig.xml.

See Also:

<servlet> (Descendant of <httpconfig>)

An optional <plsql> element, child of <servlet>, configures the embedded PL/SQL gateway servlet. However, the recommended way to configure the embedded gateway is to use the procedures in PL/SQL package DBMS_EPG, not to edit file xdbconfig.xml.

Element <plsql> has a child element for each embedded PL/SQL DAD attributeFoot 2  that is needed to configure the embedded gateway; all such children are optional. The element name is the same as the DAD attribute name; the element content is the same as the DAD-attribute value.

Element <servlet> is a descendent of <httpconfig> – see "<httpconfig> (Child of <protocolconfig>)". It is used to configure servlets, including Java servlets and embedded PL/SQL gateway servlets.

See Also:

Oracle XML DB Configuration File Example

The following is a sample Oracle XML DB configuration file:

Example 34-1 Oracle XML DB Configuration File

<xdbconfig xmlns="" 



                    <encoding>zip file</encoding>      
                    <encoding>tar file</encoding>        



            <server-name>XDB HTTP Server</server-name>
            <servlet-realm>Basic realm="XDB"</servlet-realm>
                    <description>Servlet for accessing DBURIs</description>

Oracle XML DB Configuration API

You can access the Oracle XML DB configuration file, xdbconfig.xml, the same way you access any other XML schema-based resource in the hierarchy. It can be accessed using FTP, HTTP(S), WebDAV, Oracle Enterprise Manager, or any of the resource and Document Object Model (DOM) APIs for Java, PL/SQL, or C (OCI).

For convenience, you can use PL/SQL package DBMS_XDB package for configuration access. It exposes the following functions and procedures:

  • cfg_get – Returns the configuration information for the current session.

  • cfg_refresh – Refreshes the session configuration information using the current configuration file. Typical uses of cfg_refresh include the following:

    • You have modified the configuration and now want the session to pick up the latest version of the configuration information.

    • It has been a long running session, the configuration has been modified by a concurrent session, and you want the current session to pick up the latest version of the configuration information.

  • cfg_update – Updates the configuration information, writing the configuration file. A COMMIT is performed.

Example 34-2 Updating the Configuration File Using CFG_UPDATE and CFG_GET

This example updates parameters ftp-port and http-port in the configuration file.

  v_cfg XMLType;
  SELECT updateXML(DBMS_XDB.cfg_get(), 
    INTO v_cfg FROM DUAL;

If you have many parameters to update, then it can be easier to use FTP, HTTP(S), or Oracle Enterprise Manager to update the configuration.

Configuring Default Namespace to Schema Location Mappings

Oracle XML DB identifies schema-based XMLType instances by pre-parsing the input XML document. If the appropriate xsi:schemaLocation or xsi:noNamespaceSchemaLocation attribute is found, then the specified schema location URL is used to consult the registered schema. If the appropriate xsi: attribute is not found, the XML document is considered to be non-schema-based.Oracle XML DB provides a mechanism to configure default schema location mappings. If the appropriate xsi: attribute is not specified in the XML document, the default schema location mappings will be used. Element schemaLocation-mappings of the Oracle XML DB configuration XML schema, xdbconfig.xsd, can be used to specify the mapping between (namespace, element) pairs and the default schema location. If the element value is empty, the mapping applies to all global elements in the specified namespace. If the namespace value is empty, it corresponds to the null namespace.

The definition of the schemaLocation-mappings element is as follows:

<element name="schemaLocation-mappings"
          type="xdbc:schemaLocation-mapping-type" minOccurs="0"/> 
 <complexType name="schemaLocation-mapping-type"><sequence>
      <element name="schemaLocation-mapping"
               minOccurs="0" maxOccurs="unbounded">
        <element name="namespace" type="string"/>
        <element name="element" type="string"/>
        <element name="schemaURL" type="string"/>

The schema location used depends on mappings in the Oracle XML DB configuration file for the namespace used and the root document element. For example, assume that the document does not have the appropriate xsi: attribute to indicate the schema location. Consider a document root element R in namespace N. The algorithm for identifying the default schema location is as follows:

  1. If the Oracle XML DB configuration file has a mapping for N and R, the corresponding schema location is used.

  2. If the configuration file has a mapping for N, but not R, the schema location for N is used.

  3. If the document root R does not have any namespace, the schema location for R is used.

For example, suppose that your Oracle XML DB configuration file includes the following mapping:


The following schema locations are used:

  • Namespace = Element = rootSchema URL =

    This mapping is used when the instance document specifies:

    <root xmlns="">
  • Namespace = Element = null (any global element in the namespace) Schema URL =

    This mapping is used when the instance document specifies:

    <root xmlns="">
  • Namespace = null (i.e null namespace) Root Element = specialRootSchema URL =

    This mapping is used when the instance document specifies:



This functionality is available only on the server side, that is, when XML is parsed on the server. If XML is parsed on the client side, the appropriate xsi: attribute is still required.

Configuring XML File Extensions

Oracle XML DB Repository treats certain files as XML documents, based on their file extensions. When such files are inserted into the repository, Oracle XML DB pre-parses them to identify the schema location (or uses the default mapping if present) and inserts the document into the appropriate default table. By default, the following extensions are considered as XML file extensions: xml, xsd, xsl, xlt. In addition, Oracle XML DB provides a mechanism for applications to specify other file extensions as XML file extensions. The xml-extensions element is defined in the configuration schema,, as follows:

<element name="xml-extensions"
          type="xdbc:xml-extension-type" minOccurs="0"/> 
 <complexType name="xml-extension-type"><sequence>
      <element name="extension" type="xdbc:exttype"
               minOccurs="0" maxOccurs="unbounded">

For example, the following fragment from the Oracle XML DB configuration file, xdbconfig.xml, specifies that files with extensions vsd, vml, and svgl should be treated as XML files:


Footnote Legend

Footnote 1: There are two different <plsql> elements that are used to configure the embedded PL/SQL gateway. One is a child of <httpconfig>; it defines global parameters. The other is a child of <servlet>; it defines DAD attributes.
Footnote 2: DAD is an abbreviation for Database Access Descriptor; DAD attributes are parameters that define such a descriptor.