Errors creating indexes on Binary XML Tables

Hi,
Oracle details are as follows:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
"CORE 11.2.0.2.0 Production"
TNS for IBM/AIX RISC System/6000: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
I'm currently having an issue when attempting to create a suitable index on a binary xml table. I have a Binary xml table that stores a number of xml documents. I have created an index on this table as follows:
create index TEST_WQI_idx_1 on TEST_WEB_QUOTE_INDX1(OBJECT_VALUE)
INDEXTYPE IS XDB.XMLINDEX
PARAMETERS ('PATHS (INCLUDE
(/webPolicy/QuoteId))');
Querying the table with the following:
SQL> l
1 select xmlcast(xmlquery('/webPolicy/Sections/interopSection[1]/PolicyItems/item/Version/text()' PASSING OBJECT_VALUE RETURNING CONTENT)
2 as number) "VERSION",
3 xmlcast(xmlquery('/webPolicy/QuoteId/text()' PASSING OBJECT_VALUE RETURNING CONTENT)
4 as number) "QUOTEID"
5 FROM TEST_WEB_QUOTE_INDX1
6 where xmlcast(xmlquery('/webPolicy/QuoteId/text()' PASSING OBJECT_VALUE RETURNING CONTENT)
7* as number) = 22824
SQL> /
VERSION QUOTEID
1 22824
Execution Plan
Plan hash value: 3559428808
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 545 | 1071K| 1030 (1)| 00:00:19 |
| 1 | SORT AGGREGATE | | 1 | 3022 | | |
|* 2 | TABLE ACCESS BY INDEX ROWID | SYS895336_TEST_WQI__PATH_TABLE | 1 | 3022 | 2 (0)| 00:00:01 |
|* 3 | INDEX RANGE SCAN | SYS895336_TEST_WQI__PIKEY_IX | 1 | | 1 (0)| 00:00:01 |
|* 4 | FILTER | | | | | |
| 5 | TABLE ACCESS FULL | TEST_WEB_QUOTE_INDX1 | 545 | 1071K| 4 (0)| 00:00:01 |
| 6 | SORT AGGREGATE | | 1 | 3022 | | |
|* 7 | TABLE ACCESS BY INDEX ROWID| SYS895336_TEST_WQI__PATH_TABLE | 1 | 3022 | 2 (0)| 00:00:01 |
|* 8 | INDEX RANGE SCAN | SYS895336_TEST_WQI__PIKEY_IX | 1 | | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - filter(SYS_XMLI_LOC_ISTEXT("SYS_P0"."LOCATOR","SYS_P0"."PATHID")=1)
3 - access("SYS_P0"."RID"=:B1 AND "SYS_P0"."PATHID"=HEXTORAW('5E6C') )
4 - filter(CAST( (SELECT "SYS"."STRAGG"("SYS_P2"."VALUE") FROM
"WEB_STAGING"."SYS895336_TEST_WQI__PATH_TABLE" "SYS_P2" WHERE "SYS_P2"."PATHID"=HEXTORAW('5E6C') AND
"SYS_P2"."RID"=:B1 AND SYS_XMLI_LOC_ISTEXT("SYS_P2"."LOCATOR","SYS_P2"."PATHID")=1) AS number)=22824)
7 - filter(SYS_XMLI_LOC_ISTEXT("SYS_P2"."LOCATOR","SYS_P2"."PATHID")=1)
8 - access("SYS_P2"."RID"=:B1 AND "SYS_P2"."PATHID"=HEXTORAW('5E6C') )
Note
- dynamic sampling used for this statement (level=2)
- Unoptimized XML construct detected (enable XMLOptimizationCheck for more information)
However, I also need to add an additional field to this index to allow appropriate queries against the data in the table, version number. This field can be seen from the statement above (VERSION) which runs OK and returns the data I’d expect. However, when I attempt to add this index using the following statement I get an error returned and the index becomes corrupted:
alter index TEST_WQI_idx_1 rebuild
parameters ('PATHS (INCLUDE ADD
(/webPolicy/Sections/interopSection[1]/PolicyItems/item/Version))');
After some investigation, the issue seems to revolve around the use of the [1] condition in the statement /interopSection[1]. I can create the index by removing the [1] condition, but this does not return the expected result. In actual fact, as there are 2 interopSection elements in the xml file, both with a version number of 1, the statement returns 11, which would appear to be the two version numbers concatenated together. I need to be able to reference the version number from the first interopSection in the queries against the table, and I need to be able to index this column correctly for performance issues.
I'm unsure why this xpath statement is not working correctly in the alter index statement, but returns ok when used within the query against the table and was wondering if you would be able to help me to have a working index against this element.
Thanks in advance for any help you can provide in relation to this.

