Registration Of XML Schema

Hi All,
Created below block for registration of the XML Schema in database.
Which is working fine.
But strange thing is happing, actually when i am creating below code as stored procedure and executing sql prompt getting insufficent privilage.
When running below code in form of unnamed block(Aynomanus Block) is working fine.
Can you please help me understand why strange thing is happing.
DECLARE
PROCEDURE register_xml(p_schema_url VARCHAR2,p_xmlfile_url VARCHAR2,p_dir_name VARCHAR2)
IS
l_folders VARCHAR2(32767);
PROCEDURE check_folders(p_folders VARCHAR2)
IS
v_return BOOLEAN;
folder_exists EXCEPTION;
PRAGMA EXCEPTION_INIT(folder_exists, -31003);
l_pass NUMBER;
BEGIN
FOR i IN 1..(LENGTH(p_folders)-LENGTH(REPLACE(p_folders,'/'))) LOOP
BEGIN
IF SUBSTR(p_folders,1,INSTR(p_folders,'/',1,i+1)) IS NOT NULL THEN
v_return := DBMS_XDB.CREATEFOLDER(SUBSTR(p_folders,1,INSTR(p_folders,'/',1,i+1)));
END IF;
EXCEPTION
WHEN folder_exists THEN
NULL;
END;
END LOOP;
Dbms_Output.put_line('Commit Executed');
COMMIT;
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20001,'Error while creating folders',TRUE);
END check_folders;
PROCEDURE register_xml_schema(p_xsd_url VARCHAR2,p_dir VARCHAR2)
IS
l_ret BOOLEAN;
BEGIN
l_ret := DBMS_XDB.CREATERESOURCE(
abspath => SUBSTR(p_xsd_url,INSTR(p_xsd_url,'/',1,3)),
data => BFILENAME (p_dir,SUBSTR(p_xsd_url,INSTR(p_xsd_url,'/',-1)+1))
IF l_ret THEN
DBMS_XMLSCHEMA.REGISTERSCHEMA(
schemaurl => p_xsd_url,
schemadoc => sys.UriFactory.getUri(SUBSTR(p_xsd_url,INSTR(p_xsd_url,'/',1,3)))
COMMIT;
END IF;
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20002,'Error while registring schema xsd file',TRUE);
END register_xml_schema;
PROCEDURE register_xml_file(p_xml_url VARCHAR2,p_dir VARCHAR2)
IS
v_return BOOLEAN;
l_folders VARCHAR2(32767);
BEGIN
l_folders := SUBSTR(p_xml_url,
INSTR(p_xml_url,'/',1,3),
(INSTR(p_xml_url,'/',1,(LENGTH(p_xml_url)-LENGTH(REPLACE(p_xml_url,'/'))))-INSTR(p_xml_url,'/',1,3))+1
DBMS_OUTPUT.PUT_LINE('Folders -->'||l_folders);
check_folders(l_folders);
v_return := DBMS_XDB.CREATERESOURCE(
abspath => SUBSTR(p_xml_url,INSTR(p_xml_url,'/',1,3)),
data => BFILENAME (p_dir,SUBSTR(p_xml_url,INSTR(p_xml_url,'/',-1)+1))
COMMIT;
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20003,'Error while registring xml file',TRUE);
END register_xml_file;
PROCEDURE delete_schema(p_schema_url VARCHAR2,p_xml_url VARCHAR2)
IS
BEGIN
DBMS_XDB.DELETERESOURCE(
abspath => SUBSTR(p_xml_url,INSTR(p_xml_url,'/',1,3))
DBMS_XDB.DELETERESOURCE(
abspath => SUBSTR(p_schema_url,INSTR(p_schema_url,'/',1,3))
DBMS_XMLSCHEMA.DELETESCHEMA(
schemaurl => p_schema_url,
delete_option => 4
COMMIT;
EXCEPTION
WHEN OTHERS THEN
NULL;
END delete_schema;
BEGIN
l_folders := SUBSTR(p_schema_url,
INSTR(p_schema_url,'/',1,3),
(INSTR(p_schema_url,'/',1,(LENGTH(p_schema_url)-LENGTH(REPLACE(p_schema_url,'/'))))-INSTR(p_schema_url,'/',1,3))+1
check_folders(l_folders);
delete_schema(p_schema_url,p_xmlfile_url);
register_xml_schema(p_schema_url,p_dir_name);
register_xml_file(p_xmlfile_url,p_dir_name);
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20004,'Error while working with XML Schema Structure',TRUE);
END register_xml;
BEGIN
register_xml('http://localhost:8080/public/demo/xsd/db_objects.xsd','http://localhost:8080/public/demo/xsd/db_objects.xml','XML_DIR');
END;
Thanks
Sandeep

I cannot help you, but i can say that I have the same your problem, everything works fine if i run in an anonymous block, while gettin insufficient privileges when run it in a store procedure.

Similar Messages

  • Facing problem in xml schema xsd file registration

    Hi,
    i am facing problem in xml schema xsd file registration when
    the number of column is more. It is showing persing error.
    if i am deleting few column from xsd file . It is working otherwise
    showing error. Is there any solution for that please suggest me.
    The Error is
    ORA-31011:XML parsing failed
    ORA_19202: Error occurred in XML processing
    LPX-00230 : (message vary time to time-like invalid tag ending etc.)
    Regards
    Manoranjan
    and thanks in advance

    Where is you XML coming from. Are you sure it's valid. If you are hard coding it as a SQL String constant are you hitting the 4k / 32K limit on the size of SQL / PL/SQL constant. Have you tried loading the content from a bfile..

  • How can I  refer an xml  Schema that was registred in Oracle xml DB

    How can I refer an xml Schema that was registred in Oracle xml DB, from other xml schema?
    I have the follow schema,:
    <?xml version="1.0" encoding="AL32UTF8"?>
    <xsd:schema targetNamespace="schemastipostasa.xsd"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb/XDBSchema.xsd"
    elementFormDefault="unqualified" version="1.0"
    attributeFormDefault="unqualified">
    <xsd:simpleType name="codigosType" xdb:SQLType="NUMBER(4)">
    <xsd:restriction base="xsd:positiveInteger" >
    <xsd:totalDigits value="4" />
    </xsd:restriction>
    </xsd:simpleType >
    <xsd:simpleType name="integerUnoType" xdb:SQLType="NUMBER(1)">
    <xsd:restriction base="xsd:int" >
    <xsd:totalDigits value="1" />
    </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="condicionType" xdb:SQLType="VARCHAR2(1)">
    <xsd:restriction base="xsd:string">
    <xsd:enumeration value="S" >
    <xsd:annotation>
    <xsd:documentation>Condicion si es S</xsd:documentation>
    </xsd:annotation>
    </xsd:enumeration>
    <xsd:enumeration value="N" >
    <xsd:annotation>
    <xsd:documentation>Condicion no es N</xsd:documentation>
    </xsd:annotation>
    </xsd:enumeration>
    </xsd:restriction>
    </xsd:simpleType >
    </xsd:schema>
    I registred the schema written above with the folowwing pl*sql :
    DECLARE
    direc varchar2(2000);
    nombreArch BFILE;
    mens varchar2(2000);
    BEGIN
    direc:=uso_comun.pack_mail.fun_valor_param('TASA','DIR_DBSERVER');
    nombreArch:=bfilename(direc,'schemas_tipos_tasa.xsd');
    DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL => 'http://xmlns.oracle.com/tasa/schemas.tipos.tasa.xsd',
    SCHEMADOC => nombreArch,
    LOCAL => TRUE,
    CSID => nls_charset_id('AL32UTF8'));
    dbms_lob.CLOSE(nombreArch);
    dbms_output.put_line('salio sin cancelar');
    exception
    when others then
    mens:=sqlerrm;
    dbms_lob.CLOSE(nombreArch);
    rollback;
    raise_application_error (-20001,'en registro shcema='||mens);
    END;
    Then, I want to register the following schema, that mention de schema above:
    <?xml version="1.0" encoding="AL32UTF8"?>
    <xsd:schema targetNamespace="schema.repuesto.xsd"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb/XDBSchema.xsd"
    xmlns:tns="http://xmlns.oracle.com/tasa/schemas.tipos.tasa.xsd"
    elementFormDefault="qualified" version="1.0"
    attributeFormDefault="unqualified" >
    <xsd:element name="PRECIORENG" type="preciorepType" />
    <xsd:complexType name="preciorepType" >
    <xsd:sequence minOccurs="1" maxOccurs="unbounded">
    <xsd:element name="CODIGO_MARCA" type="tns:codigosType" />
    <xsd:element name="ORIGEN_PRECIO" type="tns:integerUnoType" />
    <xsd:element name="INGRESO_POR_FALTANTE" type="tns:condicionType" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    But when a run the following script whith the same db-user:
    DECLARE
    direc varchar2(2000);
    nombreArch BFILE;
    mens varchar2(2000);
    BEGIN
    direc:=uso_comun.pack_mail.fun_valor_param('TASA','DIR_DBSERVER');
    -- nombreArch:=bfilename(direc,'prueba_schema_seis.xsd');
    nombreArch:=bfilename(direc,'Schema_repuesto_nuevo.xsd');
    DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL =>'http://xmlns.oracle.com/tasa/schema.repuesto.xsd',
    SCHEMADOC => nombreArch,
    LOCAL => TRUE,
    CSID => nls_charset_id('AL32UTF8'));
    dbms_lob.CLOSE(nombreArch);
    dbms_output.put_line('salio sin cancelar');
    --commit;
    exception
    when others then
    mens:=sqlerrm;
    dbms_lob.CLOSE(nombreArch);
    rollback;
    raise_application_error (-20001,'en registro shcema='||mens);
    END;
    tell me the error: ORA: 01031, insufficient privileges!!!!, what’s wrong??,

    Hi,
    To register schema, you require XDBADMIN system privilege granted to the user.
    Please verify this and retry.
    Rgds,
    Rakesh Tripathi

  • Error while registring xml schema

    Hi,
    I am trying to register following xml schema,
    BEGIN
    dbms_xmlschema.registerSchema(
    'ocastatus.xsd',
    '<?xml version="1.0"?>
    <xsd:schema
    targetNamespace="http://xmlbeans.apache.org/ocastatus"
    xmlns="http://xmlbeans.apache.org/ocastatus"
    elementFormDefault="qualified"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb">
    <xsd:element name="ocaStatus" type="OCASTATUS_TYPEType"/>
    <xsd:complexType name="OCASTATUS_TYPEType" xdb:SQLType="OCASTATUS_TYPE">
    <xsd:sequence>
    <xsd:element name="status" type="STATUS_TYPEType" xdb:SQLName="status" maxOccurs="unbounded" xdb:SQLCollType="STATUS_V"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="STATUS_TYPEType" xdb:SQLType="STATUS_TYPE">
    <xsd:sequence>
    <xsd:element name="statusCode" type="xsd:double" xdb:SQLName="statusCode" xdb:SQLType="NUMBER"/>
    <xsd:element name="statusDate" xdb:SQLName="statusDate" xdb:SQLType="VARCHAR2">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="50"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="userId" xdb:SQLName="userId" xdb:SQLType="VARCHAR2">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="50"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="comment" xdb:SQLName="comment" xdb:SQLType="VARCHAR2">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:maxLength value="100"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>',
    true,
    true,
    false);
    END;
    While doing so, I am getting following error,
    ORA-20001: enable_hierarchy_internal
    ORA-06512: at "XDB.DBMS_XDBZ", line 28
    ORA-06512: at line 1
    ORA-06512: at "XDB.DBMA_XMLSCHEMA_INT", line 3
    ORA-06512: at "XDB.DBMA_XMLSCHEMA", line 14
    ORA-06512: at line 2
    Vendor code 20001 Error at line: 1
    I have no clue about this errors. I don't know if it is linked to user privileges.
    The user I am using has following privileges,
    CREATE SESSION
    CREATE TABLE
    CREATE CLUSTER
    CREATE SEQUENCE
    CREATE PROCEDURE
    CREATE TRIGGER
    CREATE TYPE
    CREATE OPERATOR
    CREATE INDEXTYPE
    Please help.
    Thanks in advance.

    I would need the full database version (all digits) to be able to answer it, so could you please provide this.
    The other, strange thing, in this example that you gave is the ORA-20001 error... This is not (afaik) an Oracle thrown error but a user defined error as shown, for example, in this post http://www.dbmotive.com/oracle_error_codes.php?errcode=20001.
    As it is, IMHO, correctly stated in that post:
    Error messages starting from -20000 until -20999 are user specified error messages.
    Oracle provides these range of codes so applications can raise an application specific error, which will be displayed after the chosen code.
    This is done using the raise_application_error pl/sql function.
    You'll have to contact the application provider should you want to have more detail about the error message.
    Unless the error message is of an Oracle application or functionality, it is useless to contact Oracle for these errors.

  • XML SCHEMA registration for XML TYPE (storing XML files in Oracle 10g)

    I have created the XML Schema for the XML file stored in Oracle 10g and also added this Schema into the database. I have related that schema with the column in the table which contains the XML file. When i execute the query to fetch the data from the stored file i am getting a blank resultset. Is registering the XML Schema is necessary, if yes then please let me know the process of doing it. I have tried following steps to register Schema, but it is not working
    Step1:
    DECLARE
    v_return BOOLEAN;
    BEGIN
    v_return := dbms_xdb.createFolder('/home/');
    v_return := dbms_xdb.createFolder('/home/DEV/');
    v_return := dbms_xdb.createFolder('/home/DEV/xsd/');
    v_return := dbms_xdb.createFolder('/home/DEV/messages/');
    v_return := dbms_xdb.createFolder('/home/DEV/employees/');
    COMMIT;
    END;
    STEP 2:
    Connecting To XML DB
    Step3:
    Register XML schema
    I am failing to execute step number 2 and hence not able to register the schema also.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by sudeepk:
    If a java exception is thrown probably during ur install u might have forgotten
    grant javauserpriv to scott;
    grant javasyspriv to scott;
    Thanks
    [email protected]
    <HR></BLOCKQUOTE>
    Thank you!!!

  • XML schema Registration ??

    Hello,
    Our environment is
    SQL*Plus: Release 9.2.0.4.0
    Oracle9i Enterprise Edition Release 9.2.0.4.0
    OS Windows 2000
    We registered XML schema in XML DB.
    oraxdb:schemaURL="PORR_MT030001Fatalities"
    <xsd:element name="BiologicsSafetyCase" type="PORR_MT030001.BiologicsSafetyCase" oraxdb:propNumber="271050" oraxdb:global="true" oraxdb:SQLName="BiologicsSafetyCase" oraxdb:SQLType="PORR_MT030001.Biologics1829_T" oraxdb:SQLSchema="HL7_KSMITH" oraxdb:memType="258" oraxdb:defaultTable="BiologicsSafetyCase1840_TAB" oraxdb:defaultTableSchema="HL7_KSMITH"/>
    When we query user_xml_tables. It shows following.
    SELECT "SYS"."USER_XML_TABLES"."TABLE_NAME" as "TABLE_NAME",
    "SYS"."USER_XML_TABLES"."XMLSCHEMA" as "XMLSCHEMA",
    "SYS"."USER_XML_TABLES"."ELEMENT_NAME" as "ELEMENT_NAME"
    FROM "SYS"."USER_XML_TABLES"
    WHERE ( "XMLSCHEMA" LIKE '%Fata%')
    TABLE_NAME XMLSCHEMA ELEMENT_NAME
    support1807_TAB PORR_MT030001Fatalities support
    BiologicsSafetyCase1840_TAB PORR_MT030001Fatalities BiologicsSafetyCase
    XXIfTRALI681800_TAB PORR_MT030001Fatalities XXIfTRALI68
    location1587_TAB PORR_MT030001Fatalities location
    XXEventDescription81799_TAB PORR_MT030001Fatalities XXEventDescription8
    manufacturingProcess1793_TAB PORR_MT030001Fatalities manufacturingProcess
    partOrganization1611_TAB PORR_MT030001Fatalities partOrganization
    organization1616_TAB PORR_MT030001Fatalities organization
    locatedPlace1583_TAB PORR_MT030001Fatalities locatedPlace
    causedRecipientReacti1798_TAB PORR_MT030001Fatalities causedRecipientReaction
    It shows additional O-R tables against different elements.
    Is it normal?
    How does these tables links with main table oraxdb:defaultTable="BiologicsSafetyCase1840_TAB" shows in registered schema header?
    Do we able to segment this schema ?
    Let me know your thought.
    Thanks in advance.
    Ram

    Hello,
    Our environment is
    SQL*Plus: Release 9.2.0.4.0
    Oracle9i Enterprise Edition Release 9.2.0.4.0
    OS Windows 2000
    We registered XML schema in XML DB.
    oraxdb:schemaURL="PORR_MT030001Fatalities"
    <xsd:element name="BiologicsSafetyCase" type="PORR_MT030001.BiologicsSafetyCase" oraxdb:propNumber="271050" oraxdb:global="true" oraxdb:SQLName="BiologicsSafetyCase" oraxdb:SQLType="PORR_MT030001.Biologics1829_T" oraxdb:SQLSchema="HL7_KSMITH" oraxdb:memType="258" oraxdb:defaultTable="BiologicsSafetyCase1840_TAB" oraxdb:defaultTableSchema="HL7_KSMITH"/>
    When we query user_xml_tables. It shows following.
    SELECT "SYS"."USER_XML_TABLES"."TABLE_NAME" as "TABLE_NAME",
    "SYS"."USER_XML_TABLES"."XMLSCHEMA" as "XMLSCHEMA",
    "SYS"."USER_XML_TABLES"."ELEMENT_NAME" as "ELEMENT_NAME"
    FROM "SYS"."USER_XML_TABLES"
    WHERE ( "XMLSCHEMA" LIKE '%Fata%')
    TABLE_NAME XMLSCHEMA ELEMENT_NAME
    support1807_TAB PORR_MT030001Fatalities support
    BiologicsSafetyCase1840_TAB PORR_MT030001Fatalities BiologicsSafetyCase
    XXIfTRALI681800_TAB PORR_MT030001Fatalities XXIfTRALI68
    location1587_TAB PORR_MT030001Fatalities location
    XXEventDescription81799_TAB PORR_MT030001Fatalities XXEventDescription8
    manufacturingProcess1793_TAB PORR_MT030001Fatalities manufacturingProcess
    partOrganization1611_TAB PORR_MT030001Fatalities partOrganization
    organization1616_TAB PORR_MT030001Fatalities organization
    locatedPlace1583_TAB PORR_MT030001Fatalities locatedPlace
    causedRecipientReacti1798_TAB PORR_MT030001Fatalities causedRecipientReaction
    It shows additional O-R tables against different elements.
    Is it normal?
    How does these tables links with main table oraxdb:defaultTable="BiologicsSafetyCase1840_TAB" shows in registered schema header?
    Do we able to segment this schema ?
    Let me know your thought.
    Thanks in advance.
    Ram

  • How can i change a xmltype column's xml schema?

    i create a table that have a xmltype column.this column is schema-based.
    my problem is ,
    now i want to this column's schema will be redefined to a global schema?
    [b]how can i change the column's schema which already have a schema?

    When a schema is registered a lot of additonal annotations are added to the XML schema by the schema registration process - Look at the version of the XML schema under /sys/schemas/... in the XML DB repository. This information is unqiue to that version of the XML schema and is used internally to manage instance level metadata.
    When instance documents are stored in the DB a set of metadata is generated for each document so that we can make sure that we can maintain DOM Fidelity. This metadata is tied directly to the XML schema the document is associated and is only valid in the context of that XML Schema.
    So when the schema is registered locally and instances are stored the generated metadata is only valid in the context of the local schema. If the same schema is now registered globally new values will be generated for the annotations applied to the global version of the XML schema. Consequently the metadata associated with a document belonging to the local version of the XML schema has no meaning when viewed in the context of the global version of the XML schema.
    The net effect of this is that you will need to copy the data in order to get documents where the metadata for each document is based on the global version of the XML SChema.

  • Error downloading XML schema processor for java from OTN

    I'm getting error downloading this product from otn site. http://technet.oracle.com/tech/xml/schema_java/index.htm
    I login to OTN, go to this site, enter registration information and then I get the following error when I try to submit my info.
    Runtime error occured. Do you wish to debug?
    Line: 20
    Error :'e_mail_valid' is undefined.
    When I say 'No' for debug, it takes me to 'XML parser for java' download page instead of 'XML Schema processor'.
    please help.
    thankx
    null

    The 'e_mail_valid' is undefined" has to do with the format of or lack of the email address. The routing problem is ours and should be fixed later today or by tomorrow morning.
    Thanks,
    Oracle XML Team

  • How to identify objects created by registering xml schema

    Hi Everyone,
    We are using Oracle 9i Rel2. I have registered an XML schema and I saw that there were several objects created for it table ,some types and a trigger . For some build purposes I want to exclude all of these objects which are associated with xml schema and should be able to drop and recreate the whole of oracle schema.
    I see the user_types table does not have any parameter to indicate that these are autogenerated or are different. In user_types they look like any other type that a user would have created. Do any of you know how to differentiate these types created by registering XML schemas from the normal types.
    Thanks for your help

    There is no way I know of to differentiate between a type created by Schema Registration and another Type. You can query the XML Schema itslef to get the Typenames it relies on.
    SQL> --
    SQL> SQL> select nvl(extractvalue
    2 (
    3 value(ct),
    4 '/xs:complexType/@name',
    5 'xmlns:xs="http://www.w3.org/2001/XMLSchema"
    6 xmlns:xdb="http://xmlns.oracle.com/xdb"'
    7 ),'Local Complex Type') COMPLEX_TYPE,
    8 extractvalue
    9 (
    10 value(ct),
    11 '/xs:complexType/@xdb:SQLType',
    12 'xmlns:xs="http://www.w3.org/2001/XMLSchema"
    13 xmlns:xdb="http://xmlns.oracle.com/xdb"'
    14 ) SQL_TYPE
    15 from user_xml_schemas,
    16 table
    17 (
    18 xmlsequence
    19 (
    20 extract
    21 (
    22 schema,
    23 '//xs:complexType',
    24 'xmlns:xs="http://www.w3.org/2001/XMLSchema"
    25 xmlns:xdb="http://xmlns.oracle.com/xdb"'
    26 )
    27 )
    28 ) ct
    29 /
    COMPLEX_TYPE
    SQL_TYPE
    PurchaseOrderType
    PURCHASEORDER_T
    LineItemsType
    LINEITEMS_T
    LineItemType
    LINEITEM_T
    COMPLEX_TYPE
    SQL_TYPE
    PartType
    PART_T
    ActionsType
    ACTIONS_T
    Local Complex Type
    ACTION_T
    COMPLEX_TYPE
    SQL_TYPE
    RejectionType
    REJECTION_T
    ShippingInstructionsType
    SHIPPING_INSTRUCTIONS_T
    Local Complex Type
    ROOT_T
    COMPLEX_TYPE
    SQL_TYPE
    Local Complex Type
    P222_T
    10 rows selected.
    SQL>

  • How to identify and delete objects after failure of registering XML schema

    Hi,
    I have tried to register a XML schema with many global elements but failed.
    I have checked the view DBA_XML_SCHEMA and found that there is an entry for this failed XML schema and the disk spaces would not be freed after the failure of registration as well.
    I have tried DBMS_XMLSCHEMA.deleteSchema() with DELETE_CASCADE_FORCE but failed with ORA-31000: Resource is not XDB document.
    How can I identify and delete the objects for this failed XML schema and free up the disk space ?
    I would not prefer to use 'DROP USER ... CASCADE' since there are other objects owned by this user.
    Thanks in advance.

    you can get them from user_objects.
    but you have to identify them manuallly if your schema has other objects other then created by the xml schema creation process.
    Note these objects will be cases senistitive. so you should enclose them with double quotes during deletion.

  • Exp XML Schema (.xsd) to another schema on same instance

    Hello,
    I hope someone on this forum can help me or point me in the correct direction. I want to export a schema which contains a table (EQUIPMENT) which has a XMLType column defined against a registered .xsd. I would then like to restored this schema to another schema on the same instance (development instance) and also onto another db instance.
    I have been trying to do this with the help of "Chapter 30 Importing and Exporting XMLType Tables" from the Oracle® XML DB Developer's Guide
    10g Release 2 (10.2). Unfortunately without success. At the end of this message I have encluded sample error messages that I am receiving for creation of TYPES which is causing my import to fail.
    I cannot find any examples on the web on how to achieve an exp from one schema and imp in another either on the same instance or another one.
    DDL for my table is :
    create table EQUIPMENT
    ID number(7) not null,
    STATUSID number(7) not null,
    ATTRIBUTEDATA xmltype
    xmltype column ATTRIBUTEDATA xmlschema "EQUIPMENT.xsd" element EQUIPMENT_XML
    tablespace TBS_DATA1;
    Three test runs as follows:
    1. Using an empty u2 schema and I register the .xsd file. Then I try to import (FROMUSER - TOUSER imp mode) my dump file which leads to the following error:
    IMP-00017: following statement failed with ORACLE error 2304:
    "CREATE TYPE "MTA1440_T" TIMESTAMP '2007-11-14:14:42:16' OID '3EE57B10307317"
    "74E044080020C94102' AS OBJECT ("SYS_XDBPD$" "XDB"."XDB$RAW_LIST_T",""
    "ATTRIBUTE_01" NUMBER(38),"ATTRIBUTE_02" VARCHAR2(4000 CHAR),"ATTRIBUTE_03" "
    "VARCHAR2(4000 CHAR),"ATTRIBUTE_04" NUMBER(38),"ATTRIBUTE_05" VARCHAR2(4000 "
    "CHAR))FINAL INSTANTIABLE "
    IMP-00003: ORACLE error 2304 encountered
    NOTE: Even though import failed, I now see a new TYPE created called "MTA1526_T".
    2. If I try to create the TYPE as is from the error above I get the following error:
    SQL> CREATE TYPE MTA1440_T
    2 OID '3EE57B1030731774E044080020C94102'
    3 AS OBJECT (SYS_XDBPD$ XDB.XDB$RAW_LIST_T,
    4 ATTRIBUTE_01 NUMBER(38),
    5 ATTRIBUTE_02 VARCHAR2(4000 CHAR),
    6 ATTRIBUTE_03 VARCHAR2(4000 CHAR),
    7 ATTRIBUTE_04 NUMBER(38),
    8 ATTRIBUTE_05 VARCHAR2(4000 CHAR)) FINAL INSTANTIABLE;
    9 /
    CREATE TYPE MTA1440_T
    ERROR at line 1:
    ORA-02304: invalid object identifier literal
    3. So now I create the "MTA1440_T" type without the OID value and retry the import.
    IMP-00061: Warning: Object type "U2"."MTA1440_T" already exists with a different identifier
    "CREATE TYPE "MTA1440_T" TIMESTAMP '2007-11-14:14:42:16' OID '3EE57B10307317"
    "74E044080020C94102' AS OBJECT ("SYS_XDBPD$" "XDB"."XDB$RAW_LIST_T",""
    "ATTRIBUTE_01" NUMBER(38),"ATTRIBUTE_02" VARCHAR2(4000 CHAR),"ATTRIBUTE_03" "
    "VARCHAR2(4000 CHAR),"ATTRIBUTE_04" NUMBER(38),"ATTRIBUTE_05" VARCHAR2(4000 "
    "CHAR))FINAL INSTANTIABLE "
    Questions from me:
    A. Can I export TYPES only as suggested by the online documentation ?
    B. If importing onto same instance in another schema surely the OID for the TYPE will always fail - so then why can the import not create the required TYPE name itself during the import ?
    C. Should I use global TYPES and Register the .XSD globally for all schema's in an instance to validate against .. would this prevent me from having errors on an import ?
    I would appreciate any insight any one could provide me. Many thanks in advance.
    Dom

    Hi Guys,
    Thank you all for the replies. I am dissappointed to hear that in 10g does not support exp/imp of schema's structured XML. However I am a little confused or should I say mislead by the "" documentation I
    Here is an extract from chapter "30 - Importing and Exporting XMLType Tables" from the Oracle XML DB 10g Developers Guide documentation:
    "..... Oracle Database supports the import and export 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, exporting a user with XML schema-based XMLType tables, consists of the following steps:
    1. Exporting SQL Types During XML Schema Registration. As a part of the XML
    schema registration process .....
    2. Exporting XML Schemas. After all the types are exported, XML schemas are
    exported as XML text .....
    3. Exporting XML Tables. The next step is to export the tables. Export of each table consists of two steps:
    A. The table definition is exported as a part of the CREATE TABLE statement....
    B. The data in the table is exported as XML text. Note that data for out-of-line
    tables is.....
    From this documentation I was under the impression that the exp/imp of XML Schema-Based XMLType Tables was supported.
    Regarding the backup mechanism/strategy for database schema's containing tables with Schema-Based XMLTypes what would you recommend the best online backup method to use - tablespace backups ?
    What I need to be able to do in day-to-day work is to have the ability to be able to take a copy of a customers UAT or production database schema and apply it to a dev or test db instance here for bug testing etc. Do you have any advice on best to achieve this without the use of an exp/imp when the schema will contain Schema-Based XMLType tables.
    Thank you all for your assistance so far.

  • XML schema size restrictions

    I was wondering what size restrictions there are on XML schemas? I'm developing a schema that has just raised the following error on registration.
    ERROR at line 1:
    ORA-31084: error while creating table "CAS"."swift564357_TAB" for element "swift564"
    ORA-01792: maximum number of columns in a table or view is 1000
    ORA-02310: exceeded maximum number of allowable columns in table
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 151
    ORA-06512: at line 828
    On removing a few elements from the schema it registers fine, but querying the generated table swift564xxx_TAB there is only ever one column, typed with an ADT that itself only has 5 elements. In fact there doesn't seem to be, on the face of it, any type that has more than 20-30 elements. Where does this error come from then?
    Unfortunately the schema exceeds the 20k limit on postings. I can split it up and post it in two parts if this would help.
    Thanks
    Marc

    Each attribute in the ADT and each attribute of attributes which are an ADT count as one column
    Here's a snippet from the next version of the doc that may help...
    3-20 Oracle XML DB Developer’s Guide, Rel. 1(10.1) Beta 2 Draft
    A number of issues can arise when working with large, complex XML Schemas.
    Sometimes the error "ORA-01792: maximum number of columns in a table or view
    is 1000" will be ecountered when registering an XML Schema or creating a table
    based on a global element defined by an XML Schema. This error occurs when an
    attempt is made to create an XMLType table or column based on a global element
    and the global element is defined as a complexType that contains a very large
    number of element and attribute definitions.
    The errors only occurs when creating an XMLType table or column that uses object
    relational storage. When object relational storage is selected the XMLType is
    persisted as a SQL Type. When a table or column is based on a SQL Type, each
    Registering an XML Schema with Oracle XML DB
    attribute defined by the Type counts as a column in the underlying table. If the SQL
    Type contains attributes that are based on other SQL Types, the attributes defined
    by those Types also count as columns in the underlying table. If the total number of
    attributes in all the SQL types exceeds the Oracle limits of 1000 columns in a table
    the storage table cannot be created.
    This means that as the total number of elements and attributes defined by a
    complexType approaches 1000, it is no longer possible to create a single Table that
    can manage the SQL Objects generated when an instance of the Type is stored in the
    database.
    In order to resolve this problem it is necessary to reduce the total number of
    attributes in the SQL Types that are used create the storage tables. Looking at the
    schema there are two approaches that can be used to achieve this:
    The first approach uses a ’top-down’ technique that uses multiple XMLType
    tables to manage the XML documents. This technique reduces the number of
    SQL attributes in the SQL Type heirarchy for a given storage table. As long as
    none of the tables need manage more than 1000 attributes the problem is
    resolved.
    The second approach uses a ’bottom-up’ technique that reduces the number of
    SQL attributes in the SQL Type herirarchy collapsing some of elements and
    attributes defined by the XMLSchema so that they are stored as a single CLOB.
    Both techniques rely on annotating the XML Schema to define how a particular
    complexType will stored in the database.
    In the case of the top down techniqueby the annotations SQLInline="false" and
    defaultTable are used to force some sub-elements within the XML Document to
    be stored as rows in a seperate XMLType table. Oracle XML DB maitains the
    relationship between the two tables using a REF of XMLType Good candidates
    for this approach are XML Schemas that define a choice where each element
    within the choice is defined as a complexType, or where the XML Schema
    defines an element based on a complexType that contains a very large number
    of element and attribute definitions.
    The bottom up technique involves reducing the total number of attributes in the
    SQL object types by choosing to store some of the lower level complexTypes as
    CLOBs, rather than objects. This is acieved by annotating the complexType or
    the usage of the complexType with SQLType="CLOB".
    Which technique is best depends on the application, and the kind of queries and
    updates that need to be performed against the data.

  • Error when deleting and registering an xml schema

    Why do I get an error saying that my schema 'xsd/Envelope.xsd' already exists when I try to register it and yet I cannot delete it and it does not exist in the USER_XML_SCHEMAS table?
    SQL> declare
    2 begin
    3 dbms_xmlschema.deleteSchema('xsd/Envelope.xsd', dbms_xmlschema.DELETE_CASCADE_FORCE);
    4 end;
    5 /
    declare
    ERROR at line 1:
    ORA-31000: Resource 'xsd/Envelope.xsd' is not an XDB schema document
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 100
    ORA-06512: at line 3
    SQL> declare
    2 begin
    3 DBMS_XMLSCHEMA.registerSchema('xsd/Envelope.xsd', xdbURIType('/sys/schemas/REITDIST/xsd/Envelope.xsd').getClob(), TRUE, TRUE, FALSE, FALSE);
    4 end;
    5 /
    declare
    ERROR at line 1:
    ORA-31085: schema "xsd/Envelope.xsd" already registered
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 26
    ORA-06512: at line 3
    SQL> select SCHEMA_URL, local, qual_schema_url
    2 from user_xml_schemas;
    no rows selected

    dbms_xmlSchema.registerSchema
         SCHEMAURL     => <your xsd name>,
         SCHEMADOC     => <your xsd>,
         LOCAL          => TRUE,
         GENTYPES     => TRUE,
         GENTABLES     => FALSE,
         FORCE          => TRUE,
    If parameter called "force" is set to TRUE, the schema registration will not raise errors. Instead, it creates an invalid XML schema object in case of any errors. By default, the value of this parameter is FALSE (http://download-uk.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_xmlsch.htm#i1003177)

  • Xml schema egistration

    i am new to xml . i using oracle 11g.while reading xml i came to know that xml schema registration.
    is it compulsary to work with xml data.what is the advantages of xml schema registration. with out registration also i am able to create xmltype tables and i am able to fetch data from tables. then what is the purpose of schema registration
    schema registration means what happening exactly.

    Schema Registration typically leads to better performance. With Binary XML / XML Index the differences are not critical for most applications. It also allows for better datatyping and compression, since if we tags and datatypes in advance we do do a more efficient encoding. For certain classes of applicaiton, where the object relational storage model is appropraite schema registration can lead to significantly better performance. See the XML DB basic demo for more info and the Hands on Lab for info related to Binary XML and XML Index

  • Maximum length for an XML schema

    Hi everybody,
    Is there a limit on the maximum length for an XML schema? I am trying to register an XML schema using dbms_xmlschema.registerSchema(). The schema registration process seems to go fine when the length of the schema is short. But the registration process always hangs when I increase the XML schema with additional types/elements. Is there a limit on the maximum length of the XML schema with regards to registering it to Oracle?
    Thanks!
    IK

    Hi Erhan,
    Let's say I have a really big XML schema in file "schemaA.xsd", like so:
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sampleA="http://abc.com/schemaA" targetNamespace="http://abc.com/schemaA">
    <xsd:element name="Employee">
    <xsd:sequence>
    <xsd:element name="Address" type="sampleA:AddressType"/>
    <xsd:element name="Contact" type="sampleA:ContactInfoType"/>
    </xsd:element>
    <xsd:complexType name="AddressType">......</xsd:complexType>
    <xsd:complexType name="ContactInfoType">....</xsd:complexType>
    </xsd:schema>
    I can separate this schema into multiple smaller schemas (<32KB) by using the proper imports:
    In file "sampleA.xsd":
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sampleB="http://abc.com/schemaB"
    xmlns:sampleA="http://abc.com/schemaA" targetNamespace="http://abc.com/schemaA">
    <xsd:import namespace="http://abc.com/schemaB" schemaLocation="schemaB.xsd"/>
    <xsd:element name="Employee">
    <xsd:sequence>
    <xsd:element name="Address" type="sampleB:AddressType"/>
    <xsd:element name="Contact" type="sampleB:ContactInfoType"/>
    </xsd:element>
    </xsd:schema>
    And in file "sampleB.xsd", I might have something like this:
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sampleB="http://abc.com/schemaB" targetNamespace="http://abc.com/schemaB">
    <xsd:complexType name="AddressType">......</xsd:complexType>
    <xsd:complexType name="ContactInfoType">....</xsd:complexType>
    </xsd:schema>
    So, you see how I have separated that one really big XML schema in file "schemaA.xsd" into two XML schema files: "schemaA.xsd" and "schemaB.xsd". Also, I have added <import> tags in schemaA.xsd to refer to elements, complext types, etc. defined in schemaB.xsd. So long as these schema files are < 32KB, I can register them (using dbms_xmlschema.registerSchema()) without any problems into Oracle.
    Let me know if what I said above is not too clear. Hope you find your solution soon!
    Thanks!
    Irene

Maybe you are looking for