Skip Headers

Oracle9i XML Database Developer's Guide - Oracle XML DB
Release 2 (9.2)

Part Number A96620-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page Go to next page
View PDF

21
Managing Oracle XML DB Using Oracle Enterprise Manager

This chapter describes how Oracle Enterprise Manager can be used to manage Oracle XML DB. Oracle Enterprise Manager can be used to configure, create and manage Repository resources, and database objects such as XML schemas and XMLType tables.

It contains the following sections:

Introducing Oracle XML DB and Oracle Enterprise Manager

This chapter describes how to use Oracle Enterprise Manager (Enterprise Manager) to administer and manage Oracle XML DB.

Getting Started with Oracle Enterprise Manager and Oracle XML DB

Oracle Enterprise Manager is supplied with Oracle9i database software, both Enterprise and Standard Editions. To run the Enterprise Manager version that supports Oracle XML DB functionality, use Oracle9i Release 2 (9.2) or higher.

Enterprise Manager: Installing Oracle XML DB

Oracle XML DB is installed by default when the Database Configuration Assistant (DBCA) is used to create a new database. The following actions take place during Oracle XML DB installation:

You Must Register Your XML Schema with Oracle XML DB

Oracle XML DB is typically used for its faster retrieval and search capabilities, access control, and versioning of XML documents. XML instance documents saved in the database can conform to an XML Schema. XML Schema is a schema definition language, also written in XML, that can be used to describe the structure and various other semantics of a conforming XML instance document.

Oracle XML DB provides a mechanism to register XML Schemas with the database.

Assuming that your XML schema document(s) already exists, registering the XML schema is your first task. Before you register the XML schema, you must know the following:

  1. Whether the data for the XML instance documents already exists in relational tables. This would be the case for legacy applications. If so, Object Views for XML must be created.
  2. What is the storage model? Are you using LOB storage, object-relational storage, or both? The answer to this question depends on which parts of the document are queried the most often, and hence would need faster retrieval.
  3. Is the XML Schema document annotated with comments to generate object datatypes and object tables? If not, these objects will have to be created and mapped manually to the database schema.

    See Also:

For most cases, it is assumed that you have XML schema annotated with information to automatically generate object types and object tables. Hence the Oracle9i database, as part of XML schema registration, automatically generates these objects.

See Also:

"Managing XML Schema and Related Database Objects".

Oracle XML DB is now ready for you to insert conforming XML documents.

Oracle Enterprise Manager Oracle XML DB Features

With Enterprise Manager you can perform the following main Oracle XML DB administrative tasks:

See Figure 21-1 and Figure 21-2.

Figure 21-1 Managing Oracle XML DB with Enterprise Manager: Main Tasks

Text description of adxdb022.gif follows
Text description of the illustration adxdb022.gif


Configure Oracle XML DB

Oracle XML DB is managed through the configuration file, xdbconfig.xml. Through Enterprise Manager, you can view or configure this file's parameters. To access the Oracle XML DB configuration options, from the Enterprise Manager right hand window, select "Configure XML Database". See "Configuring Oracle XML DB with Enterprise Manager" .

Create and Manage Resources

To access the XML resource management options, select the XML Database object in the Navigator and click "Create a Resource" in the detail view. See "Creating and Managing Oracle XML DB Resources with Enterprise Manager" .

Manage XML Schema and Related Database Objects

To access the XML schema management options, select the XML Database object in the Navigator and click "Create Table and Views Based on XML Schema" in the detail view. See "Managing XML Schema and Related Database Objects".

You can register, delete, view, generate (that is, reverse engineer) an XML schema and see its dependencies. You can also view an XML schema's contents and perform actions on its constituent elements.

Figure 21-2 Enterprise Manager Console: XML Database Management Window

Text description of oem_xdb.jpg follows.

Text description of the illustration oem_xdb.jpg

The Enterprise Manager Console for Oracle XML DB

See Figure 21-2. From the Enterprise Manager console you can quickly browse and manage Oracle XML DB objects.

XML Database Management Window: Right-Hand Dialog Windows

From the XML Database Management detail view you can access the XML DB management functionality. From there you can select which task you need to perform.

Hierarchical Navigation Tree: Navigator

Use the left-hand Navigator, to select the Oracle XML DB resources and database objects you need to view or modify.

Configuring Oracle XML DB with Enterprise Manager

