Creating spatial index on spatial table

Hi there. Just a quick query on creating spatial indexes on spatial tables. I have a table called System_Sessions which has the following four fields and types:
USER_ID NUMBER(10)
SESSION_ID NUMBER(10)
SESSION_BOUNDARY MDSYS.SDO_GEOMETRY (polygon)
START_POINT MDSYS.SDO_GEOMETRY (point)
I am inserting one row per user session into this table. I also need to retrieve the session ids of previous sessions involving a particular user based on the session's start point. The query i am running is an sdo_within_distance query which looks as follows:
Select session_id from joeweaker.system_sessions where user_id = 1003 and SDO_WITHIN_DISTANCE(start_point,
(MDSYS.SDO_GEOMETRY(2001, 8265, MDSYS.SDO_POINT_TYPE
(-105.0,40.0, NULL),NULL, NULL)), 'DISTANCE = 10000')='TRUE';
However I encounter the following error whenever I attempt to execute this query:
ORA-13226: interface not supported without a spatial index
ORA-06512: at "MDSYS.MD", line 1723
ORA-06512: at "MDSYS.MDERR", line 8
ORA-06512: at "MDSYS.SDO_3GL", line 255
I know I haven't built the spatial index on the table so I was hoping that somebody might show me how to do this. Thnaks a lot, Joe

