This discussion is archived
1 2 Previous Next 20 Replies Latest reply: Jul 18, 2008 3:20 PM by mdrake RSS

XML DB FAQ

mdrake Expert
Currently Being Moderated
This is the official XML DB FAQ Thread. It is a locked thread. I will update it as I see commonly asked questions.
  • 2. How can I load XML content into Relational Tables  ?
    mdrake Expert
    Currently Being Moderated
    Please see the following thread

    XMLType view of Relational Content
  • 3. How can I view my XML content as relational tables ?
    mdrake Expert
    Currently Being Moderated
    Please see the following thread

    Relational Views of XML Content.
  • 4. Why am I getting an ORA-00600 with arguments [qmxiUnpPacked2], [121] ?
    mdrake Expert
    Currently Being Moderated
    This message will occur when a database created with Oracle Database 9iR2 version 9.2.0.1.0 is accessed after upgrading to version 9.2.0.2.0 or later.

    The error message indicates that the catpatch upgrade script, found in $ORACLE_HOME/rdbms/admin was not run after installing the upgrade, or that the script failed to run successfully.

    The problem can also occur in later versions of the 9.2.x product when a new database is created using DBCA. The Seed database templates in 9.2.x. were created with 9.2.0.1.0 and consequently when a new database is created it using the templates it is, in effect a 9.2.0.1.0 database and has to be upgraded by running catpatch before it can be used with 9.2.0.2.0 or later
  • 5. What is the minmum supported database release for XML DB functionality ?
    mdrake Expert
    Currently Being Moderated
    The miumum supported release, client and server, is 9.2.0.3.0.

    9.2.0.1.0 and 9.2.0.2.0 are not supported for any XMLType related functionalilty, including using of the DBMS_XMLPARSER, DBMS_XMLDOM and DBMS_XSLPROCESSOR packages, XMLType tables or columns or SQL/XML publishing functions.
  • 6. Where can I learn more about the XML DB features ?
    mdrake Expert
    Currently Being Moderated
    See the XML DB Pages on OTN

    http://www.oracle.com/technology/tech/xml/xmldb/index.html
  • 9. How do I work with XMLType using Java and JDBC ?
    mdrake Expert
    Currently Being Moderated
    Please see the following post

    How do I access XMLType using JDBC ?
  • 10. How to I use namespaces with XMLQuery() ?
    mdrake Expert
    Currently Being Moderated
    In SQL*PLUS the following will work
    SQL> xquery xquery version "1.0"; (: :)
      2          declare default element namespace "POI"; (: :)
      3              for $x in fn:doc("/urs/025_XPOI/XDB/xdb/Simple/xml/001_03082006/xpoi/simple.xml")/Simple_XPOIS/Simple
      4            where $x/ID = 1
      5           return $x
      6  / 
    No items selected.
     
    SQL>
    Progammatically your would execute this as
    SQL> select *
      2    from xmltable
      3         ('xquery version "1.0"; (: :)
      4          declare default element namespace "POI"; (: :)
      5              for $x in fn:doc("/urs/025_XPOI/XDB/xdb/Simple/xml/001_03082006/xpoi/simple.xml")/Simple_XPOIS/Simple
      6            where $x/ID = 1
      7           return $x'
      8         )
      9  / 
     
    no rows selected
     
    SQL>
    The empty comments '(: :)' at the end of each XQuery statemetn are introduced to stop the SQL*PLUS interpreter from treating the ';' as the end of the SQL Statement.
  • 11. How do I declare namespace prefix mapping with XMLTable() ?
    mdrake Expert
    Currently Being Moderated
    Namespace : Prefix mapping are declared by including an xmlNamespaces operator as the first item inside the XMLTable operator. The form of the xmlNamespaces operator is shown below
    xmlnamespaces
    (
       default 'http://www.courts.state.mn.us/CourtXML/2.0.0',
        'http://schemas.xmlsoap.org/ws/2004/03/addressing' as "wsa",
        'http://schemas.xmlsoap.org/soap/envelope/' as "soap", 
    ),
  • 13. Why is the size of my XML document 0 bytes when viewed via HTTP or FTP ?
    mdrake Expert
    Currently Being Moderated
    When a schema based XML is loaded into the XML DB repository via HTTP, FTP or dbms_xdb.createResource() the document is converted from a textual serialization of XML into a series of objects. At this point the size of the document becomes (a) meaningless and (b) difficult / expensive to calculate.

    The first question is what is meant by the size of the document once it has been stored using object-based persistence ? There are two possibilities

    (1) The number of bytes used the text serialization of the XML document.

    (2) The number of bytes required to store the internal object representation of the document. In this case the does the size include the bytes used for keys, refs indexes, etc ?

    Since (1) would be expensive to maintain as the document is updated (particularly in the case of partial updates) and (2) is expensive to calculate on a document by document basis, XML DB shows the size of all schema based XML documents as 'zero' bytes.

    Note that this also applies to the size of the registered version of XML Schema documents, which can be found in the folder tree /sys/schemas.

    If a schema based XML document is loaded into the repository and does not appear as 0 bytes long when viewed via HTTP or WebDAV this means that XML DB was unable to identifiy the XML schema the XML document is associated with.

    Note that immediatlely after uploading a document in Windows Explorer using the WebDAV protocol the size of the document will be non-zero, since the original size is cached by the Microsoft WebDAV client. However once a refresh of the folder is performed in Windows Explorer the size should be shown as zero if the document was recognized as a schema based document.
  • 14. How do I tell if XML DB is installed.. How do I install it.. ?
    mdrake Expert
    Currently Being Moderated
    First check if the XDB database schema exists

    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select 1 from all_users where username  = 'XDB';
    
             1
    ----------
             1
    Next check if RESOURCE_VIEW exists
    SQL> desc RESOURCE_VIEW
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     RES                                                SYS.XMLTYPE(XMLSchema "http:
                                                        //xmlns.oracle.com/xdb/XDBRe
                                                        source.xsd" Element "Resourc
                                                        e")
     ANY_PATH                                           VARCHAR2(4000)
     RESID                                              RAW(16)
    If the first query returns 0 then XDB has not been installed. It can be installed by running the catqm.sql script found in $ORACLE_HOME/rdbms/admin. This script will create the XDB database schema and the tables needed for XML Schema registration and the XML DB repository. The script takes 3 arguments

    1. The password for the XDB database user

    2. The tablespace for the objects owned by the database user XDB

    3. The temporary tablespace that will be used by the XDB database user.

    Note if the XDB user exists but RESOURCE_VIEW does not do not run catqm. This situation would mean that you have some other database schema called XDB. You need to resolve this before installing XDB.
1 2 Previous Next