Oracle XML DB configuration is an integral part of Oracle XML DB. It is used by protocols such as HTTP/WebDav or FTP, and any other components of Oracle XML DB that can be customized, such as, in the ACL based security.

Oracle XML DB configuration is stored as an XML schema based XML resource, xdbconfig.xml in the Oracle XML DB Repository. It conforms to the Oracle XML DB configuration XML schema stored at:

http://www.oracle.com/xdb/xdbconfig.xsd

This configuration XML schema is registered when Oracle XML DB is installed. The configuration property sheet has two tabs:

To configure items in Oracle XML DB, select the Configuration node under XML Database in the Navigator. See Figure 21-3 and See Figure 21-4.

The XML Database Parameters page displays a list of configuration parameters for the current XML database. You can also access this page from the XML Database Management main window > Configure XML Database.

When you click the Configuration node for the XML database in the Enterprise Manager Navigator, the XML DB Parameters page appears in the main panel to the right. The XML DB Parameters window lists the following information:

You can change the value of a parameter by clicking the Value field for the parameter and making the change. Click the Apply button to apply any changes you make. You can access a description of a parameter by clicking on the parameter in the list and then clicking the Description button at the bottom of the page. A text Description text box displays that describes in greater detail the parameter you selected. You can close the Description box by clicking again on the Description button.

Figure 21-3 Enterprise Manager Console: Configuring Oracle XML DB

Text description of configuration.gif follows.

Text description of the illustration configuration.gif

Since Oracle XML DB provides support for standard Internet protocols (FTP and WebDAV/HTTP) as a means of accessing the Repository, Enterprise Manager provides you with related information:

Figure 21-4 Enterprise Manager Console: Oracle XML DB Configuration Parameters Dialog

Text description of configuration_dlg.gif follows.

Text description of the illustration configuration_dlg.gif

Viewing or Editing Oracle XML DB Configuration Parameters

With Enterprise Manager you can view and edit partial Oracle XML DB configuration parameters, in the following categories:

Category: Generic

Category: FTP

Category: HTTP

Creating and Managing Oracle XML DB Resources with Enterprise Manager

The Resources folder in the Enterprise Manager navigation tree is under the XML Database folder. It contains all the resources in the database regardless of the owner. Figure 21-5 shows a typical Resources tree.

When the Resources folder is selected in the Navigator, the right-hand side of the screen displays all the top level Oracle XML DB resources under root, their names, and their creation and modification dates. See Figure 21-6.

Figure 21-5 Enterprise Manager: Oracle XML DB Resources Tree Showing Resources Folder Selected

Text description of res_tree.gif follows.

Text description of the illustration res_tree.gif

Figure 21-6 Enterprise Manager: Top Level Resources Under Root

Text description of resources_rhs.gif follows.

Text description of the illustration resources_rhs.gif

Administering Individual Resources

Once you select a resource sub-folder under the main Resources folder in the Navigator, you can see the resources "General Page" in the detail view, as shown in Figure 21-7.

Figure 21-7 Enterprise Manager: Individual Resources - General Page

Text description of res_gen_page.gif follows.

Text description of the illustration res_gen_page.gif

General Resources Page

The Oracle XML DB Resources General page (also called the XML Resources Page) displays overview information about the resource container or resource file. When you select one of the Oracle XML DB resource containers or files in the Navigator, Enterprise Manager displays the Oracle XML DB Resources General page. This is a read-only page. It displays the following information:

Security Page

Oracle XML DB Resources Security page changes the ACL associated with the XML DB resource container or file. Use the ACL files to restrict access to all XML DB resources. When you change the ACL file for the resource, you change the access privileges for the resource file. See Figure 21-8.

To specify a new ACL file:

  1. Click the Specify a new ACL File option box and then choose a new ACL file from the drop down list in the File Name field.
  2. Click the Apply button to apply the change.
  3. Click the Revert button to abandon any changes you have made to the File Name field.

Figure 21-8 Enterprise Manager: Individual Oracle XML DB Resource - Security Page

Text description of res_security_page.gif follows.

Text description of the illustration res_security_page.gif

Individual Resource Content Menu

Figure 21-9 shows the context-sensitive menu displayed when you select and right-click an individual Oracle XML DB resource object in the Navigator.

Figure 21-9 Enterprise Manager: When You Right-Click an Individual Resource...

Text description of res_rmouse_menu.gif follows.

Text description of the illustration res_rmouse_menu.gif