Thnaks a lot Dan for the prompt reply. I have done as you advised and everything appears to be fine. However I have a second table called Session_Interest_Areas which appears as follows:
USER_ID----NUMBER(10)
SESSION_ID----NUMBER(10)
AREA_ID----NUMBER(10)
AREA_BOUNDARY----MDSYS.SDO_GEOMETRY
I inserted the necessary detail into the user_sdo_geom_metadata table and then attempted to create the index as follows (exactly the same format as my other spatial tables:
create index session_interest_areas_idx on
session_interest_areas (area_boundary)
indextype is mdsys.spatial_index;
When I execute this query I get the following stream of error messages:
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: Error in spatial index: [mdrcrtxfergm]
ORA-13249: Error in spatial index: [mdpridxtxfergm]
ORA-13200: internal error [ROWID:AAAHocAAJAAAAC8AAA] in spatial indexing.
ORA-13206: internal error [] while creating the spatial index
ORA-13373: Element of type Extent is not supported for Geodetic data
ORA-06512: at "MDSYS.SDO_INDEX_METHOD_9I", line 7
ORA-06512: at line 1
Why does this give me an error when the same approach worked fine for my other spatial tables? Is it something to do with the SRID? Also the index appears to have been created so I presume it has been created incorrectly. Thanks for your time, Joe

Similar Messages

  • Cannot create text index in partition table on Oracle 10g

    I try to create context index in a table with 15 millions records. The table is divided 5 partitions and each patition has 3 millions records. When I create the context index in the table, the same error always arised. The follow are my work:
    --First create my own lexer
    begin
    ctx_ddl.createperference('my_chinese_lexer','chinese_lexer');
    end;
    --Second create index
    create index idx_part_text3 on tb_test_part(text3)
    indextype is ctxsys.context local (
    partition p1_ix,
    partition p2_ix,
    partition p3_ix ,
    partition p4_ix,
    partition p5_ix)
    parameters('lexer my_chinese_lexer') parallel;
    --error message
    create index idx_part_text3 on tb_test_part(text3)
    Error in 1 line:
    ORA-12801: Parellel Query Server P000 send error signal
    ORA-29855: Error on execute ODCIINDEXCREATE program
    ORA-06510: PL/SQL: User Defined Error
    ORA-06512: In "CTXSYS.DRIDISP", line 244
    ORA-04030: Try to alloc 65548 Bytes (CTX PRM heap,draccbx:message buffer) Out of memory
    ORA-06512: In "CTXSYS.DRIPARX", line 10
    ORA-06512: In "CTXSYS.TEXTINDEXMETHODS", line 359
    ORA-04030: Try to alloc 65548 Bytes (CTX PRM heap,draccbx:message buffer) Out of memory
    ORA-06512: In "CTXSYS.DRUE", line 191
    ORA-06512: In "CTXSYS.DRUE", line 49
    ORA-06512: In "CTXSYS.DRUE", line 24
    ORA-06512: In "CTXSYS.DRUE", line 186
    ORA-06512: In "CTXSYS.DRVDDL", line 682
    ORA-04030: Try to alloc 65548 Bytes (CTX PRM heap,draccbx:message buffer) Out of memory
    ORA-04030: Try to alloc 65548 Bytes (CTX PRM heap,draccbx:message buffer) Out of memory
    ORA-06512: In "CTXSYS.DRUE", line 191
    ORA-06512: In "CTXSYS.DRUE", line 49
    ORA-06512: In "CTXSYS.DRUE", line 24
    ORA-06512: In "CTXSYS.DRVDDL", line 452
    ORA-06510: PL/SQL: User Defined Error
    BTW:
    My oracle 10g run on linux AS3 box with 4xP4 and 6G Mem.
    I set pga_aggregate_target=2200M, and at the beginning of creating index, the max pga alloced is about 1100M, but when one patition finished, the error arised and the max pga alloced suddenly reached 3500M. So in every times, the index status is always like below:
    P1_ix usable
    P2_ix Inprogress
    P3_ix Inprogress
    P4_ix Inprogress
    P5_ix Inprogress
    Thx for any help!

    Try to increase LARGE_POOL_SIZE.
    PGA_AGGREGATE_TARGET is not only parameter that can meddle in parallel execution.
    Looks like parallel execution parameters is not correctly set. Check it all, including PARALLEL_EXECUTION_MESSAGE_SIZE.

  • Create unique index on flow table

    Hi
    I always get this error 'Create unique index on flow table ERROR" while implementing SCD2. Please help me.I have made an Update Key which is a combination of 4 columns that want a new row to be inserted if there is a change in data.One of the above columns is the EMPLOYEE ID,
    My surrogate key is the table's primary key but I have not defined it as a key in mapping and also I have turned off the Primary Key Constraint Option in Controls Panel as NO.
    Where am I wrong? Also please tell me what to take care off while making Natural Key ?

    There are two solutions:
    1. Only use uppercase in the table name
    2. go in Topology>Physical Architecture and edit the technology, then click on
    the "Language" tab and set "Object Delimiter" to empty.
    Thanks,
    Sutirtha

  • Can I create unpartitioned index on partitioned table??

    Hi,
    I am not clear about the concepts of partitioned and non partitioned index.I was under impression that If we create a index on partitioned table it will be automatically becomes a partitioned index.But I cheked in my DB there are many unpartitioned indexes on large partitioned tables.
    Which one of these is efficient? wht is the concept of local and global related to these partitioned and unparitioned.I am bit confused.pls help me.
    Thanks

    There's nothing prevent you from creating a nonpartitioned index on partitioned table. The official name for it is Global Nonpartitioned Indexes
    Global Nonpartitioned Indexes
    Global nonpartitioned indexes behave just like a nonpartitioned index. They are commonly used in OLTP environments and offer efficient access to any individual record.
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14220/partconc.htm#i461446

  • Spatial index creation for table with more than one geometry columns?

    I have table with more than one geometry columns.
    I'v added in user_sdo_geom_metadata table record for every column in the table.
    When I try to create spatial indexes over geometry columns in the table - i get error message:
    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
    What is the the solution?

    I'v got errors in my user_sdo_geom_metadata.
    The problem does not exists!

  • Is it worth creating secondary index on BKPF table ?

    Hello,
    One of my clients is using ECC version 5.0. I have a requirement wherein I need to fetch the data from BKPF table based on AWKEY, BUKRS and GJAHR. There is no standard secondary index available.
    I have decided to create a secondary index on these fields in the following order:
    1) MANDT
    2) AWKEY
    3) BUKRS
    4) GJAHR
    I know that creating secondary indexes does improve performance during data retrieval. But when I checked the total number of entries in BKPF table in production system, there are more than 20 lac 2 million records.
    I am worried that creation of secondary index will create another table of such a large size in production that has data sorted on the above fields. Also, the RAM of production system is 6 GB.
    Please suggest if creation of secondary index is a good measure OR should I recommend the client to increase the system RAM?
    Regards,
    Danish.
    Edited by: Thomas Zloch on Oct 3, 2011 3:01 PM

    Hi,
    Secondary Index on BKPF-AWKEY has been successfully created in production. The report which used to timeout in foreground as well as in background is now executing in less than 10 seconds !!
    Client is very much satisfied with this. But, there is one problem that we are facing now is that when the user is changing an existing billing document via VF02, on SAVE, system takes a very long time to save the changes done.
    We monitored the processes via SM50 and found that there was a sequential read on BKPF table.
    Before transporting the index in production, system approximately took not more than 5 seconds to save the Billing Document. But now system takes more than 20 minutes just to save the billing document via VF02.
    I really don't know what has gone wrong. I can't figure out if I have missed any step while creating the index.
    I did the following,
    1) Created a Secondary index on BKPF, saved it in the transport request and activated it. Since the index was not existing in database ORACLE, I activated and adjusted the table via SE14. Now, index exists on database as well. Working perfectly in development.
    2) Imported the transport request to Production. Checked in SE11. Index was existing and active. Also, index existed in database ORACLE.
    Have I missed anything ? Is it required to activate and adjust the database via SE14 in production too ?
    Regards,
    Danish.

  • How to create better index on a table--

    Hi
    I have table called CS_LM_CUST.Every day I am getting 1,50,00
    records every day.And all the records I am inserting.And every
    two months data I am doing purging.My requirement is to load
    chaged data between 2 days i.e current day feed minus previous
    day feed difference data only I need to do.
    For taking the differrence data I have given the sql statement
    like this.
    SELECT
    CUST_NO,ORIG_BR_COD,LANG_COD,NATL_CTRY_COD,CUST_NAM,DMCL_CTRY_COD
    ,CUST_GFCID,CUST_GFPID,STD_INDS_COD FROM CS_LM_CUST WHERE
    ORIG_BR_COD = p_Branch AND REC_EXTRC_DT = CurrentDate
    MINUS
    SELECT
    CUST_NO,ORIG_BR_COD,LANG_COD,NATL_CTRY_COD,CUST_NAM,DMCL_CTRY_COD
    ,CUST_GFCID,CUST_GFPID,STD_INDS_COD FROM CS_LM_CUST WHERE
    ORIG_BR_COD = p_Branch AND REC_EXTRC_DT = PreviousDate
    And for updating the differed data sql statement is given like
    this.
    UPDATE CS_LM_CUST
              SET newrec_flg = 'Y'
              WHERE cust_no = g_CSLMCUST.cust_no AND
              orig_br_cod = g_CSLMCUST.ORIG_BR_COD AND
              rec_extrc_dt = g_CSLMCUST.rec_extrc_dt;
    Index has been created on cust_no,orig_br_cod,rec_extn_dt.But
    the updating part is taking lot of time.Nearly 45mts.Could any
    one suggest better indexing on this table which will satisfy
    DML statement like SELECT,UPDATE.
    The table below fields
    CUST_NO
    REC_TYP
    LANG_COD
    NATL_CTRY_COD
    REC_EXTRC_DT
    CUST_NAM
    DMCL_CTRY_COD
    CUST_GFCID
    CUST_GFPID
    ORIG_BR_COD
    SYS_NAM
    DATA_TYP
    STD_INDS_COD
    ACTN_TYP
    EVENT_TYP
    MSG_DT_TM_STMP
    FORMAT_OK_FLG
    MSG_ID
    NEWREC_FLG
    I have tried alot for creating all the possible ways.But it
    satisfy either SELECT or UPDATE at a time.
    Thanks & Regards
    Srinivas Nimishakavi

    Hi, General practice is clustered index would be created by Primary key if one created. That would identify the row ie., no duplicate rows. You can create composite key (combination of more than one column) as primary key.  Other widely used practice
    is to use surrogate key  like identity key which assigned unique number. Please note that you only got one clustered index .
    " Clustered indexes sort and store the data rows in the table or view based on their key values. These are the columns included in the index definition. There can be only one clustered index per table, because the data rows themselves can be sorted in only
    one order. "
    Since you already got quite few non-clustered indexes, you have to rebuild/reorganize once you create clustered index.

  • How to create secondry index on database table

    how to create secondry index on database table

    Hi
    By trx SE11:
    - Choose your table and press CHANGE ICON, so INDEX
    When you create an index you should consider if your index is contained in another index.
    If the fields of your index are:
    - FIELD1, FLIED2, FIELD3
    ...it'll be triggered only if the select is:
    SELECT * FROM <TABLE> WHERE FIELD1
                            AND FIELD2
                            AND FIELD3
    A select like this
    SELECT * FROM <TABLE> WHERE FIELD1
                            AND FIELD3
                            AND FIELD2
    doesn't use your index.
    Max

  • SPLIT PARTITION  creating the index in different Table Space

    I am splitting the table every month. After splitting the Index is also Splitting. (It is natural). But it is creating in default table Space.
    I want to split INDEX and creating into the index table space “ACTIVITY_IND_TS_1”
    CREATE TABLE PART
    PK_KEY NUMBER(15) NOT NULL,
    PK_ID NUMBER(1) NOT NULL
    TABLESPACE USERS PARTITION BY RANGE (PK_ID)
    PARTITION PK_ID_PRD1 VALUES LESS THAN (1)
    LOGGING
    TABLESPACE ACTIVITY_TAB_TS_1,
    PARTITION PK_ID_PRD2 VALUES LESS THAN (2)
    LOGGING
    TABLESPACE ACTIVITY_TAB_TS_1,
    PARTITION PK_ID_PRD3 VALUES LESS THAN (3)
    LOGGING
    TABLESPACE ACTIVITY_TAB_TS_1,
    PARTITION PK_ID_PRD4 VALUES LESS THAN (4)
    LOGGING
    TABLESPACE ACTIVITY_TAB_TS_1,
    PARTITION PK_ID_PRD_MAXVALUE VALUES LESS THAN (MAXVALUE)
    LOGGING
    TABLESPACE ACTIVITY_TAB_TS_1
    NOCACHE
    NOPARALLEL
    ENABLE ROW MOVEMENT;
    CREATE INDEX PART_IX ON PART(PK_ID)
    LOCAL (PARTITION PK_ID_PRD1 TABLESPACE ACTIVITY_IND_TS_1,
    PARTITION PK_ID_PRD2 TABLESPACE ACTIVITY_IND_TS_1,
    PARTITION PK_ID_PRD3 TABLESPACE ACTIVITY_IND_TS_1,
    PARTITION PK_ID_PRD4 TABLESPACE ACTIVITY_IND_TS_1,
    PARTITION PK_ID_PRD_MAXVALUE TABLESPACE ACTIVITY_IND_TS_1)
    PARALLEL
    NOLOGGING;
    select unique tablespace_name from user_tab_partitions; -- ACTIVITY_TAB_TS_1
    select unique tablespace_name from user_ind_partitions; -- ACTIVITY_IND_TS_1
    ALTER TABLE PART SPLIT PARTITION PK_ID_PRD_MAXVALUE
    AT (5) INTO (PARTITION PK_ID_PRD5, PARTITION PK_ID_PRD_MAXVALUE);
    select unique tablespace_name from user_tab_partitions; -- ACTIVITY_TAB_TS_1
    select unique tablespace_name from user_ind_partitions; -- ACTIVITY_TAB_TS_1 ACTIVITY_IND_TS_1
    Edited by: sk123 on May 5, 2009 1:05 PM

    Hello,
    Once you split partition you need to rebuild indexes if you want indexes to be in their own tablespaces
    ALTER TABLE PART
    SPLIT PARTITION PK_ID_PRD_MAXVALUE AT
    (6)
    INTO (PARTITION PK_ID_PRD5
           TABLESPACE ACTIVITY_TAB_TS_1
           PARTITION PK_ID_PRD_MAXVALUE);
    ALTER INDEX PART_IX
    REBUILD PARTITION PK_ID_PRD5
    TABLESPACE ACTIVITY_IND_TS_1;
    ALTER INDEX PART_IX
    REBUILD PARTITION PK_ID_PRD_MAXVALUE
    TABLESPACE ACTIVITY_IND_TS_1;Regards

  • ERROR creating spatial index

    Hi all.
    I have a problem during the creation of a spatial index for a table column.
    The metadata is in the USER_SDO_GEOM_METADATA VIEW, but Oracle throws the message:
    ORA-29855: se ha producido un error en la ejecución de la rutina ODCIINDEXCREATE
    ORA-13203: fallo al leer la vista USER_SDO_GEOM_METADATA
    ORA-13203: fallo al leer la vista USER_SDO_GEOM_METADATA
    ORA-06512: en "MDSYS.SDO_INDEX_METHOD_10I", línea 10
    The code that i use to create the index is:
    DELETE FROM USER_SDO_GEOM_METADATA;
    INSERT INTO USER_SDO_GEOM_METADATA
    VALUES (
    'E011_CIUDADES',
    'F011_GEO',
    MDSYS.SDO_DIM_ARRAY(
    MDSYS.SDO_DIM_ELEMENT('Longitud', -180, 180, 10), -- 10 meters tolerance
    MDSYS.SDO_DIM_ELEMENT('Latitud', -90, 90, 10) -- 10 meters tolerance
    8307 -- SRID for 'Longitude / Latitude (WGS 84)' coordinate system
    CREATE INDEX IX_SPATIAL_011_GEO
    ON SYSTEM.E011_CIUDADES(F011_GEO)
    INDEXTYPE IS MDSYS.SPATIAL_INDEX
    PARAMETERS ('tablespace=ASOUSU');
    I will apreciate any help. Thanks.

    This is very bad:
    CREATE INDEX IX_SPATIAL_011_GEO ON SYSTEM.E011_CIUDADES(F011_GEO)
      INDEXTYPE IS MDSYS.SPATIAL_INDEX PARAMETERS ('tablespace=ASOUSU');It means you've stored spatial data in the SYSTEM user's schema, which, as noted, is mucho malo. Either that, or it is a typo and that is why you got: fallo al leer la vista USER_SDO_GEOM_METADATA

  • Re: problems creating spatial index !!!!

    hi! Guys ,
    I am running Oracle 9.0.1.1.1 on windows 2000 professional.
    I am creating a spatial index on a table column.
    When i try to create it from sqlplus command prompt ..
    it errors out END OF FILE ON COMMUNICATION CHANNEL ..
    It was suggested to be run as a job using DBMS_JOB.
    I created a proc in which I use dbms_sql for creating the spatial
    index.
    I submit the proc as a job using DBMS_JOB.SUBMIT
    When I try to run the job using DBMS_JOB.RUN(32); where 32 is the
    job number it is bombing out.
    submitted as job number 32
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> execute dbms_job.run(32);
    -29855ORA-29855: error occurred in the execution of ODCIINDEXCREATE
    routine
    ORA-13249: internal error in S
    PL/SQL procedure successfully completed.
    Could any body help me resolve the issue and succesfully create the
    spatial index ????
    I have only oracle to work on this and not any applications like Arcse.
    Heres the code ...
    create or replace procedure p_1 as
    v_cursor INTEGER;
    v_sqlstatement VARCHAR2(500);
    v_returncode INTEGER;
    BEGIN
    v_cursor := DBMS_SQL.OPEN_CURSOR;
    v_sqlstatement := 'CREATE INDEX RD_LINK_GEO_IDX ON ITN_NEW.RD_LINK_FINAL(GEOLOC)
    INDEXTYPE IS MDSYS.SPATIAL_INDEX';
    DBMS_SQL.PARSE(v_cursor,v_sqlstatement,DBMS_SQL.V7);
    v_returncode := DBMS_SQL.EXECUTE(v_cursor);
    DBMS_SQL.CLOSE_CURSOR(v_cursor);
    commit;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line(to_char(sqlcode)||substr(sqlerrm,1,100));
    DBMS_SQL.CLOSE_CURSOR(v_cursor);
    END;
    variable v_job1 number
    set serveroutput on
    begin
    dbms_job.submit(job => :v_job1, what => 'p_1;', next_date => sysdate);
    dbms_job.run(:v_job1);
    dbms_output.put_line('submitted as job number '|| to_char(:v_job1));
    end;
    thanks,
    harish

    when i try
    begin
    execute immediate 'create index ............'
    end ;
    i get the following error
    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: Error in R-tree: [mdrcritbl]
    ORA-13231: failed to create index table [] during R-tree creation
    ORA-29400: data cartridge error
    ORA-01031: insufficient privileges
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_9I", line 7
    ORA-06512: at line 1
    ORA-06512: at "ITN_NEW.P_2", line 3
    ORA-06512: at line 1
    Please help ....
    thanks,
    harish

  • Unable to create spatial index

    I have a spatial table called ROAD11
    in that table I have a MDSYS.SDO_GEOMETRY column named "GEOMETRY".
    after creating that table, I inserted a row, in the USER_SDO_GEOM_METADATA.
    Here is what is present in USER_SDO_GEOM_METADATA
    SQL> SELECT * FROM USER_SDO_GEOM_METADATA WHERE TABLE_NAME='ROAD11';
    ROAD11
    GEOMETRY
    SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X',0,20000,.000005),SDO_DIM_ELEMENT('Y,0,20000,.000005))
    1 row selected
    Now when I am trying to create an index on that table with the syntax.
    SQL> CREATE INDEX ROAD11 ON ROAD11(GEOMETRY)
    INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    CREATE INDEX ROAD11 ON ROAD11(GEOMETRY)
    ERROR at Line 1:
    ORA-29855: error occured in the execution of ODCIINDEXCREATE routine
    ORA-13249: internal error in Satial index:[mdidxrbd]
    ORA-13249: Error in Spatial index: index build failed
    ORA-13249: Error in Spatial index: [mdrcrtxfergm]
    ORA-13000: dimension number is out of range
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_9I", line 7
    ORA-06512: at line 1
    This error is comeing while creating an index.
    I am useing Oracle 9i.Please help me out in solving the problem.
    Suprabuddha.

    can you post a sample geometry?

  • Create local spatial index on range sub-partitions?

    Is is possible to create a local spatial index on a table with range sub-partitions? We're trying to do this on a table that contains lots of x,y,z point data.
    Trying to do so gives me the error: ORA-29846: cannot create a local domain index on a composite partitioned tableAccording to the spatial documentation:The following restrictions apply to spatial index partitioning:
    - The partition key for spatial tables must be a scalar value, and must not be a spatial column.
    - Only range partitioning is supported on the underlying table. All other kinds of partitioning are not currently
    supported for partitioned spatial indexes.So there is nothing saying it can or can't be done. The examples I've seen in the documentation tend to partition based on a single value and don't use subpartitioning.
    Example of what we're trying to do:SQL> SELECT * FROM V$VERSION;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0      Production
    TNS for 64-bit Windows: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    SQL>
    SQL> --- Create a table, partioned by X and subpartitioned by Y
    SQL> CREATE TABLE sub_partition_test
      2  (
      3      x               NUMBER,
      4      y               NUMBER,
      5      z               NUMBER,
      6      geometry        MDSYS.SDO_GEOMETRY
      7  )
      8  PARTITION BY RANGE (x)
      9  SUBPARTITION BY RANGE (y)
    10     (
    11     PARTITION p_x100 VALUES LESS THAN (100)
    12     (
    13                     SUBPARTITION sp_x100_y100 VALUES LESS THAN (100),
    14                     SUBPARTITION sp_x100_y200 VALUES LESS THAN (200),
    15                     SUBPARTITION sp_x100_yMAXVALUE VALUES LESS THAN (MAXVALUE)
    16     ),
    17     PARTITION p_x200 VALUES LESS THAN (200)
    18     (
    19                     SUBPARTITION sp_x200_y100 VALUES LESS THAN (100),
    20                     SUBPARTITION sp_x200_y200 VALUES LESS THAN (200),
    21                     SUBPARTITION sp_x200_yMAXVALUE VALUES LESS THAN (MAXVALUE)
    22     ),
    23     PARTITION p_xMAXVALUE VALUES LESS THAN (MAXVALUE)
    24     (
    25                     SUBPARTITION sp_xMAXVALUE_y100 VALUES LESS THAN (100),
    26                     SUBPARTITION sp_xMAXVALUE_y200 VALUES LESS THAN (200),
    27                     SUBPARTITION sp_xMAXVALUE_yMAXVALUE VALUES LESS THAN (MAXVALUE)
    28     )
    29  );
    Table created.
    SQL>
    SQL> -- Insert some sample data
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (1, 1, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(1, 1, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (50, 150, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(50, 150, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (150, 150, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(150, 150, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (150, 250, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(150, 250, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (150, 300, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(150, 300, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (220, 210, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(220, 210, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (220, 150, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(220, 150, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (220, 250, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(220, 250, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (220, 300, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(220, 300, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (320, 250, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(320, 250, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (320, 160, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(320, 160, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (320, 290, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(320, 290, 50), NULL, NULL));
    1 row created.
    SQL> INSERT INTO sub_partition_test (x, y, z, geometry)
      2  VALUES (320, 320, 50, SDO_GEOMETRY(3001, 2157, SDO_POINT_TYPE(320, 320, 50), NULL, NULL));
    1 row created.
    SQL>
    SQL> -- Create some metadata
    SQL> DELETE FROM user_sdo_geom_metadata WHERE TABLE_NAME = 'SUB_PARTITION_TEST';
    1 row deleted.
    SQL> INSERT INTO user_sdo_geom_metadata VALUES ('SUB_PARTITION_TEST','GEOMETRY',
      2  SDO_DIM_ARRAY(
      3     SDO_DIM_ELEMENT('X', 0, 1000, 0.005),
      4     SDO_DIM_ELEMENT('Y', 0, 1000, 0.005)
      5  ), 262152);
    1 row created.
    SQL>
    SQL> -- Create an Unusable Local Spatial Index
    SQL> CREATE INDEX sub_partition_test_spidx ON sub_partition_test (geometry)
      2    INDEXTYPE IS MDSYS.SPATIAL_INDEX
      3  LOCAL
      4  UNUSABLE;
    CREATE INDEX sub_partition_test_spidx ON sub_partition_test (geometry)
    ERROR at line 1:
    ORA-29846: cannot create a local domain index on a composite partitioned tableThanks,
    John

    Ok, thanks. That's what we're planning on doing now.
    SQL> CREATE TABLE partition_test
      2  (
      3      x               NUMBER,
      4      y               NUMBER,
      5      z               NUMBER,
      6      geometry        MDSYS.SDO_GEOMETRY
      7  )
      8  PARTITION BY RANGE (x, y)
      9     (
    10     PARTITION p_x100y100 VALUES LESS THAN (100, 100),
    11     PARTITION p_x100y200 VALUES LESS THAN (100, 200),
    12     PARTITION p_x100yMAX VALUES LESS THAN (100, MAXVALUE),
    13     PARTITION p_x200y100 VALUES LESS THAN (200, 100),
    14     PARTITION p_x200y200 VALUES LESS THAN (200, 200),
    15     PARTITION p_x200yMAX VALUES LESS THAN (200, MAXVALUE),
    16     PARTITION p_x300y100 VALUES LESS THAN (300, 100),
    17     PARTITION p_x300y200 VALUES LESS THAN (300, 200),
    18     PARTITION p_x300yMAX VALUES LESS THAN (MAXVALUE, MAXVALUE)
    19  );
    Table created.
    SQL>
    SQL> INSERT INTO user_sdo_geom_metadata VALUES ('PARTITION_TEST','GEOMETRY',
      2     SDO_DIM_ARRAY(
      3        SDO_DIM_ELEMENT('X', 0, 1000, 0.005),
      4        SDO_DIM_ELEMENT('Y', 0, 1000, 0.005)
      5     ), 262152);
    1 row created.
    SQL> CREATE INDEX partition_test_spidx ON partition_test (geometry)
      2     INDEXTYPE IS MDSYS.SPATIAL_INDEX
      3  LOCAL
      4  UNUSABLE;
    Index created.

  • Spatial index on table with object-column (and inheritance)

    Hi!
    Is it possible to create a spatial index on a table with an object-column (and inheritance) like this:
    CREATE OR REPLACE TYPE feature_type AS OBJECT (
    shape MDSYS.SDO_GEOMETRY
    ) NOT FINAL;
    CREATE OR REPLACE TYPE building_type UNDER feature_type (
    name VARCHAR2(50)
    CREATE TABLE features ( no NUMBER PRIMARY KEY, feature feature_type);
    [...] user_sdo_geom_metadata [...]
    Then
    CREATE INDEX features_idx ON features(feature.shape) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    throws:
    ORA-01418: specified index does not exist
    Curious! :)
    If I define feature_type with "NOT FINAL" option but without subtypes, I get (create index):
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01460: unimplemented or unreasonable conversion requested
    So I think besides object tables also inheritance isn't supported whith oracle spatial!?
    Thanks,
    Michael
    ps:
    We use Oracle9i Enterprise Edition Release 9.0.1.4.0 / Linux.
    Solves Oracle9i 9.2 this problems?

    Hi
    You'll need to be on 9.2 to do this....
    Dom

  • SDO_NN doesn't work though tables are spatially indexed

    Hi,
    As said Andrew Thomas, the Search function doesn't work today, so I don't know if the answer is already somewhere in the forum.
    I' trying to perform a SDO_NN (nearest neighbor) search on a set of tables which are almost identical in structure. I first created a view in order to do 'ordinary' selects on the 'ordinary' columns.
    Now I need to code request on spatial columns, with joins based on results from SDO_NN and values from ancillary function SDO_NN_DISTANCE.
    As SDO_NN requires its first parameter to be a spatially indexed column and it is not possible to index a view, I create a temporary table on the fly, index it, insert a line into USER_SDO_INDEX_METADATA about this index and then launch my request.
    I always get the following error:
    ERROR at line 1 :
    ORA-13249: SDO_NN cannot be evaluated without using index
    ORA-06512: in "MDSYS.MD", ligne 1723
    ORA-06512: in "MDSYS.MDERR", ligne 17
    ORA-06512: in "MDSYS.PRVT_IDX", ligne 27
    I've spent 3 days on it now, reading the manual for clues, adding optimizer hints, and so on.
    Here comes the trace of my SQL script (with SET ECHO ON):
    ===================================================
    SQL> @er_ens.sql
    SQL>
    SQL> DROP TABLE TEMPGEOMDATA ; -- Drop the temp table to be sure
    DROP TABLE TEMPGEOMDATA
    ERREUR � la ligne 1 :
    ORA-00942: Table ou vue inexistante -- It didn't exist
    SQL> DROP INDEX TEMPGEOMDATA_IDX ; -- Drop the temp index to be sure
    DROP INDEX TEMPGEOMDATA_IDX
    ERREUR � la ligne 1 :
    ORA-01418: L'index indiqu� n'existe pas -- It didn't exist, either
    SQL> DESCRIBE v$_er_ens; -- Display the view structure
    Nom NULL ? Type
    ADRESSE_NUMERO VARCHAR2(255)
    ADRESSE_RUE VARCHAR2(255)
    CLEF_DISTANCIER_GLOBAL VARCHAR2(255)
    CODE_INSEE VARCHAR2(255)
    DATE_CREATION DATE
    DATE_MODIFICATION DATE
    EFFECTIF_1997_1998 NUMBER
    GEOMETRIE MDSYS.SDO_GEOMETRY
    ID_FOURNISSEUR VARCHAR2(255)
    INCLUS_DANS_LES_YVELINES VARCHAR2(255)
    NOM VARCHAR2(255)
    OBSERVATIONS_REMARQUES VARCHAR2(255)
    RNE VARCHAR2(255)
    SOURCE_DONNEES_GRAPHIQUES VARCHAR2(255)
    STATUT VARCHAR2(255)
    TYPE VARCHAR2(261)
    SQL> SELECT Count(*) FROM v$_er_ens; -- Display the number of rows in the view
    COUNT(*)
    438
    SQL> CREATE TABLE TEMPGEOMDATA AS SELECT * from v$_er_ens; -- Create temp table based on view
    Table cr��e. -- Created
    SQL>
    SQL> DESCRIBE TEMPGEOMDATA; -- Display the temp table structure: all the same
    Nom NULL ? Type
    ADRESSE_NUMERO VARCHAR2(255)
    ADRESSE_RUE VARCHAR2(255)
    CLEF_DISTANCIER_GLOBAL VARCHAR2(255)
    CODE_INSEE VARCHAR2(255)
    DATE_CREATION DATE
    DATE_MODIFICATION DATE
    EFFECTIF_1997_1998 NUMBER
    GEOMETRIE MDSYS.SDO_GEOMETRY
    ID_FOURNISSEUR VARCHAR2(255)
    INCLUS_DANS_LES_YVELINES VARCHAR2(255)
    NOM VARCHAR2(255)
    OBSERVATIONS_REMARQUES VARCHAR2(255)
    RNE VARCHAR2(255)
    SOURCE_DONNEES_GRAPHIQUES VARCHAR2(255)
    STATUT VARCHAR2(255)
    TYPE VARCHAR2(261)
    SQL> SELECT Count(*) FROM TEMPGEOMDATA ; -- Display the number of rows in the temp table: the very same
    COUNT(*)
    438
    SQL>
    SQL> INSERT INTO -- Insert a new line in SDO_USER_INDEX_METADATA
    2 USER_SDO_GEOM_METADATA
    3 VALUES (
    4 'TEMPGEOMDATA'
    5 , 'GEOMETRIE'
    6 , MDSYS.SDO_DIM_ARRAY(
    7 MDSYS.SDO_DIM_ELEMENT('X', 56957200, 59045500, 0.005)
    8 , MDSYS.SDO_DIM_ELEMENT('Y', 242450500, 244324700, 0.005)
    9 )
    10 , NULL
    11 )
    12 ;
    1 ligne cr��e. -- Line inserted
    SQL> SELECT * FROM USER_SDO_GEOM_METADATA WHERE TABLE_NAME LIKE 'TEMPGEOMDATA'; -- Check to be sure!
    TABLE_NAME COLUMN_NAME DIMINFO SRID
    TEMPGEOMDATA GEOMETRIE SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', 56957 NULL
    200, 59045500, ,005), SDO_DIM_ELEMENT('Y
    ', 242450500, 244324700, ,005))
    SQL> CREATE INDEX TEMPGEOMDATA_IDX -- Create the spatial index on temp table
    2 ON "TEMPGEOMDATA" ("GEOMETRIE")
    3 INDEXTYPE IS MDSYS.SPATIAL_INDEX
    4 PARAMETERS (' SDO_INDX_DIMS=2 LAYER_GTYPE="COLLECTION"')
    5 ;
    Index cr��. -- Index created
    SQL> show errors
    Pas d'erreur. -- NO errors!
    SQL> COMMIT;
    Validation effectu�e. -- Commited to be sure!
    SQL> SELECT -- Checking that every table involved has a spatial index
    2 U.SDO_INDEX_NAME
    3 --, A.OWNER
    4 --, A.INDEX_TYPE
    5 --, A.TABLE_OWNER
    6 , A.TABLE_NAME
    7 , A.STATUS
    8 , A.PARAMETERS
    9 --, A.JOIN_INDEX
    10 FROM
    11 USER_SDO_INDEX_METADATA U,
    12 ALL_INDEXES A
    13 WHERE
    14 ( U.SDO_INDEX_NAME = A.INDEX_NAME )
    15 AND (
    16 ( A.TABLE_NAME LIKE '%TEMPGEOMDATA%' )
    17 OR
    18 ( A.TABLE_NAME LIKE '%BATSP_CIS%' )
    19 OR
    20 ( A.TABLE_NAME LIKE '%ENS%' )
    21 )
    22 ;
    SDO_INDEX_NAME TABLE_NAME STATUS PARAMETERS
    BATSP_CIS_SP_IDX BATSP_CIS VALID SDO_INDX_DIMS=2 LAYER_GTYPE="COLLECTION"
    ENS_COLLEGE_SP_IDX ENS_COLLEGE VALID SDO_INDX_DIMS=2 LAYER_GTYPE="COLLECTION"
    ENS_ECOLEPRIM_SP_IDX ENS_ECOLEPRIM VALID SDO_INDX_DIMS=2 LAYER_GTYPE="COLLECTION"
    ENS_LYCEE_SP_IDX ENS_LYCEE VALID SDO_INDX_DIMS=2 LAYER_GTYPE="COLLECTION"
    ENS_UIT_SP_IDX ENS_UIT VALID SDO_INDX_DIMS=2 LAYER_GTYPE="COLLECTION"
    ENS_UNIV_SP_IDX ENS_UNIV VALID SDO_INDX_DIMS=2 LAYER_GTYPE="COLLECTION"
    TEMPGEOMDATA_IDX TEMPGEOMDATA VALID SDO_INDX_DIMS=2 LAYER_GTYPE="COLLECTION"
    7 ligne(s) s�lectionn�e(s). -- Yes, they all do (Join table, original tables for the view, temp table from the view)
    SQL> SELECT /*+ INDEX(TEMPGEOMDATA TEMPGEOMDATA_IDX) INDEX(BATSP_CIS BATSP_CIS_SP_IDX INDEX LIMADM_COMMUNE LIMADM_COMMUNE_SP_IDX)*/
    2 v.nom ENS_NOM
    3 , v.adresse_numero -- Spatial request with
    4 , v.adresse_rue -- optimizer hints to be sure indexes are used
    5 , c.code_insee -- My understanding of manual is that only the
    6 , c.nom COM_NOM -- 1st SDO_NN() parameter has to be spatially indexed
    7 , b.code_centre -- i.e. alias 'b', table BATSP_CIS
    8 , MDSYS.SDO_NN_DISTANCE(1) DIST -- which is the case!
    9 FROM
    10 --v$_er_ens v
    11 TEMPGEOMDATA v
    12 , limadm_commune c
    13 , batsp_cis b
    14 WHERE
    15 ( v.code_insee = c.code_insee ) AND
    16 ( SDO_NN(b.geometrie, v.geometrie, 'sdo_num_res=1', 1) = 'TRUE' )
    17 ;
    SELECT /*+ INDEX(TEMPGEOMDATA TEMPGEOMDATA_IDX) INDEX(BATSP_CIS BATSP_CIS_SP_IDX INDEX LIMADM_COMMUNE LIMADM_COMMUNE_SP_IDX)*/
    ERREUR � la ligne 1 : -- An error occurs, though!
    ORA-13249: SDO_NN cannot be evaluated without using index
    ORA-06512: � "MDSYS.MD", ligne 1723
    ORA-06512: � "MDSYS.MDERR", ligne 17
    ORA-06512: � "MDSYS.PRVT_IDX", ligne 27
    SQL> DELETE FROM
    2 USER_SDO_GEOM_METADATA
    3 WHERE
    4 TABLE_NAME = 'TEMPGEOMDATA'
    5 ;
    1 ligne supprim�e. -- Deleted the line from USER_SDO_INDEX_METADATA, so it did exist!
    SQL> DROP INDEX TEMPGEOMDATA_IDX ;
    Index supprim�. -- Deleted the temp index, so it did exist!
    SQL> DROP TABLE TEMPGEOMDATA ;
    Table supprim�e. -- Deleted the temp table, so it did exist!
    SQL>
    SQL> SET ECHO OFF
    SQL>
    ===================================================
    Does anyone have a clue?

    Hi,
    As a general rule, whenever using an operator where the query window comes from a table rather than a constructor, try using the ordered hint and put the table that contains the query window (the second geometry in the operator) first in the from clause. You are right in that the table associated with the first geometry must be indexed. This query might be changed to:
    SELECT /*+ ordered */
    v.nom ENS_NOM, v.adresse_numero, v.adresse_rue,
    c.code_insee , c.nom COM_NOM , b.code_centre,
    MDSYS.SDO_NN_DISTANCE(1) DIST
    FROM TEMPGEOMDATA v, limadm_commune c, batsp_cis b
    WHERE v.code_insee = c.code_insee
    AND SDO_NN(b.geometrie, v.geometrie, 'sdo_num_res=1', 1) = 'TRUE' ;
    Hope this helps,
    Dan

Maybe you are looking for