Skip Headers

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

Part Number A96620-02
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

Go to previous page Go to next page
View PDF

Importing and Exporting XMLType Tables

This chapter describes how you can import and export XMLType tables for use with Oracle XML DB.

It contains the following sections:

Overview of IMPORT/EXPORT Support in Oracle XML DB

Oracle XML DB supports XMLType tables and columns that can store XML data and be based on a registered XML schema. Tables storing XML schema-based or non-schema-based data can be imported and exported.

Resource s and Foldering Do Not Fully Support IMPORT/EXPORT

Oracle XML DB also supports a foldering mechanism in the database that provides a file-system like paradigm to database data. This model uses pathnames and URIs to refer to data (referred to as resources) rather than table names, column names, and so on. This release however does not support this paradigm using IMPORT/EXPORT.

However for resources based on a registered XML schema, the actual XMLType tables storing the data can be exported and imported. This implies that only the XML data is exported while the relationship in the Oracle XML DB foldering hierarchy would be lost.

Non-XML Schema-Based XMLType Tables and Columns

XMLType tables and columns can be created without any XML schema specification in which case the XML data is stored in a CLOB.

Data from these tables can be exported and imported in a manner similar to LOB columns. The export dump file stores the actual XML text.

XML Schema-Based XMLType Tables

Oracle supports the export and import of XML schema-based XMLType tables. An XMLType table depends on the XML schema used to define it. Similarly the XML schema has dependencies on the SQL object types created or specified for it. Thus, export of XMLType tables or a database with XMLType tables, consists of the following steps:

  1. Exporting SQL Types During XML Schema Registration. As a part of the XML schema registration process, SQL types can be created. These SQL types are exported as a part of CREATE TYPE statement along with their OIDs.
  2. Exporting XML Schemas. After all the types are exported, XML schemas are exported as XML text as part of the DBMS_XMLSCHEMA.REGISTERSCHEMA statement. In this statement:

Guidelines for Exporting Hierarchy-Enabled Tables

The following describes guidelines for exporting hierarchy-enabled tables:

IMPORT/EXPORT Syntax and Examples

The IMPORT/EXPORT syntax and description are described in Oracle9i Database Utilities. This chapter includes additional guidelines and examples for using IMPORT/EXPORT with XMLType data.

IMPORT/EXPORT Example Assumptions

The examples here assume that you are using a database with the following features:

User Level Import/Export

Example 23-1 Exporting XMLType Data

export sytem/manager file=file1 owner=U1 

This exports the following:

Example 23-2 Exporting XMLType Tables

export sytem/manager file=file2 owner=U2 

This exports the following:


This does not export Schema SG1 or any types that were created during the registration of schema SG1.

Example 23-3 Importing Data from a File

import system/manager file=file1 fromuser=U1 touser=newuser 

This imports all the data in file1.dmp to schema newuser.

Table Mode Export

An XMLType table has a dependency on the XML schema that was used to define it. Similarly the XML schema has dependencies on the SQL object types created or specified for it. Importing an XMLType table requires the existence of the XML schema and the SQL object types. When a TABLE mode export is used, only the table related metadata and data are exported. To be able to import this data successfully, the user needs to ensure that both the XML schema and object types have been created.

Example 23-4 Exporting XML Data in TABLE Mode

exp SYSTEM/MANAGER file=expdat.dmp owner=U1 tables=TG1 

This exports:

Example 23-5 Importing XML Data in TABLE Mode

imp SYSTEM/MANAGER file=expdat.dmp fromuser=U1 touser=U2 tables=TG1 

This creates table TG1 for user U2 since U2 already has access to the globals schema SG1 and the types that it depends on.

Metadata in Repository is Not Exported During a Full Database Export

Oracle XML DB stores the metadata (and the non-schema data) for the Repository in the XML DB database user schema. Since Oracle does not support the Repository structure to be exported, these metadata tables and structures will not be exported when doing a full database export.

In fact the entire XML DB user schema will be skipped during a full database export and any database objects owned by XML DB ("XDB") will not be exported.

Importing and Exporting with Different Character Sets

As with other database objects, XML data is exported in the character set of the exporting server. During import, the data gets converted to the character set of the importing server.