Sorry, here is the error:
Error starting at line 20 in command:
alter index TEST_WQI_idx_1 rebuild
parameters ('PATHS (INCLUDE ADD
(/webPolicy/Sections/interopSection[1]/PolicyItems/item/Version))')
Error report:
SQL Error: ORA-29858: error occurred in the execution of ODCIINDEXALTER routine
ORA-64131: XMLIndex Metadata: failure during the looking up of the dictionary
ORA-30968: invalid XPATH or NAMESPACE option for XML Index
29858. 00000 - "error occurred in the execution of ODCIINDEXALTER routine"
*Cause:    Failed to successfully execute the ODCIIndexAlter routine.
*Action:   Check to see if the routine has been coded correctly.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Migrate B-Tree Indexes of XML O-R Table to XMLIndex on Binary XML Table

    We need slight help on how to migrate existing B-TREE Indexes from XML Obj-Rel Tables to XMLIndex on new XML Binary Tables
    We use searches on Nested Collection Elements (defined unbounded in XSD)
    and related DDL for XML Obj-Rel Tables is shown below:
    CREATE TABLE TNMAB_AGREEMENT_XML
    AGREEMENT_XML xmltype,
    CREATE_BY     VARCHAR2(15) NULL ,
    CREATE_DT_GMT     TIMESTAMP NULL ,
    CREATE_CLIENT_ID VARCHAR2(65) NULL ,
    UPDATE_BY     VARCHAR2(15) NULL ,
    UPDATE_DT_GMT     TIMESTAMP NULL ,
    UPDATE_CLIENT_ID VARCHAR2(65) NULL ,
    PIC_VERSION_NUM     NUMBER(20) NULL
    XMLTYPE COLUMN AGREEMENT_XML XMLSCHEMA "AB_Agreement_V1_XMLDB.xsd" ELEMENT "Agreement"
    VARRAY AGREEMENT_XML.XMLDATA."SHIPPING_PARTY_GROUPS"
    STORE AS TABLE SHIPPING_PARTY_GROUPS_NT
    (PRIMARY KEY (NESTED_TABLE_ID, ARRAY_INDEX) ENABLE)
    VARRAY SHIPPING_PARTIES
    STORE AS TABLE SHIPPING_PARTIES_NT
    (PRIMARY KEY (NESTED_TABLE_ID, ARRAY_INDEX) ENABLE)
    VARRAY AGREEMENT_XML.XMLDATA."SALES_OFFICE_CODES"."STRING_WRAPPERS"
    STORE AS TABLE SALES_OFFICE_CODES_NT
    (PRIMARY KEY (NESTED_TABLE_ID, ARRAY_INDEX) ENABLE)
    TABLESPACE TNMAB_XMLDB_ME_DATA;
    Table has PK and Unique Index which for the Binary XML Table, it will be setup on Virtual Columns (to enforce
    Unique Constraints)
    We have 6 more Normal Indexes on this Table, some created on Nested Elements as shown below:
    -- 4 Normal B-TREE Indexes on Leaf level Elements
    create index TNMAB_AGREEMENT_XML_IDX1 on TNMAB_AGREEMENT_XML (AGREEMENT_XML.XMLDATA."AGREEMENT_VERSION")
    tablespace TNMAB_XMLDB_ME_INDX;
    create index TNMAB_AGREEMENT_XML_IDX2 on TNMAB_AGREEMENT_XML (AGREEMENT_XML.XMLDATA."LAST_UPDATED_BY")
    tablespace TNMAB_XMLDB_ME_INDX;
    create index TNMAB_AGREEMENT_XML_IDX3 on TNMAB_AGREEMENT_XML (AGREEMENT_XML.XMLDATA."LAST_UPDATED")
    tablespace TNMAB_XMLDB_ME_INDX;
    create index TNMAB_AGREEMENT_XML_IDX4 on TNMAB_AGREEMENT_XML (AGREEMENT_XML.XMLDATA."CREATION_DATE")
    tablespace TNMAB_XMLDB_ME_INDX;
    --2 Indexes created on Nested Table (Collection)
    create index TNMAB_AGREEMENT_XML_NT_IDX1 on SALES_OFFICE_CODES_NT NT(NT.STR_VAL, NT.NESTED_TABLE_ID)
    tablespace TNMAB_XMLDB_ME_INDX;
    create index TNMAB_AGREEMENT_XML_NT_IDX2 on SHIPPING_PARTIES_NT NT(NT.CUSTOMER_HOLDER.SAP_ID, NT.NESTED_TABLE_ID)
    tablespace TNMAB_XMLDB_ME_INDX;
    Could you please let us know how we should migrate above Indexes to XMLIndex format.
    Specifically, not sure how the last 2 Indexes on Nested Tables is to be defined.
    Any help or resources pointing to this would be greatly appreciated.
    Thanks for the help,
    Auro

    Can't tell due to using XMLDATA pseudocolumn. Would need a sample XML document structure that can be used to define the XPATH structure and ALSO need the database version you are using (ALL digits) to see if you would need / can use STRUCTURED or UNSTRUCTURED XMLINDEX indexes.
    See the XML Index section (http://www.liberidu.com/blog/?page_id=441) on for guidance and/or of course the XMLDB Developers Guide for your database version
    http://www.liberidu.com/blog/?page_id=441
    XMLIndex (part 1) – The Concepts
    XMLIndex (Part 2) – XMLIndex Path Subsetting
    XMLIndex (Part 3) – XMLIndex Syntax Dissected
    XMLIndex Performance and Fuzzy XPath Searches
    Structured XMLIndex (Part 1) – Rules of Numb
    Structured XMLIndex (Part 2) – Howto build a structured XMLIndex
    Structured XMLIndex (Part 3) – Building Multiple XMLIndex Structures

  • Why Isn't xmlindex being used in slow query on binary xml table eval?

    I am running a slow simple query on Oracle database server 11.2.0.1 that is not using an xmlindex. Instead, a full table scan against the eval binary xml table occurs. Here is the query:
    select -- /*+ NO_XMLINDEX_REWRITE no_parallel(eval)*/
          defid from eval,
          XMLTable(XMLNAMESPACES(DEFAULT 'http://www.cigna.com/acme/domains/eval/2010/03',
          'http://www.cigna.com/acme/domains/derived/fact/2010/03' AS "ns7"),
          '$doc/eval/derivedFacts/ns7:derivedFact' passing eval.object_value as "doc" columns defid varchar2(100) path 'ns7:defId'
           ) eval_xml
    where eval_xml.defid in ('59543','55208'); The predicate is not selective at all - the returned row count is the same as the table row count (325,550 xml documents in the eval table). When different values are used bringing the row count down to ~ 33%, the xmlindex still isn't used - as would be expected in a purely relational nonXML environment.
    My question is why would'nt the xmlindex be used in a fast full scan manner versus a full table scan traversing the xml in each eval table document record?
    Would a FFS hint be applicable to an xmlindex domain-type index?
    Here is the xmlindex definition:
    CREATE INDEX "EVAL_XMLINDEX_IX" ON "EVAL" (OBJECT_VALUE)
      INDEXTYPE IS "XDB"."XMLINDEX" PARAMETERS
      ('XMLTable eval_idx_tab XMLNamespaces(DEFAULT ''http://www.cigna.com/acme/domains/eval/2010/03'',
      ''http://www.cigna.com/acme/domains/derived/fact/2010/03'' AS "ns7"),''/eval''
           COLUMNS defId VARCHAR2(100) path ''/derivedFacts/ns7:derivedFact/ns7:defId''');Here is the eval table definition:
    CREATE
      TABLE "N98991"."EVAL" OF XMLTYPE
        CONSTRAINT "EVAL_ID_PK" PRIMARY KEY ("EVAL_ID") USING INDEX PCTFREE 10
        INITRANS 4 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT
        1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1
        FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE
        DEFAULT) TABLESPACE "ACME_DATA" ENABLE
      XMLTYPE STORE AS SECUREFILE BINARY XML
        TABLESPACE "ACME_DATA" ENABLE STORAGE IN ROW CHUNK 8192 CACHE NOCOMPRESS
        KEEP_DUPLICATES STORAGE(INITIAL 106496 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS
        2147483645 PCTINCREASE 0 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
        CELL_FLASH_CACHE DEFAULT)
      ALLOW NONSCHEMA ALLOW ANYSCHEMA VIRTUAL COLUMNS
        "EVAL_DT" AS (SYS_EXTRACT_UTC(CAST(TO_TIMESTAMP_TZ(SYS_XQ_UPKXML2SQL(
        SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03"; (::)
    /eval/@eval_dt'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM') AS TIMESTAMP
    WITH
      TIME ZONE))),
        "EVAL_CAT" AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";/eval/@category'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50))),
        "ACME_MBR_ID" AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";/eval/@acmeMemberId'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50))),
        "EVAL_ID" AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/eval/2010/03";/eval/@evalId'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50)))
      PCTFREE 0 PCTUSED 80 INITRANS 4 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
        INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0
        FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
        CELL_FLASH_CACHE DEFAULT
      TABLESPACE "ACME_DATA" ; Sample cleansed xml snippet:
    <?xml version = '1.0' encoding = 'UTF-8' standalone = 'yes'?><eval createdById="xxxx" hhhhMemberId="37e6f05a-88dc-41e9-a8df-2a2ac6d822c9" category="eeeeeeee" eval_dt="2012-02-11T23:47:02.645Z" evalId="12e007f5-b7c3-4da2-b8b8-4bf066675d1a" xmlns="http://www.xxxxx.com/vvvv/domains/eval/2010/03" xmlns:ns2="http://www.cigna.com/nnnn/domains/derived/fact/2010/03" xmlns:ns3="http://www.xxxxx.com/vvvv/domains/common/2010/03">
       <derivedFacts>
          <ns2:derivedFact>
             <ns2:defId>12345</ns2:defId>
             <ns2:defUrn>urn:mmmmrunner:Medical:Definition:DerivedFact:52657:1</ns2:defUrn>
             <ns2:factSource>tttt Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:47:02.645Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>boolean</ns2:type>
                <ns2:value>true</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>52600</ns2:defId>
             <ns2:defUrn>urn:ddddrunner:Medical:Definition:DerivedFact:52600:2</ns2:defUrn>
             <ns2:factSource>cccc Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:47:02.645Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>string</ns2:type>
                <ns2:value>null</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
          <ns2:derivedFact>
             <ns2:defId>59543</ns2:defId>
             <ns2:defUrn>urn:ddddunner:Medical:Definition:DerivedFact:52599:1</ns2:defUrn>
             <ns2:factSource>dddd Member</ns2:factSource>
             <ns2:origInferred_dt>2012-02-11T23:47:02.645Z</ns2:origInferred_dt>
             <ns2:factValue>
                <ns2:type>string</ns2:type>
                <ns2:value>INT</ns2:value>
             </ns2:factValue>
          </ns2:derivedFact>
                With the repeating <ns2:derivedFact> element continuing under the <derivedFacts>The Oracle XML DB Developer's Guide 11g Release 2 isn't helping much...
    Any assitance much appreciated.
    Regards,
    Rick Blanchard

    odie 63, et. al.;
    Attached is the reworked select query, xmlindex, and 2ndary indexes. Note: though namespaces are used; we're not registering any schema defns.
    SELECT /*+ NO_USE_HASH(eval) +/ --/*+ NO_QUERY_REWRITE no_parallel(eval)*/
    eval_xml.eval_catt, df.defid FROM eval,
    --df.defid FROM eval,
    XMLTable(XMLNamespaces( DEFAULT 'http://www.cigna.com/acme/domains/eval/2010/03',
                            'http://www.cigna.com/acme/domains/derived/fact/2010/03' AS "ns7" ),
            '/eval' passing eval.object_value
             COLUMNS
               eval_catt VARCHAR2(50) path '@category',
               derivedFact XMLTYPE path '/derivedFacts/ns7:derivedFact')eval_xml,
    XMLTable(XMLNamespaces('http://www.cigna.com/acme/domains/derived/fact/2010/03' AS "ns7",
                              DEFAULT 'http://www.cigna.com/acme/domains/eval/2010/03'),
            '/ns7:derivedFact' passing eval_xml.derivedFact
             COLUMNS
               defid VARCHAR2(100) path 'ns7:defId') df
    WHERE df.defid IN ('52657','52599') AND eval_xml.eval_catt LIKE 'external';
    --where df.defid = '52657';
    SELECT /*+ NO_USE_HASH(eval +/ --/*+ NO_QUERY_REWRITE no_parallel(eval)*/
    eval_xml.eval_catt, df.defid FROM eval,
    --df.defid FROM eval,
    XMLTable(XMLNamespaces( DEFAULT 'http://www.cigna.com/acme/domains/eval/2010/03',
                            'http://www.cigna.com/acme/domains/derived/fact/2010/03' AS "ns7" ),
            '/eval' passing eval.object_value
             COLUMNS
               eval_catt VARCHAR2(50) path '@category',
               derivedFact XMLTYPE path '/derivedFacts/ns7:derivedFact')eval_xml,
    XMLTable(XMLNamespaces('http://www.cigna.com/acme/domains/derived/fact/2010/03' AS "ns7",
                              DEFAULT 'http://www.cigna.com/acme/domains/eval/2010/03'),
            '/ns7:derivedFact' passing eval_xml.derivedFact
             COLUMNS
               defid VARCHAR2(100) path 'ns7:defId') df
    WHERE df.defid IN ('52657','52599') AND eval_xml.eval_catt LIKE 'external';
    --where df.defid = '52657'; create index defid_2ndary_ix on eval_idx_tab_II (defID);
         eval_catt VARCHAR2(50) path ''@CATEGORY''');
    create index eval_catt_2ndary_ix on eval_idx_tab_I (eval_catt);The xmlindex is getting picked up but a couple of problesm:
    1. In the developemnt environment, no xml source records for defid '52657' or '52599' are being displayed - just an empty output set occurs; in spite of these values being present and stored in the source xml.
    This really has me stumped, as can query the eval table to see the actual xml defid vaues '52657' and '52599' exist. Something appears off with the query - which didn't return records even before the corrresponding xml index was created.
    2. The query still performs slowly, in spite of using the xmlindex. The execution plan shows a full table scan of eval occurring whether or not a HASH JOIN or MERGE JOIN (gets used in place of the HASH JOIN when the NO_USE_HASH(eval) int is used.
    3. Single column 2ndary indexes created respectively for eval_catt and defid are not used in the execution plan - which may be expected upon further consideration.
    In the process of running stats at this moment, to see if performance improves....
    At this point, really after why item '1.' is occurring?
    Edited by: RickBlanchardSRSCigna on Apr 16, 2012 1:33 PM

  • Error creating index

    Hi,
    I'm sure this question must have been asked before, but I can't find an answer to it.
    When I try to create a spatial index I get the following error:
    CREATE INDEX IDX_ADDR_SPT
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13203: failed to read USER_SDO_GEOM_METADATA table
    ORA-13203: failed to read USER_SDO_GEOM_METADATA table
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD", line 8
    ORA-06512: at line 1
    I used the following commands to enter data into the meta table and create the index:
    INSERT INTO USER_SDO_GEOM_METADATA
    VALUES(
    'MAPDEV.DAT_ADDRESS',
    'MAPDEV.DAT_ADDRESS.GEOPOINT',
    MDSYS.SDO_DIM_ARRAY(
    MDSYS.SDO_DIM_ELEMENT('X', 529440, 529680, 0.5),
    MDSYS.SDO_DIM_ELEMENT('Y', 181373, 181582, 0.5)
    8274 --SRID
    CREATE INDEX IDX_ADDR_SPT
    ON MAPDEV.DAT_ADDRESS(GEOPOINT)
    INDEXTYPE IS MDSYS.SPATIAL_INDEX
    PARAMETERS('SDO_LEVEL=4 LAYER_GTYPE="POINT" TABLESPACE="IDX"');
    I have no idea where I am going wrong, so any help would be greatly appreciated.
    Cheers.
    Steve

    if you are not trying to create a function-based index then change your metadata entries:
    INSERT INTO USER_SDO_GEOM_METADATA
    VALUES(
    'DAT_ADDRESS',
    'GEOPOINT',
    MDSYS.SDO_DIM_ARRAY(
    MDSYS.SDO_DIM_ELEMENT('X', 529440, 529680, 0.5),
    MDSYS.SDO_DIM_ELEMENT('Y', 181373, 181582, 0.5)),
    8274 --SRID);
    hope this helps,
    dan

  • Add a unique constraint on binary XML table

    How add a unique constraint of "brevet" field?
    The following INSERT failed
    SQL Error: ORA-19025: EXTRACTVALUE renvoie la valeur d'un seul noeud
    19025. 00000 - "EXTRACTVALUE returns value of only one node"
    If the ALTER is made after the INSERT is done, INSERT is valid but ALTER failed with the same error message!
    /* copy the file compavions.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <compagnie>
         <comp>AB</comp>
         <flotte>
              <avion immat="F-WTSS" capacite="90">
                   <typeAv>Concorde</typeAv>
              </avion>
              <avion immat="F-GFDR" capacite="145">
                   <typeAv>A320</typeAv>
              </avion>
              <avion immat="F-GTYA" capacite="150">
                   <typeAv>A320</typeAv>
              </avion>
         </flotte>
         <nomComp>Air Blagnac</nomComp>
         <pilotes>
              <pilote>
              <brevet>PL-1</brevet>
              <nom>C. Sigaudes</nom>
              </pilote>
              <pilote>
              <brevet>PL-2</brevet>
              <nom>P. Filloux</nom>
              </pilote>
         </pilotes>
    </compagnie>
    in C:\...
    --DROP DIRECTORY repxml;
    --CREATE DIRECTORY repxml AS 'C:\...';
    DROP TABLE pilote_binary_xml5;
    CREATE TABLE pilote_binary_xml5 OF XMLType
    XMLTYPE STORE AS BINARY XML
    VIRTUAL COLUMNS
    (col AS (EXTRACTVALUE(OBJECT_VALUE, '/compagnie/pilotes/pilote/brevet')));
    ALTER TABLE pilote_binary_xml5 ADD CONSTRAINT brevet_unique UNIQUE (col);
    INSERT INTO pilote_binary_xml5 VALUES (XMLType(BFILENAME ('REPXML','compavions.xml'), NLS_CHARSET_ID ('AL32UTF8')));
    --ALTER TABLE pilote_binary_xml5 ADD CONSTRAINT brevet_unique UNIQUE (col);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    You could try something like
    (extract(OBJECT_VALUE,compagnie/pilotes/pilote/brevet').getStringVal());
    but this is probably unadvisable.
    I suggest an alternative is for you to look at XMLINDEX so that you can bring the 'proper' XML functions into play like XMLTABLE etc.

  • [[11g] many XMLSCHEMA for a given binary XML table

    Hi,
    --1-----------------------------------
    I cannot create a table associated with several xmlschemas.
    create table "VALIDATE_XML_SCHEMA" of XMLTYPE
    XMLTYPE STORE AS BASICFILE BINARY XML
    XMLSCHEMAS (XMLSCHEMA "http://www.binary.com/root.xsd" ELEMENT "ROOT",
    XMLSCHEMA "http://www.different.com/root.xsd" ELEMENT "ROOT") DISALLOW NONSCHEMA;
    ==> ORA 22853
    Does this syntax is wrong?
    --2----------------------------------
    What about add and remove an existing associated xmlschma ?
    ALTER table "VALIDATE_XML_SCHEMA"
    REMOVE XMLSCHEMAS (XMLSCHEMA "http://www.different.com/root.xsd" ELEMENT "ROOT");
    ALTER table "VALIDATE_XML_SCHEMA"
    ADD XMLSCHEMAS (XMLSCHEMA "http://www.different.com/root.xsd" ELEMENT "ROOT") DISALLOW NONSCHEMA;
    ---------------------------------

    OK, so here it goes ...
    TEST1.xsd
    <?xml version = "1.0" encoding = "UTF-8"?>
    <xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
          elementFormDefault = "qualified">
      <xsd:element name = "TEST1XML">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element ref = "ID"/>
            <xsd:element ref = "Description"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name = "ID">
        <xsd:simpleType>
          <xsd:restriction base = "xsd:string">
            <xsd:length value = "4"/>
          </xsd:restriction>
        </xsd:simpleType>
      </xsd:element>
      <xsd:element name = "Description">
        <xsd:simpleType>
          <xsd:restriction base = "xsd:string">
            <xsd:maxLength value = "35"/>
          </xsd:restriction>
        </xsd:simpleType>
      </xsd:element>
    </xsd:schema>TEST2.xsd
    <?xml version = "1.0" encoding = "UTF-8"?>
    <xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
          elementFormDefault = "qualified">
      <xsd:element name = "TEST2XML">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element ref = "ID"/>
            <xsd:element ref = "AccessedOn"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name = "ID">
        <xsd:simpleType>
          <xsd:restriction base = "xsd:string">
            <xsd:length value = "4"/>
          </xsd:restriction>
        </xsd:simpleType>
      </xsd:element>
      <xsd:element name = "AccessedOn" type="xsd:dateTime" />
    </xsd:schema>and the offending script
    SET TIMING ON;
    BEGIN
       DBMS_XMLSCHEMA.REGISTERSCHEMA(
         SCHEMAURL => 'http://localhost/xsd/TEST1.xsd',
         SCHEMADOC => BFILENAME('XML_FILES_DIR','TEST1.xsd'),
         LOCAL     => TRUE,
         GENTYPES  => FALSE,
         GENBEAN   => FALSE,
         GENTABLES => FALSE,
         FORCE     => FALSE,
         CSID      => NLS_CHARSET_ID('AL32UTF8'),
         OPTIONS   => DBMS_XMLSCHEMA.REGISTER_BINARYXML);
    END;
    BEGIN
       DBMS_XMLSCHEMA.REGISTERSCHEMA(
         SCHEMAURL => 'http://localhost/xsd/TEST2.xsd',
         SCHEMADOC => BFILENAME('XML_FILES_DIR','TEST2.xsd'),
         LOCAL     => TRUE,
         GENTYPES  => FALSE,
         GENBEAN   => FALSE,
         GENTABLES => FALSE,
         FORCE     => FALSE,
         CSID      => NLS_CHARSET_ID('AL32UTF8'),
         OPTIONS   => DBMS_XMLSCHEMA.REGISTER_BINARYXML);
    END;
    CREATE TABLE XML_TEST_TBL OF XMLTYPE
       XMLTYPE STORE AS SECUREFILE BINARY XML
       XMLSCHEMAS( XMLSCHEMA "http://localhost/xsd/TEST1.xsd" ELEMENT "TEST1XML",
                   XMLSCHEMA "http://localhost/xsd/TEST2.xsd" ELEMENT "TEST2XML")
       DISALLOW NONSCHEMA;
    COMMIT;After running the script, I get
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.45
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:01.47
    CREATE TABLE XML_TEST_TBL OF XMLTYPE
       XMLTYPE STORE AS SECUREFILE BINARY XML
       XMLSCHEMAS( XMLSCHEMA "http://localhost/xsd/TEST1.xsd" ELEMENT "TEST1XML",
                   XMLSCHEMA "http://localhost/xsd/TEST2.xsd" ELEMENT "TEST2XML")
       DISALLOW NONSCHEMA
    Error at line 28
    ORA-22853: invalid LOB storage option specificationSo, I am indeed hitting the issue !
    And to complement the posts made so far, all the other errors (ALTER TABLE syntax, multiple schemas for OBJECT RELATIONAL storage) mentioned still occur in 11.1.0.7 ....
    Maybe Mark can advise on how to proceed with this. I must say though that I am not too happy creating SRs... It might give a bad impression about me AND about the product and that would be unfair on both counts.
    Best Regards
    Philip

  • [11g] adding a virtual col to a binary XML table?

    Hi
    Is it possible to add a virtual col to an existing binay XML table ?
    CREATE TABLE compagnie_binaryXML OF XMLType
    XMLTYPE STORE AS BINARY XML
    VIRTUAL COLUMNS
    (vircolcomp AS (EXTRACTVALUE(OBJECT_VALUE,'/compagnie/comp')),
    vircolnomcomp AS (EXTRACTVALUE(OBJECT_VALUE,'/compagnie/nomComp')),
    vircolnompil AS (EXTRACTVALUE(OBJECT_VALUE,'/compagnie/pilotes/pilote/nom')),
    vircolbrevpil AS (EXTRACTVALUE(OBJECT_VALUE,'/compagnie/pilotes/pilote/@brevet')));
    OK, but
    ALTER TABLE compagnie_binaryXML ADD vircolsalpil AS (EXTRACTVALUE(OBJECT_VALUE,'/compagnie/pilotes/pilote/s
    alaire'));
    ORA-22856: impossible d'ajouter des colonnes à des tables objet

    Hi
    IMHO this has nothing to do with XMLType... They simply forget to change the checks performed before adding a column... In fact, this is a "known problem" with object tables.
    SQL> create type ttt as object (n number);
      2  /
    SQL> create table t of ttt;
    SQL> alter table t add v as (to_char(n));
    alter table t add v as (to_char(n))
    ERROR at line 1:
    ORA-22856: cannot add columns to object tables
    oracle@helicon:~/ [DBA11106] oerr ora 22856
    22856, 00000, "cannot add columns to object tables"
    // *Cause:   An attempt was made to add columns to an object table. Object
    //           tables cannot be altered to add columns since its
    //           definition is based on an object type.
    // *Action:  Create a new type with additional attributes, and use the new
    //           type to create an object table. The new object table will have
    //           the desired columns.In summary, I would open an SR and let fix the problem.
    HTH
    Chris

  • Creating Index on a XML generated from Dataset

    HI mark,
    I have an XMLTYPE table that contains data of the following format
    <ROWSET>
    <ROW>
    <column1>1</column1>
    <column2>2</column2>
    </ROW>
    <ROW>
    <column1>1</column1>
    <column2>2</column2>
    </ROW>
    <ROW>
    <column1>1</column1>
    <column2>2</column2>
    </ROW>
    </ROWSET>
    the size of the XML is around 6.6 GB
    I have to index it on column 1..
    Is it possible?
    If so how should be my schema?
    and table creation procedure?
    Can I create a clustered index on column 1 (it contains unique value)
    I am using an XMLTYPE table
    thanks
    Kathir

    Thanks Marco and you caught me right..
    I am a microsoft user..
    As you said I tried creating function based index(2 to 3) but when I run a query on that table and draw explain plan it shows full table access. I didnt understand what exactly the problem is and why it didnt use the index..
    would be great if some one can help me out with this...
    I created index like this
    Create INDEX Dataplace_Index1 on Dataplace e(e.existsnode('//syougou2')
    the query goes like this(worst possible query)
    select extractvalue(value(x),'//syougou2'),extractvalue(value(x),'//company_code'),extractvalue(value(x),'//address') from company_details c, table(xmlsequence(extract(value(c),'/COMPANY_DETAILS/COMPANY'))) x where
    rownum < 250
    and
    (extractvalue(value(x),'//gyousyu_code') LIKE '%1%' OR extractvalue(value(x),'//gyousyu_code') LIKE '%2%' OR extractvalue( value(x),'//gyousyu_code') LIKE '%3%')
    and
    extractvalue(value(x),'//city_code') IN ('3501','3502','3503')
    and
    extractvalue(value(x),'//g_rieki5') NOT IN ('1')
    and
    extractvalue(value(x),'//jugyoin') > 1
    and
    extractvalue(value(x),'//g_uriage5') > 1
    and
    extractvalue(value(x),'//sihon') > 2
    and
    extractvalue(value(x),'//company_code') > '01-003541-9'
    order by extractvalue(value(x),'//company_code') , extractvalue(value(x),'//g_rieki5')
    and yet times a join..
    My question is will functional index be helpful..
    and if so is something wrong with the way I created a Fucntional Index..
    why does the explain plan give Full table access
    thanks
    kathir

  • Creating index for standard SAP tables

    Hi!
    What are the advantages and disadvantages of creating addtional indexes for tables with massive amount of data (BSEG, BKPF, COEP, etc...).
    If I create a new index it supposed to make the table access faster, for the cost of hard disk space.
    Am I right?
    Thank you
    Tamá

    Hi,
    Primary and secondary indexes
    Index: Technical key of a database table.
    Primary index: The primary index contains the key fields of the table and a pointer to the non-key fields of the table. The primary index is created automatically when the table is created in the database.
    Secondary index: Additional indexes could be created considering the most frequently accessed dimensions of the table.
    Structure of an Index
    An index can be used to speed up the selection of data records from a table.
    An index can be considered to be a copy of a database table reduced to certain fields. The data is stored in sorted form in this copy. This sorting permits fast access to the records of the table (for example using a binary search). Not all of the fields of the table are contained in the index. The index also contains a pointer from the index entry to the corresponding table entry to permit all the field contents to be read.
    When creating indexes, please note that:
    An index can only be used up to the last specified field in the selection! The fields which are specified in the WHERE clause for a large number of selections should be in the first position.
    Only those fields whose values significantly restrict the amount of data are meaningful in an index.
    When you change a data record of a table, you must adjust the index sorting. Tables whose contents are frequently changed therefore should not have too many indexes.
    Make sure that the indexes on a table are as disjunctive as possible.
    (That is they should contain as few fields in common as possible. If two indexes on a table have a large number of common fields, this could make it more difficult for the optimizer to choose the most selective index.)
    Accessing tables using Indexes
    The database optimizer decides which index on the table should be used by the database to access data records.
    You must distinguish between the primary index and secondary indexes of a table. The primary index contains the key fields of the table. The primary index is automatically created in the database when the table is activated. If a large table is frequently accessed such that it is not possible to apply primary index sorting, you should create secondary indexes for the table.
    The indexes on a table have a three-character index ID. '0' is reserved for the primary index. Customers can create their own indexes on SAP tables; their IDs must begin with Y or Z.
    If the index fields have key function, i.e. they already uniquely identify each record of the table, an index can be called a unique index. This ensures that there are no duplicate index fields in the database.
    When you define a secondary index in the ABAP Dictionary, you can specify whether it should be created on the database when it is activated. Some indexes only result in a gain in performance for certain database systems. You can therefore specify a list of database systems when you define an index. The index is then only created on the specified database systems when activated
    Thanks and Regards
    Arun Joseph

  • BUG ? Create index on a partitioned table drops the complete table !

    Hi ...
    now i had twice the problem when i tried to create a local index (with 2 fields) on a partitioned table .
    I set initrans to 1 and maxtrans to 255 (i know - initrans has to be at least 2).
    I got an error - and the table (including the data) was gone ... :-((
    Has anybody the same behavior and is it a bug ??
    Christian

    See 1.5 Bad bug when creating index fails.
    Have fun,
    K.

  • Problem creating index on global temporary table

    Running Oracle DB Oracle9i Release 9.2.0.7.0.
    I'm trying to create 3 indexes on a temporary table, the first index creates fine but the other remaining 2 result in the following error:
    ERROR at line 1: ORA-00600: internal error code, arguments: [kftts2bz_many_files], [0], [20], [], [], [], [], []
    Have tried searching with not much success, any pointers, tips, hints would be appreciated, below is the table and the indexes:-
    create global temporary TABLE contacts (
    ID VARCHAR2(20) NOT NULL,
    DOB VARCHAR2(8),
    HH_LASTNAME VARCHAR2(90),
    PERSON VARCHAR2(10) NOT NULL,
    CONT_JOB VARCHAR2(90) NOT NULL,
    SOURCE VARCHAR2(8) NOT NULL,
    ADS VARCHAR2(8) NOT NULL,
    CONT VARCHAR2(8) NOT NULL,
    SRCPERSONID VARCHAR2(15),
    FIRSTNAME VARCHAR2(90),
    MIDDLENAME VARCHAR2(90),
    LASTNAME VARCHAR2(90),
    FULLNAME VARCHAR2(90),
    TITLE VARCHAR2(50),
    SALUTATION VARCHAR2(90),
    ) on commit delete rows;
    create index i_contact_1 on contacts(dob, soundex(hh_lastname ));
    create index i_contact_pk on contacts(id, person, cont_job, source, ads, cont);
    create index i_contact_2 on contacts(srcpersonid, source);

    Bug 3238525 - Upgrade from 9.0 can leave corruptdata for global temporary table indices
    ORA-600 [kftts2bz_many_files]
         Doc ID:      285592.1

  • Create Index on another schema table stored in my table

    Hi,
    I want to create index on a table column which is in another schema from my schema and the index to be stored in my schema.
    ex: current user 'hr'
    sql>create index idx1 on scott.emp(eno);
    Does the above query works??
    thanks,
    Sri

    Why cant you give a try?
    Are you getting any error message?
    See below..
    SQL> show user
    USER is "SCOTT"
    SQL> grant select on emp to hr;
    Grant succeeded.
    SQL> conn
    Enter user-name: hr@***
    Enter password:
    Connected.
    SQL> show user
    USER is "HR"
    SQL> create index ndx on scott.emp(sal);
    create index ndx on scott.emp(sal)
    ERROR at line 1:
    ORA-01031: insufficient privileges
    SQL> conn
    Enter user-name: system@*******
    Enter password:
    Connected.
    SQL> create index ndx on scott.emp(sal);
    Index created.
    SQL> drop index ndx;
    Index dropped.
    SQL> grant create any index to hr;
    Grant succeeded.
    SQL> conn
    Enter user-name: hr@*******
    Enter password:
    Connected.
    SQL> create index ndx on scott.emp(sal);
    Index created.Edited by: jeneesh on Oct 8, 2012 3:53 PM

  • Error create index

    Hi
    I trying to create my spatial index:
    INSERT INTO USER_SDO_GEOM_METADATA
    VALUES (
    'DGDTW_TOPOGRAFIE',
    'GEOMETRIE',
    mdsys.SDO_dim_array(
    MDSYS.SDO_DIM_ELEMENT('X',200000,215600,.0005),
    MDSYS.SDO_DIM_ELEMENT('Y',844800,862000,.0005),
    MDSYS.SDO_DIM_ELEMENT('Z',-10000,10000,0.0005)),NULL);
    create index DGDTW_TopoIndex on DGDTW_Topografie(Geometrie) indextype is mdsys.spatial_index;
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13249: internal error in Spatial index: [mdidxrbd]
    ORA-13249: Error in Spatial index: index build failed
    ORA-13236: błąd wewnętrzny podczas przetwarzania drzewa R: [failed to cluster in memory]
    ORA-13249: Internal error in Spatial index: [mdrcrclmem]
    ORA-13232 failed to allocate memory during R-tree creation
    ORA-13236:internal error in R-tree processing:[failed to allocate memory]
    ORA-06512: a "MDSYS.SDO_INDEX_METHOD_9I", line 368
    ORA-06512: a line 1
    I do not understand why I am getting the error.
    Thank you!

    What version of Oracle are you using? Please include the patch level. This rings a bell as a bug that was fixed a long time ago.

  • Creating index on large partitioned table

    Is anyone aware of a method for telling how far along is the creation of an index on a large partitioned table? The statement I am executing is like this:
    CREATE INDEX "owner"."new_index"
    ON "owner"."mytable"(col_1, col_2, col_3, col_4)
    PARALLEL 8 NOLOGGING ONLINE LOCAL;
    This is a two-node RAC system on Windows 2003 x64, using ASM. There are more than 500,000,000 rows in the table, and I'd estimate that each row is about 600-1000 bytes in size.
    Thank you.

    you can know the progress from v$session_longops.
    select
    substr(SID ||','||SERIAL# ,1,8) "sid,srl#",
    substr(OPNAME ||'>'||TARGET,1,50) op_target,
    substr(trunc(SOFAR/TOTALWORK*100)||'%',1,5) progress,
    TIME_REMAINING rem,
    ELAPSED_SECONDS elapsed
    from v$session_longops
    where SOFAR!=TOTALWORK
    order by sid;
    hth

  • Error creating index (trailing null missing from STR bind value)

    I'm having the following error:
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-20000: interMedia Text error:
    DRG-50857: oracle error in dreii0fsh
    ORA-01480: trailing null missing from STR bind value
    ORA-06512: at "CTXSYS.DRUE", line 157
    ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 176
    ORA-06512: at line 1
    my script is:
    create index IDX_XML on EN_TESTE_XML(TXT_XML_CURRICULO)
    indextype is ctxsys.context;
    My Oracle is 9.0.1
    TXT_XML_CURRICULO -> XMLTYPE then
    the section group is PATH_SECTION_GROUP by default.
    thanks.
    Marlon

    If you get an OCI error when simply updating a record in PL/SQL Developer, it sounds like a PL/SQL Developer issue, although not one I've come across. You might try Allround Automations tech support. They'll need your exact versions of Oracle server, Oracle client and PL/SQL Developer.
    SQL*Plus is part of the Oracle Client software so you should have it somewhere, or you can download it free.

Maybe you are looking for