You can perform the following Oracle XML DB tasks from the Enterprise Manager Content Menu:

Create Resource

Figure 21-10 shows how you can use the Create XML DB Resource dialog box to create an XML DB resource container or file. From the XML DB Resource dialog you can name the resource and then either create a new resource container or create a new resource file, designating the location of the file as either a local file, a file at a specified URL, or specifying the contents of the file.

  1. Access the Create XML DB Resource dialog box by right clicking on the Resources folder or any individual resource node and selecting Create from the context menu. When you name the resource in the Name field, you can change the location by clicking on the Change Location button to the right of the Location field.
  2. Specify whether the resource you are creating is a container or a file. If you create a file by choosing Create a new resource file, you can select from one of three file type location options:
    • Local File -- Select Use a file in the local file system to browse for a file location on your network.
    • File at URL -- Select Use a file at the URL to enter the location of the file on the internet or intranet.
    • File Contents -- Select Specify the resource contents here to enter the contents of a file in the edit box located at the bottom of the Create XML DB Resource dialog box.

Figure 21-10 Enterprise Manager: Create Oracle XML DB Resource Dialog Box

Text description of res_create.gif follows.

Text description of the illustration res_create.gif

Grant Privileges On...

Figure 21-11 shows the Grant Privileges On dialog box which assigns privileges on an Oracle XML DB resource to users or roles. You can grant multiple privileges to multiple users or roles. Grant Privileges On dialog box lists the available Oracle XML DB resource privileges in the Grant section at the top of the panel.

  1. To grant privileges, select the privileges you want to grant by clicking on a privilege. You can select multiple privileges by holding down the Ctrl key while selecting more than one privilege. You can select consecutive privileges by clicking the first privilege in a sequence and holding down the Shift key while clicking the last privilege in the sequence.
  2. Select the user/ group in the To: box at the bottom of the dialog page. Use the same procedure to select multiple users/roles to which to grant privileges.

    See Also:

    "Enterprise Manager and Oracle XML DB: ACL Security" .

Figure 21-11 Enterprise Manager: Granting Privileges On Oracle XML DB Resources

Text description of res_grant_dlg.gif follows.

Text description of the illustration res_grant_dlg.gif

Show Contents

Figure 21-12 is an example of a Show Contents dialog box. It displays the contents of the selected resource file.

Figure 21-12 Enterprise Manager: Show Contents Menus of Individual Oracle XML DB Resource

Text description of show_contents.gif follows.

Text description of the illustration show_contents.gif

Show Grantee

Figure 21-11 shows the Show Grantee of XML DB Resource dialog box. It displays a list of all granted privileges on a specified XML DB resource for the connected Enterprise Manager user. Show Grantee dialog box lists the connected Enterprise Manager user, privilege, and granted status of the privilege in tabular format.

Figure 21-13 Enterprise Manager: Show Grantee of Oracle XML DB Resources

Text description of show_grantee.gif follows.

Text description of the illustration show_grantee.gif

Enterprise Manager and Oracle XML DB: ACL Security

From Enterprise Manager you can restrict access to all XML DB resources by means of ACLs. You can grant XML DB resource privileges to database user and database role separately using the existing Security/Users/user and Security/Roles/role interface, respectively.

You can access the Enterprise Manager security options in two main ways:

Granting and Revoking User Privileges with User > XML Tab

This section describes how to grant and revoke privileges for a "user", The same procedure applies when granting and revoking privileges for a "role". To grant privileges to a user follow these steps:

  1. Select a particular user from the Enterprise Manager Navigator. The detail view displays an additional tab, XML, in the existing property sheet.
  2. To view and select resources on which you want to grant privileges to users or roles, select the XML tab. Once you select a resource, all available privileges for that resource are displayed in the Available Privileges list to the right of the Resources list.
  3. Select the privileges required from the Available Privileges list and move them down to the Granted list that appears at the bottom of the window by clicking on the down arrow.

    Conversely, you can revoke privileges by selecting them in the Granted list and clicking on the up arrow.

  4. After setting the appropriate privileges, click the Apply button to save your changes. Before you save your changes, you can click the Revert button to abandon your changes.

Figure 21-14 Adding or Revoking Privileges with Users > user> XML

Text description of security_user.gif follows.

Text description of the illustration security_user.gif

Resources List

