|Oracle9i XML Database Developer's Guide - Oracle XML DB
Release 2 (9.2)
Part Number A96620-02
This chapter describes how you can import and export
XMLType tables for use with Oracle XML DB.
It contains the following sections:
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.
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.
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.
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:
DBMS_XMLSCHEMA.REGISTERSCHEMAstatement. In this statement:
FORCEflag is set to true. This is necessary for out-of-order registration of schemas during import. Since the export process does not dump XML schemas in any particular order, a schema that imports other schemas may not necessarily occur after them. Also, cyclical references between XML schemas require the
FORCEflag to be true for successful registration.
GENTYPESflag is set to false. The types have already been generated in step 1.
GENTABLESflag is set to false. The tables will be created later (step 3) along with their OIDs. It is not possible to specify OIDs in the
GENBEANSflag is set to false.
SQLSchema,... This is necessary to be able to import data from a different user.
The following describes guidelines for exporting hierarchy-enabled tables:
OWNERIDare not exported for these tables. This is because in an imported database, the values of these columns could be different and hence should be re-initialized.
IMPORT/EXPORT syntax and description are described in Oracle9i Database Utilities. This chapter includes additional guidelines and examples for using IMPORT/EXPORT with
The examples here assume that you are using a database with the following features:
This exports the following:
This exports the following:
This does not export Schema SG1 or any types that were created during the registration of schema SG1.
This imports all the data in file1.dmp to schema newuser.
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.
This creates table TG1 for user U2 since U2 already has access to the globals schema SG1 and the types that it depends on.
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.
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.