Importing error: related to function-based indexes?

I've come across a strange error. I've got a user that has an export dump file who wants me to import the data into a new database. (Its an Oracle 10G database.)
When I use the 'imp' command, the table import completes successfully, but I end up receiving the following warnings:
IMP-00003: oracle error 942 encountered
ORA-00942: table or view does not exist
IMP-00017: following statement failed with ORACLE error 942
"CREATE INDEX "X" on "Y" (TO_CHAR("Z",'yyyymmdd')) P"
"CTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 3145728 FREELISTS 1 FREEL"
"IST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "TBSPC" LOGGING"
The table itself seems to have been imported correctly; and all data rows exist. Its just the index that isn't being imported/rebuilt. (Other indexes on the same table were imported properly.)
The only thing that I could find that seems odd is that this index uses functions (the "TO_CHAR" in the index above). All of the other indexes on the table refer to basic fields. And I can rebuild the index manually.
Is the 'imp' command able to handle function-based indexes? Is there some parameter than I need to set to allow it to import these indexes?
(I know the more efficient thing to do would be to do an import with no indexes and rebuild them later...)
Edited by: user588235 on Dec 9, 2009 5:16 PM

Function based indexes should be supported. If it is exported, then it should be able to be imported. This just seems like a weird case. Have you tried to create a different table and then create a function based index on that table then see if exp/imp work?Yes, I have tried creating new versions of the tables (both with and without function-based indexes).
During my tests, I found that I can recreate the problem if I create the table in Oracle 9 and import it into Oracle 10; the problem doesn't occur when importing/exporting between Oracle9->Oracle9 or Oracle10->Oracle10. (However, the user told me that this was an export from Oracle 10.)
One other thing: I've noticed that if, instead of importing into a user account, I import into the system account, it works with no problems. For example:
imp userid='sys/xyz as sysdba' file=mydata.dmp fromuser=use1 touser=use2 ->Results in warnings while reading indexes
imp userid='sys/xyz as sysdba' file=mydata.dmp fromuser=use1 touser=sys ->works with no warning
This makes me suspect that its a problem with the permissions that have been granted. (I've granted 'create any index' and 'query rewrite' to the user account however.)
Not to change the issue, but since this is 10g, have you tried using datapump to expdp/impdp the same information?Might be an option; problem is, I'm dealing with a legacy system that was set up to use 'imp/exp', so altering backup and restore methods will require a lot of work.

Similar Messages

  • How to define error message for function based index violation?

    Hi,
    I am generating Forms 6i from Designer 6i. I have a function based index to enforce case insensitive name uniqueness. With check constraints I can specify constraint violation error messages that will be displayed in Forms at runtime if needed. How can I do this with function based index constraints?
    Regards,
    Tamas

    OK, problem sorted.
    You need to create a check constraint with the same name as the new index, but don't enable it.

  • Dilemma regarding function based indexes

    Hello,
    I have a dilemma regarding function based indexes.
    I have read Note:66277.1 on the Metalink discussing thoroughly the subject of “Concepts and Usage of Function Based Indexes”.
    This doc was revised on 30-May-2006 so I was sure it referred to 9i and 10g.
    This doc as well as other docs on the web claim that in order to use FBI (function based indexes) one must set the following parameters (can be done also at session level)
    QUERY_REWRITE_ENABLED = TRUE
    QUERY_REWRITE_INTEGRITY = TRUSTED
    Also the schema that is owner of the FBI should be granted with QUERY REWRITE sys priv and statistics should be collected since FBI is usable only by CBO (cost based optimizer).
    I have tested it and it works, my problem was that it worked
    (1)     Without granting the QUERY REWRITE to the owning schema.
    (2)     QUERY_REWRITE_ENABLED was set to false.
    (3)     QUERY_REWRITE_INTEGRITY was set to enforced.
    I have conducted my tests on 9.2.0.6 and found no evidence in the docs (10g) saying the above is required or not.
    I found at http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:1197786003246 the following:
    “Oracle9iR2 relaxed this so that the FBI on the builtin function may be used.”
    so I have tested it with my own function:
    create or replace function upper2( p_str in varchar2 ) return
    varchar2 DETERMINISTIC
    as
    begin
    return upper(p_str);
    end;
    =>
    Also (yes you guessed right), without any privilege granted nor parameter setting the optimizer picked my FBI.
    Can anyone refer me to a place documenting this behavior as a correct one?
    Other comments?
    Regards,
    Tal Olier ([email protected])

    Got an answer from Oracle support:
    19-DEC-06 18:04:31 GMT
    (Update for record id(s): 101017780,101017796)
    QUESTION
    ========
    Questions about the options required in 10g related to Function Based Indexes, and the correct
    behaviors associated with them.
    ANSWER
    ======
    For 10g:
    These requirements are no longer true in 10g. This has already clarified by
    development in the Bug 3999326 which is available on metalink.
    For 9I:
    For the creation of a function-based index in your own schema, you must be
    granted the QUERY REWRITE system privileges. To create the index in another
    schema or on another schema's tables, you must have the CREATE ANY INDEX
    and GLOBAL QUERY REWRITE privileges.
    You must have the following initialization parameters defined to create a
    function-based index:
    QUERY_REWRITE_INTEGRITY set to TRUSTED
    QUERY_REWRITE_ENABLED set to TRUE
    COMPATIBLE set to 8.1.0.0.0 or a greater value
    Additionally, to use a function-based index:
    The table must be analyzed after the index is created.
    The query must be guaranteed not to need any NULL values from the indexed
    expression, since NULL values are not stored in indexes.
    However, in 9.2.0.4 patchset, these prerequisites do not apply and one can
    create function-based indexes without any of the above to be true. This is not
    the case in 9.2.0.3, not in 8.1.7.
    Reference: Oracle 9i R2 Administrators Guide
    So as mentioned above that is why you didnt have any errors
    Please back to us if any further information is need, and we will be pleased to
    assist you further.
    Thank You,
    Best Regards,
    Mina Anes

  • Function-based index error due to fine-grained security

    Hi, i'm working on Oracle version 9.2.0.5.
    I'm trying to create a function-based index but i'm getting an error due to fine-grained security. I checked resource_view but if i'm not wrong I should have all necessary roles. I also added xdbadmin to this user to be sure.
    I tried also to alter my session but it didn't worked.
    Connected to Oracle9i Enterprise Edition Release 9.2.0.5.0
    Connected as test_ste
    SQL>
    SQL> create index fbidx_schede_xml
      2  on schede_progetti_xml p
      3  (p.PROGETTO.extract('/Project/Elenco_unita/Unita/Responsabile/Cognome/text()').getStringVal());
    create index fbidx_schede_xml
    on schede_progetti_xml p
    (p.PROGETTO.extract('/Project/Elenco_unita/Unita/Responsabile/Cognome/text()').getStringVal())
    ORA-28133: full table access is restricted by fine-grained security
    ORA-06512: at "SYS.XMLTYPE", line 0
    ORA-06512: at line 1
    SQL>
    SQL> alter session set query_rewrite_enabled = true;
    Session altered
    SQL> alter session set query_rewrite_integrity = trusted;
    Session altered
    SQL> create index fbidx_schede_xml
      2  on schede_progetti_xml p
      3  (p.PROGETTO.extract('/Project/Elenco_unita/Unita/Responsabile/Cognome/text()').getStringVal());
    create index fbidx_schede_xml
    on schede_progetti_xml p
    (p.PROGETTO.extract('/Project/Elenco_unita/Unita/Responsabile/Cognome/text()').getStringVal())
    ORA-28133: full table access is restricted by fine-grained security
    ORA-06512: at "SYS.XMLTYPE", line 0
    ORA-06512: at line 1
    SQL> select * from user_role_privs;
    USERNAME                       GRANTED_ROLE                   ADMIN_OPTION DEFAULT_ROLE OS_GRANTED
    TEST_STE                      CONNECT                        NO           YES          NO
    TEST_STE                      CTXAPP                         NO           YES          NO
    TEST_STE                      RESOURCE                       NO           YES          NO
    TEST_STE                      XDBADMIN                       NO           YES          NO
    SQL> This are ACL on my schema:
      <ACL>
        <acl description="Private:All privileges to OWNER only and not accessible to others" xmlns="http://xmlns.oracle.com/xdb/acl.xsd" xmlns:dav="DAV:"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd                           http://xmlns.oracle.com/xdb/acl.xsd">
          <ace>
            <principal>dav:owner</principal>
            <grant>true</grant>
            <privilege>
              <all/>
            </privilege>
          </ace>
        </acl>
      </ACL>I tried to create a similar function-based index on Oracle 10.2.0.3 without any problem and without touching any ACL, is an Oracle 9.2.0.5 problem?
    Thanks for your attention.

    I didn't really (production wise)work yet with VPD. I know a lot is based on DBMS_RLS and I guess (IF it is VPD related) it should be to hard to find in the doc's how you could check what is beyond your privileges. As a DBA I noticed that even the dba account SYSTEM isn't always allow to export the full content for the tables anymore.
    There is a privilege that grants you all access that you need, despite the fact that you are not allowed to read certain rows from a table. Look it up.
    In all, as I said, it looks like account is not allowed to see all data from a table. In that respect it sounds logical that you also are, in that case, not allowed to build a function based index on that data

  • Segment Shrinking script erroring out due to Function based indexes, lobs,.

    DB version:10gR2
    Following is a script i made for freeing up(SHRINK ing and resetting HWM) the space in Tables and its indexes. Due to the existence of LOB Segments and Tables with Function based indexes, this script was erroring out. So i was wondering if there is a way to find out the segments which are eligible/not eligible for Shrinking so that i could make necessary changes to the below script.
    create or replace procedure freeup_space
    is
    type v_segment_type is table of varchar2(30) index by binary_integer;
    v_segment v_segment_type;
    begin
    select segment_name bulk collect into v_segment
                   from user_segments
                   where segment_type in ('TABLE')
                     and segment_name not like 'BIN%';
    for i in v_segment.first..v_segment.last loop
    execute immediate 'alter table ' || v_segment(i) ||' enable row movement';
    dbms_output.put_line('Table '||v_segment(i)||'''s row movement enabled');
    execute immediate 'alter table ' || v_segment(i) ||' shrink space cascade';
    execute immediate 'alter table ' || v_segment(i) ||' deallocate unused';
    end loop;
    end;
    /

    You can use USER_LOBS views to look for LOB columns in the segments and ALL_INDEXES.INDEX_TYPE tells if the index is function based index or not.
    Message was edited by:
    Pierre Forstmann

  • Function Based Indexes Errors

    Hi
    I am trying to create function based indexes based on the examples in the b10826 Spatial Users guide --
    The Create index statement is failing because it says it cannot read the metadata
    create index EMITTER_LOB_WIDX ON EMITTER (OWNER1.WT_GEOMETRY_PACKAGE.LINEOFBEARING(EQUIP_X, EQUIP_Y, LOB_BEARING, LOB_RANGE)) INDEXTYPE IS MDSYS.SPATIAL_INDEX LOCAL;
    create index EMITTER_LOB_WIDX ON EMITTER (EMITTER.WT_GEOMETRY_PACKAGE.LINEOFBEARING(EQUIP_X, EQUIP_Y, LOB_BEARING, LOB_RANGE)) INDEXTYPE IS MDSYS.SPATIAL_INDEX LOCAL
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13203: failed to read USER_SDO_GEOM_METADATA view
    ORA-13203: failed to read USER_SDO_GEOM_METADATA view
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 10
    Here is the USER_SDO_GEOM_METADATA ENTRY:
    TABLE_NAME
    COLUMN_NAME
    DIMINFO(SDO_DIMNAME, SDO_LB, SDO_UB, SDO_TOLERANCE)
    SRID
    EMITTER
    OWNER1.WT_GEOMETRY_PACKAGE.LINEOFBEARING(EQUIP_X, EQUIP_Y, LOB_BEARING,
    LOB_RANGE)
    SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', -180, 180, .00005), SDO_DIM_ELEMENT('Y', -90,
    90, .000005))
    TABLE_NAME
    COLUMN_NAME
    DIMINFO(SDO_DIMNAME, SDO_LB, SDO_UB, SDO_TOLERANCE)
    SRID
    8307
    The package is owned by OWNER1 - the Table is in OWNER2's schema - not that that matters - what are the known issues with Function Based Indexes
    Am I missing something Obvious?

    I think its a bug
    I moved the function to the local schema - I also pulled it out of the package -
    So I look in USER_SDO_GEOM_METADATA no records for select * from USER_SDO_GEOM_METADATA
    Not being satisfied with that I look in ALL_SDO_GEOM_METADATA
    SELECT * FROM ALL_SDO_GEOM_METADATA WHERE OWNER = 'OWNER2';
    no rows selected
    So I should be good for insert
    INSERT INTO USER_SDO_GEOM_METADATA VALUES ('EMITTER','OWNER2.EQUIPMENTPOINT(EQUIP_X, EQUIP_Y)', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,0.005),MDSYS.SDO_DIM_ELEMENT('Y',-90,90,0.005)), 8307);
    INSERT INTO USER_SDO_GEOM_METADATA VALUES ('EMITTER','LOCUST2.EQUIPMENTPOINT(EQUIP_X, EQUIP_Y)', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,0.005),MDSYS.SDO_DIM_ELEMENT('Y',-90,90,0.005)), 8307)
    ERROR at line 1:
    ORA-13223: duplicate entry for EMITTER.OWNER2.EQUIPMENTPOINT(EQUIP_X, EQUIP_Y)
    in SDO_GEOM_METADATA
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 17
    ORA-06512: at "MDSYS.SDO_GEOM_TRIG_INS1", line 21
    ORA-04088: error during execution of trigger 'MDSYS.SDO_GEOM_TRIG_INS1'
    If I insert to all_sdo_geom_metadata it takes but the index create fails b/c it cannot read user_sdo_geom_metadata
    INSERT INTO ALL_SDO_GEOM_METADATA VALUES (OWNER2','EMITTER','OWNER2.EQUIPMENTPOINT(EQUIP_X, EQUIP_Y)', MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,0.005),MDSYS.SDO_DIM_ELEMENT('Y',-90,90,0.005)), 8307);
    1 row created.
    SQL> CREATE INDEX EMITTER_EQUIP_WIDX ON EMITTER(OWNER2.EQUIPMENTPOINT(EQUIP_X, EQUIP_Y)) INDEXTYPE IS MDSYS.SPATIAL_INDEX PARAMETERS ('layer_gtype=point tablespace=EMITTER_IDX_TBS');
    CREATE INDEX EMITTER_EQUIP_WIDX ON EMITTER(OWNER2.EQUIPMENTPOINT(EQUIP_X, EQUIP_Y)) INDEXTYPE IS MDSYS.SPATIAL_INDEX PARAMETERS ('layer_gtype=point tablespace=EMITTER_IDX_TBS')
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13203: failed to read USER_SDO_GEOM_METADATA view
    ORA-13203: failed to read USER_SDO_GEOM_METADATA view
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 10
    select table_name, column_name from user_sdo_geom_metadata;
    TABLE_NAME
    COLUMN_NAME
    EMITTER
    OWNER2.EQUIPMENTPOINT(EQUIP_X, EQUIP_Y)
    Arghhh!!!
    Anyone else encounter a similar problem?
    I know that I have to be careful regarding owner.packager.function naming convention
    I have followed the oracle examples from here
    http://www.oracle.com/technology/obe/obe10gdb/content/spatial/files/add_metadata_fi.sql
    are they broken? Is this a bug ?

  • Error creating function based index

    i keep getting ORA-13203 errors when creating a function-based index. The function is owned by another schema but the the user creating the function has execute privileges
    [email protected]> create index mpp_nc_sidx on MPP_NONCOMPLETE(GIS.DD832UTM(LON*-1,LAT))
    2 indextype is mdsys.spatial_index
    3 parameters('tablespace=sde4_idx sdo_indx_dims=2');
    create index mpp_nc_sidx on MPP_NONCOMPLETE(GIS.DD832UTM(LON*-1,LAT))
    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_9I", line 7
    ORA-06512: at line 1
    [email protected]> select table_name,column_name from user_sdo_geom_metadata;
    TABLE_NAME COLUMN_NAME
    MPP_NONCOMPLETE GIS.DD832UTM(LON*-1,LAT)
    [email protected]> select GIS.DD832UTM(LON*-1,LAT) from mpp_noncomplete where rownum < 3;
    GIS.DD832UTM(LON*-1,LAT)(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
    SDO_GEOMETRY(2001, 82212, SDO_POINT_TYPE(864941.804, 3916953.95, NULL), NULL, NULL)
    SDO_GEOMETRY(2001, 82212, SDO_POINT_TYPE(568560.541, 4181497.56, NULL), NULL, NULL)
    [email protected]> select text from all_source where name = 'DD832UTM';
    TEXT
    FUNCTION dd832utm(x number, y number)
    RETURN mdsys.sdo_geometry DETERMINISTIC
    IS
    geom mdsys.sdo_geometry;
    BEGIN
    geom := sdo_cs.transform
    (mdsys.sdo_geometry (2001,8265,mdsys.sdo_point_type
    (x,y, null),null,null),82212);
    return geom;
    END;
    any help appreciated
    --kassim

    Hi, try to use a view:
    create or replace view v_dd832utm as
    select
    mdsys.sdo_geometry(2001,8265,
    mdsys.sdo_point_type((LON*-1),LAT, null),null,null),
    82212)as GEOMETRY
    from
    mpp_noncomplete;
    provide metadata for that view (column: GEOMETRY) and create a spatial index. your way is more sophisticated ;o)
    regards, Andreas

  • Impdp not importing function based index correctly.

    We noticed that a process running in our develop database was running much faster than in the production database. After investigating we found that on the development database the process was using an index on the main large table and on the production database the index was ignored and full table scans of the large table were being used.
    The data in the tables was the same, statistics were up-to-date, etc. Looking closer we saw that the index on the production database was function based because it had the DESC keyword on one column in the index. On the development database all columns of the index were ASC and thus it was a "normal" index. This was very confusing since we had just refreshed the development database from production using expdp/impdp. I ran impdp with the sqlfiles option to capture the DDL from the export file for the index in question from the production database:
    CREATE UNIQUE INDEX "SYSADM"."PS_SF_1098_ITEM" ON "SYSADM"."PS_SF_1098_ITEM" ("EMPLID", "SF_TIN", "CALENDAR_YEAR", "SEQ_NO" DESC, "DTL_SEQ_NBR")
    PCTFREE 10 INITRANS 2 MAXTRANS 255
    STORAGE(INITIAL 40960 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "PSINDEX" ;
    I then dropped the table/index in the development database and reimported just this one table. Sure enough, the index wasn't created as a function based index (no DESC keyword on SEQ_NO column):
    CREATE UNIQUE INDEX "SYSADM"."PS_SF_1098_ITEM" ON "SYSADM"."PS_SF_1098_ITEM" ("EMPLID", "SF_TIN", "CALENDAR_YEAR", "SEQ_NO", "DTL_SEQ_NBR")
    PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 40960 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "PSINDEX" ;
    I've researched this extensively and can't find any information on why this is happening. Any ideas before I open a SR?
    BTW.... version is 11.1.0.7 patchset 31 on Windows Server 2003. Both dev and prod environments are identical.
    Thanks,
    Dan

    Working on something else I noticed the following two "hidden" init.ora parameters in both my dev and production databases:
    *._disable_function_based_index=TRUE
    *._ignore_desc_in_index=TRUE
    The first parameter explains why the index (function based) was being ignored in my production database. The second explains why the index is created without the DESC keyword in my dev database from an export from my prod database. I guess you do learn something new every day :)
    These databases are used by Peoplesoft applications and I found several posts saying that function based indexes created by Peoplesoft were causing performance and/or data validity problems and users were instructed to set the above parameters so the FIB's weren't used. So, everything is working as expected/designed. I will contact Peoplesoft Tech Support to see if users are still encouraged to set the above parameters.
    Dan

  • Function based indexes on object tables

    Hi,
    I am trying to create a function based index on an object table. I am getting the following error:
    SQL> create index cell1_indx on cell1(create_cell1(id)) indextype is mdsys.spatial_index;
    create index cell1_indx on cell1(create_cell1(id)) 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-13249: Stmt-Execute Failure: SELECT num_rows from all_tables where owner='ASHE' and table_name=
    'CELL1'
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_9I", line 7
    ORA-06512: at line 1
    Here cell1 is an object table.
    Is the procedure for creating function based indexes on object tables different from relational tables?
    Chinni

    One of the many new features in Oracle 8i is the Function-Based Index (we will refrain from using FBI, but only just). This allows the DBA to create indexes on functions or expressions; these functions can be user generated pl/sql functions, standard SQL functions (non-aggregate only) or even a C callout.
    A classic problem the DBA faces in SQL Tuning is how to tune those queries that use function calls in the where clause, and result in indexes created on these columns not to be used.
    Example
    Standard B-Tree index on SURNAME with cost based optimizer
    create index non_fbi on sale_contacts (surname);
    analyze index non_fbi compute statistics;
    analyze table sale_contacts compute statistics;
    SELECT count(*) FROM sale_contacts
    WHERE UPPER(surname) = 'ELLISON';
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=3 Card=1 Bytes=17)
    1 0 SORT (AGGREGATE)
    2 1 TABLE ACCESS (FULL) OF 'SALES_CONTACTS' (Cost=3 Card=16 Bytes=272)
    Now we use a function based index
    create index fbi on sale_contacts (UPPER(surname));
    analyze index fbi compute statistics;
    analyze table sale_contacts compute statistics;
    SELECT count(*) FROM sale_contacts WHERE UPPER(surname) = 'ELLISON';
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=17)
    1 0 SORT (AGGREGATE)
    2 1 INDEX (RANGE SCAN) OF 'FBI' (NON-UNIQUE) (Cost=2 Card=381 Bytes=6477)
    The function-based index has forced the optimizer to use index range scans (retuning zero or more rowids) on the surname column rather than doing a full table scan (non-index lookup). Optimal performance does vary depending on table size, uniqueness and selectivity of columns, use of fast full table scans etc. Therefore try both methods to gain optimal performance in your database.
    It is important to remember that the function-based B*Tree index does not store the expression results in the index but uses an "expression tree". The optimizer performs expression matching by parsing the expression used in the SQL statement and comparing the results against the expression-tree values in the function-based index. This comparison IS case sensitive (ignores spaces) and therefore your function-based index expressions should match expressions used in the SQL statement where clauses.
    Init.ora Parameters
    The following parameter must be set in your parameter file: QUERY_REWRITE_INTEGRITY = TRUSTED
    QUERY_REWRITE_ENABLED = TRUE
    COMPATIBLE = 8.1.0.0.0 (or higher)
    Grants
    Grants To create function-based indexes the user must be granted CREATE INDEX and QUERY REWRITE, or alternatively be granted CREATE ANY INDEX and GLOBAL QUERY REWRITE. The index owner must have EXECUTE access on the function used for the index. If execute access is revoked then the function-based index will be "disabled" (see dba_indexes).
    Disabled Indexes
    If your function-based index has a status of "disabled" the DBA can do one of the following:
    a) drop and create the index (take note of its current settings)
    b) alter index enable, function-based indexes only, also use disable keyword as required
    c) alter index unusable.
    Queries on a DISABLED index fail if the optimizer chooses to use the index.Here is an example ORA error:
    ERROR at line 1: ORA-30554: function-based index MYUSER.FBI is disabled.
    All DML operations on a DISABLED index also fail unless the index is also marked UNUSABLE and the initialization parameter SKIP_UNUSABLE_INDEXES is set to true.
    Some more Examples
    CREATE INDEX expression_ndx
    ON mytable ((mycola + mycolc) * mycolb);
    SELECT mycolc FROM mytable
    WHERE (mycola + mycolc) * mycolb <= 256;
    ..or a composite index..
    CREATE INDEX example_ndx
    ON myexample (mycola, UPPER(mycolb), mycolc);
    SELECT mycolc FROM myexample
    WHERE mycola = 55 AND UPPER(mycolb) = 'JONES';
    Restriction & Rule Summary
    The following restrictions apply to function based indexes. You may not index:
    a) LOB columns
    b) REF
    c) Nested table column
    d) Objects types with any of the above data types.
    Function-based indexes must always follow these rules:
    a) Cost Based optimizer only, must generate statistics after the index is created
    b) Can not store NULL values (function can not return NULL under any circumstance)
    c) If a user defined pl/sql routine is used for the function-based index, and is invalidated, the index will become "disabled"
    d) Functions must be deterministic (always return the same value for a known input)
    e) The index owner must have "execute" access on function used in the function-based index. Revocation of the privilege will render the index "disabled"
    f) May have a B-Tree and Bitmap index type only
    g) Can not use expressions that are based on aggregate functions, ie. SUM, AVG etc.
    h) To alter a function-based index as enabled, the function used must be valid, deterministic and the signature of the function matches the signature of the function when it was created.
    Joel P�rez

  • Function based indexes in Data Modeler 3.0

    Trying to create a function based index in DATA MODELER 3.0 but cannot find a way to do it. When I reverse engineer (import from DATA DICTIONNARY) an existing table that contains such an object, the index appears in the physical model as a regular index. I guess this functionnality is not yet available...
    Thanks.

    Hi,
    You can create a function-based Index by going to the Properties dialog for the Index in the Relational model (not the Physical model). If you select the Index Expression tick box, you can then enter the expression into the Expression text area.
    David

  • Function based indexes doing full table scan

    Guys,
    I am testing function based indexes and whatever I do
    it is doing a full table scan.
    1)I have set the following init parameters as
    QUERY_REWRITE_ENABLED=TRUE
    QUERY_REWRITE_INTEGRITY=TRUSTED
    2)CREATE INDEX i3 ON emp(UPPER(ename));
    3) ANALYZE TABLE emp COMPUTE STATISTICS
    ANALYZE INDEX I3 COMPUTE STATISTICS
    4) DELETE plan_table;
    5) EXPLAIN PLAN SET statement_id='Test1' FOR
    SELECT ename FROM emp WHERE UPPER(ename) = 'KING';
    6) SELECT LPAD(' ',2*level-2)||operation||' '||options||' '||object_name
    query_plan
    FROM plan_table
    WHERE statement_id='Test1'
    CONNECT BY prior id = parent_id
    START WITH id = 0 order by id
    7) And the query plan shows as
    SELECT STATEMENT
    TABLE ACCESS FULL EMP
    I am using 9.0.1.4 !!!
    Any help is appreciated !!!
    Regards,
    A.Kishore

    One of the many new features in Oracle 8i is the Function-Based Index (we will refrain from using FBI, but only just). This allows the DBA to create indexes on functions or expressions; these functions can be user generated pl/sql functions, standard SQL functions (non-aggregate only) or even a C callout.
    A classic problem the DBA faces in SQL Tuning is how to tune those queries that use function calls in the where clause, and result in indexes created on these columns not to be used.
    Example
    Standard B-Tree index on SURNAME with cost based optimizer
    create index non_fbi on sale_contacts (surname);
    analyze index non_fbi compute statistics;
    analyze table sale_contacts compute statistics;
    SELECT count(*) FROM sale_contacts
    WHERE UPPER(surname) = 'ELLISON';
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=3 Card=1 Bytes=17)
    1 0 SORT (AGGREGATE)
    2 1 TABLE ACCESS (FULL) OF 'SALES_CONTACTS' (Cost=3 Card=16 Bytes=272)
    Now we use a function based index
    create index fbi on sale_contacts (UPPER(surname));
    analyze index fbi compute statistics;
    analyze table sale_contacts compute statistics;
    SELECT count(*) FROM sale_contacts WHERE UPPER(surname) = 'ELLISON';
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=17)
    1 0 SORT (AGGREGATE)
    2 1 INDEX (RANGE SCAN) OF 'FBI' (NON-UNIQUE) (Cost=2 Card=381 Bytes=6477)
    The function-based index has forced the optimizer to use index range scans (retuning zero or more rowids) on the surname column rather than doing a full table scan (non-index lookup). Optimal performance does vary depending on table size, uniqueness and selectivity of columns, use of fast full table scans etc. Therefore try both methods to gain optimal performance in your database.
    It is important to remember that the function-based B*Tree index does not store the expression results in the index but uses an "expression tree". The optimizer performs expression matching by parsing the expression used in the SQL statement and comparing the results against the expression-tree values in the function-based index. This comparison IS case sensitive (ignores spaces) and therefore your function-based index expressions should match expressions used in the SQL statement where clauses.
    Init.ora Parameters
    The following parameter must be set in your parameter file: QUERY_REWRITE_INTEGRITY = TRUSTED
    QUERY_REWRITE_ENABLED = TRUE
    COMPATIBLE = 8.1.0.0.0 (or higher)
    Grants
    Grants To create function-based indexes the user must be granted CREATE INDEX and QUERY REWRITE, or alternatively be granted CREATE ANY INDEX and GLOBAL QUERY REWRITE. The index owner must have EXECUTE access on the function used for the index. If execute access is revoked then the function-based index will be "disabled" (see dba_indexes).
    Disabled Indexes
    If your function-based index has a status of "disabled" the DBA can do one of the following:
    a) drop and create the index (take note of its current settings)
    b) alter index enable, function-based indexes only, also use disable keyword as required
    c) alter index unusable.
    Queries on a DISABLED index fail if the optimizer chooses to use the index.Here is an example ORA error:
    ERROR at line 1: ORA-30554: function-based index MYUSER.FBI is disabled.
    All DML operations on a DISABLED index also fail unless the index is also marked UNUSABLE and the initialization parameter SKIP_UNUSABLE_INDEXES is set to true.
    Some more Examples
    CREATE INDEX expression_ndx
    ON mytable ((mycola + mycolc) * mycolb);
    SELECT mycolc FROM mytable
    WHERE (mycola + mycolc) * mycolb <= 256;
    ..or a composite index..
    CREATE INDEX example_ndx
    ON myexample (mycola, UPPER(mycolb), mycolc);
    SELECT mycolc FROM myexample
    WHERE mycola = 55 AND UPPER(mycolb) = 'JONES';
    Restriction & Rule Summary
    The following restrictions apply to function based indexes. You may not index:
    a) LOB columns
    b) REF
    c) Nested table column
    d) Objects types with any of the above data types.
    Function-based indexes must always follow these rules:
    a) Cost Based optimizer only, must generate statistics after the index is created
    b) Can not store NULL values (function can not return NULL under any circumstance)
    c) If a user defined pl/sql routine is used for the function-based index, and is invalidated, the index will become "disabled"
    d) Functions must be deterministic (always return the same value for a known input)
    e) The index owner must have "execute" access on function used in the function-based index. Revocation of the privilege will render the index "disabled"
    f) May have a B-Tree and Bitmap index type only
    g) Can not use expressions that are based on aggregate functions, ie. SUM, AVG etc.
    h) To alter a function-based index as enabled, the function used must be valid, deterministic and the signature of the function matches the signature of the function when it was created.
    Joel P�rez

  • Creation of function based index using escape

    Hello,
    I have the following SQL, sometimes performing bad:
    SELECT DISTINCT UPPER(A.PROCESSIDCODE), UPPER(A.RULENAME), CHARSET
    FROM XIB_DETECT A, XIB_PROCESSIDPROPERTIES B, XIB_RULES C
    WHERE ( A.KEY1 = :P1 OR ( :P1 like REPLACE(REPLACE(REPLACE(REPLACE(KEY1,'%', '\%'),'_', '\_'),'?', '_'),'*','%') escape '\' AND A.REGFLAGS1 = 'Y') OR A.KEY1 = '*' AND A.REGFLAGS1 = 'Y')
    AND (A.KEY2 = :P2 OR ( :P2 like REPLACE(REPLACE(REPLACE(REPLACE(KEY2,'%', '\%'),'_', '\_'),'?', '_'),'*','%') escape '\' AND A.REGFLAGS2 = 'Y') OR (A.KEY2 IS NULL AND A.REGFLAGS2 IS NULL ) )
    AND (A.KEY3 = :P3 OR ( :P3 like REPLACE(REPLACE(REPLACE(REPLACE(KEY3,'%', '\%'),'_', '\_'),'?', '_'),'*','%') escape '\' AND A.REGFLAGS3 = 'Y') OR (A.KEY3 IS NULL AND A.REGFLAGS3 IS NULL ) )
    AND (A.KEY4 = :P4 OR ( :P4 like REPLACE(REPLACE(REPLACE(REPLACE(KEY4,'%', '\%'),'_', '\_'),'?', '_'),'*','%') escape '\' AND A.REGFLAGS4 = 'Y') OR (A.KEY4 IS NULL AND A.REGFLAGS4 IS NULL ) )
    AND (A.KEY5 = :P5 OR ( :P5 like REPLACE(REPLACE(REPLACE(REPLACE(KEY5,'%', '\%'),'_', '\_'),'?', '_'),'*','%') escape '\' AND A.REGFLAGS5 = 'Y') OR (A.KEY5 IS NULL AND A.REGFLAGS5 IS NULL ) )
    AND (A.KEY6 IS NULL OR A.KEY6 = '*' AND REGFLAGS6 = 'Y')
    AND (A.KEY7 IS NULL OR A.KEY7 = '*' AND REGFLAGS7 = 'Y')
    AND (A.KEY8 IS NULL OR A.KEY8 = '*' AND REGFLAGS8 = 'Y')
    AND (A.KEY9 IS NULL OR A.KEY9 = '*' AND REGFLAGS9 = 'Y')
    AND (A.KEY10 IS NULL OR A.KEY10 = '*' AND REGFLAGS10 = 'Y')
    AND ( ( A.PROCESSIDCODE IS NOT NULL AND UPPER(A.PROCESSIDCODE) = UPPER(B.PROCESSIDCODE) AND A.XLEVEL = B.XLEVEL AND B.ACTIVEFLAG = 'Y' )
    OR ( A.RULENAME IS NOT NULL AND UPPER(A.RULENAME) = UPPER(C.RULENAME) AND A.XLEVEL = C.XLEVEL AND C.ACTIVEFLAG = 'Y' ) );
    Now I want to create a function based index on the key1 column:
    CREATE INDEX xib_detect_ix ON xib_detect (REPLACE(REPLACE(REPLACE(REPLACE(KEY1,'%', '\%'),'_', '\_'),'?', '_'),'*','%') escape '\') TABLESPACE ... ONLINE;
    However, this is not working with "escape" '\', throwing: ORA-00907: missing right parenthesis
    Any idea how to create an index on this construct with "escape"?
    Database version is 10.2.0.3.
    Thanks a lot.
    Regards
    Oliver

    Hi,
    You can get the "missing right parenthesis" error for many different syntax errors.
    In this case, you really are missing a right parenthesis.  Your statement has 5 left '('s, but only 4 right ')'s.  It's easy to see this if you format your code:
    CREATE  INDEX xib_detect_ix
    ON  xib_detect ( REPLACE ( REPLACE ( REPLACE ( REPLACE ( KEY1
                     escape '\'
    ESCAPE is an option that you can use with the LIKE operator.  It gives you a mechanism for cancelling the special meaning of symbols like '%'.    You're not using the LIKE operator to create the index.  You're only using REPLACE, and no characters have any special meaning in REPLACE, so there's no way (or reason) to escape them.  Use ESCAPE in queries that use LIKE, when appropriate.

  • Function-Based Indexes for 8.1.6 SE and 9iAS

    I have installed the 9iAS Portal into a 8.1.6 SE database, and I cannot get the Function-Based Index feature to turn on. I have set QUERY_REWRITE_INTEGRITY=trusted, QUERY_REWRITE_ENABLED=true and COMPATIBLE="8.1.0.0.0". The feature will still not enable.
    I have 2 questions:
    1. Is there anything else I can do to turn this feature on.
    2. If not, do I have to upgrade to 8.1.7 or to 8.1.* Enterprise Edition to make use of this feature.

    Could you give the statement for the index you have used, the query you try to do and a description of columns and datatypes of the table? How do you know/check that is doesn't work? Execution plan, errors?...

  • Unable to create function based Index

    Hi All,
    I created a function as below:
    create or replace function eqx_oklb_term_date_nvl(pin_term_date date)
    return date
    deterministic
    is
    l_sub_date date := sysdate+1;
    l_return_value date := l_sub_date;
    begin
    l_return_value := nvl(pin_term_date, l_sub_date);
    return l_return_value;
    exception
    when others
    then
    l_return_value := l_sub_date;
    return l_return_value;
    end eqx_oklb_term_date_nvl;
    Now trying to create a function based index using below code:
    create index EQX_OKC_K_LINES_B_N4 on OKC.OKC_K_LINES_B(EQX_OKLB_TERM_DATE_NVL(DATE_TERMINATED))
    logging
    tablespace EQIXDATA
    noparallel;
    Encountered Error:
    SQL Error: ORA-00904: "EQX_OKLB_TERM_DATE_NVL": invalid identifier
    00904. 00000 - "%s: invalid identifier"
    *Cause:   
    *Action:
    I can successfully query dba_objects for the function.
    Owner Object_name object_id object_type last_ddl_time status
    APPS     EQX_OKLB_TERM_DATE_NVL     11764623     FUNCTION     3/4/2013 9:44:57 PM     VALID
    I can also query the function using dual.
    select eqx_oklb_term_date_nvl(null) nvl_date from dual;
    nvl_date
    3/5/2013 9:53:59 PM
    I have given grants of the function to both schemas APPS/OKC
    grant all on eqx_oklb_term_date_nvl to okc;
    grant all on eqx_oklb_term_date_nvl to apps;
    The column date_terminated in table okc_k_lines_b is a date. I've checked that.
    Stuck here. Please help.
    Thanks in advance,
    Rahul

    Hi,
    To follow up, the below code resolved the issue:
    create index EQX_OKC_K_LINES_B_N4 on okc_k_lines_b(apps.eqx_oklb_term_date_nvl(date_terminated))
    logging
    tablespace eqixdata
    noparallel;
    -- qualifying the custom function name with schema name resolved the issue.
    Thanks,
    Rahul

  • Function Based index getting disabled frequently

    I am facing some error like “ORA-30554: function-based index ORADB1.FUN_INDX1 is disabled” in the development database. I verified that the function which is referred by the index is valid. Once I even got the tedious generic error ORA-600 because of this. I referred the metalink and advised to drop and recreate the index
    Dropping and recreating the index will solve the issue for 2-3 days and again the same will be repeated. So what I did is made the index unusable as it will not affect the other application activities. Can anybody give a clue on this issue?

    I am facing some error like “ORA-30554:
    function-based index ORADB1.FUN_INDX1 is disabled” Cause: An attempt was made to access a function-based index that has been marked disabled because the function on which the index depends has been changed.
    Action: Perform one of the following actions: -- drop the specified index using the DROP INDEX command -- rebuild the specified index using the ALTER INDEX REBUILD command -- enable the specified index using the ALTER INDEX ENABLE command -- make the specified index usable using the ALTER INDEX UNUSABLE command

Maybe you are looking for

  • Adobe premiere has encountered an error

    Premiere CC bringt diese Fehlermeldung. Habe dann versucht mit einen neuen Benutzer, dann ging es, aber nur für einen Tag! Was kann ich noch machen?

  • Table cell spanning pages

    Hi all, I'm having a rather major problem with Pages. I've managed to convince my sister-in-law to buy an iBook and star using Pages for her school work, however we've encountered a particularily difficult problem: Pages (and AppleWorks) does not all

  • How to calculate acquisition value for specified day

    Hi, in my z program I have a problem how to calculate acquisition value for my asset for specified day. Example: I have asset created 8.7.2008 with TTYPE 104 (External asset acquisition) with value 5950. 30.11.2008 there is another TTYPE 272 (Retirem

  • Why can't I log onto face book with my iphone says password is incorrect

    I changed my facebook password and it works fine on my computer but it doesn't recoganize it from my iphone and will not allow me to log on!  HELP!!

  • A .ssi file stopped working on all my pages. How do I fix it?

    I am using 2 server side includes on my pages and sometime since the last update one has stopped working. What can I do? Nothing shows up where it should be. It's a drop down list. The drop down does not appear anymore.