The Resources list is a tree listing of resources located in Oracle XML DB Repository. You can navigate through the folder hierarchy to locate the resource on which you want to set privileges for the user or role you selected in Navigator. When you select a resource in the tree listing, its privileges appear in the Available Privileges list to the right.

Available Privileges List

The Available Privileges list displays all privileges available for a resource. Click a privilege and then press the down arrow button to add the privilege to the Granted list. You can select consecutive privileges by clicking on the first privilege and then holding the Shift key down to select the last in the list. Also, you can select non-consecutive privileges by holding the Ctrl-key down while making selections.

Privileges can be either of the following:

Granted List

The Granted list displays all privileges granted to the user or role for the resource selected in the Resources list. You can revoke a privilege by highlighting it and clicking the up arrow to remove it.

XML Database Resource Privileges

Privilege can be aggregate (contain other privileges) or atomic (cannot be subdivided). The following system privileges are supported:

Figure 21-15 Granting Privileges on a Resource

Text description of res_grant_dlg.gif follows.

Text description of the illustration res_grant_dlg.gif

See Also:

Chapter 18, "Oracle XML DB Resource Security" for a list of supported system privileges.

Managing XML Schema and Related Database Objects

From the XML Database Management detail view, when you select "Create tables and views based on XML Schema" the "XML Schema Based Objects" page appears. With this you can:

Navigating XML Schema in Enterprise Manager

Under the XML Schema folder, the tree lists all the XML schema owners. The example here is owner "XDB". See Figure 21-16:

Figure 21-16 Enterprise Manager Console: Navigating XML Schema

Text description of tree.gif follows.

Text description of the illustration tree.gif

Figure 21-17 Enterprise Manager: Creating XML Schema-Based Objects

Text description of html2.gif follows.

Text description of the illustration html2.gif

Registering an XML Schema

Registering an XML schema is one of the central, and often first, tasks before the you use Oracle XML DB. XML schema are registered using DBMS_XMLSCHEMA.registerSchema().

See Also:

Chapter 5, "Structured Mapping of XMLType"

Figure 21-18 shows you how to register an XML schema.

General Page

From the GENERAL page, input the XML schema URL and select the Owner of the XML schema from the drop-down list.

Select either:

You can obtain the XML schema in one of four ways:

Options Page

From the Options page you can select the following options:

See Figure 21-19. Press Create from either the General Tab or Options Tab to register this XML schema.

Figure 21-18 Enterprise Manager: Registering an XML Schema - General Page

Text description of xschema1.gif follows.

Text description of the illustration xschema1.gif

Figure 21-19 Enterprise Manager: Creating XML Schema - Options Page

Text description of xschema2.gif follows.

Text description of the illustration xschema2.gif

Creating Structured Storage Infrastructure Based on XML Schema

This section describes how to use Oracle Enterprise Manager to create XMLType tables, views, and indexes.

Creating Tables

You have two main options when creating tables:

Creating Views

To create an XMLType view, see "Creating a View Based on XML Schema".

Creating Function-Based Indexes

To create function-based indexes see "Creating a Function-Based Index Based on XPath Expressions".

Creating an XMLType Table

From the Create Table property sheet, enter the desired name of the table you are creating on the General page. Select the table owner from the drop-down list "Schema". Leave Tablespace at the default setting. Select "XMLType" table.

Under the lower "Schema" option, select the XML schema owner, from the drop-down list.

Under "XML Schema", select the actual XML schema from the drop-down list.

Under "Element", select the required element to from the XMLType table, from the drop-down list.

Specify the storage:

Figure 21-20 Enterprise Manager: Creating XMLType Tables-General Page

Text description of xtab1.gif follows.

Text description of the illustration xtab1.gif

Figure 21-21 Enterprise Manager: Creating XMLType Tables - Specifying LOB Storage

Text description of xtab2.gif follows.

Text description of the illustration xtab2.gif

Creating Tables with XMLType Columns

See Figure 21-22 shows the Create Table General page. To create a table with XMLType columns follow these steps:

  1. From the Create Table property sheet, enter the desired name of the table you are creating on the General page.
  2. Select the table owner from the drop-down list "Schema". Leave Tablespace at the default setting.
  3. Select "Define Columns".
  4. Enter the Name. Enter the Datatype; select XMLType from the drop-down list. The XMLType Options dialog window appears. See Figure 21-23.

Figure 21-22 Enterprise Manager: Creating Tables With XMLType Column - General Page

Text description of xtcol1.gif follows.

Text description of the illustration xtcol1.gif