bypassing the spatial index

Hello

Could someone please answer questions? :

I was reading the book 'Pro Oracle Spatial' and it has the following about phase two of filtering when using space operators:

«In some cases, however, the optimizer to decide to bypass the spatial index.» She then calls the secondary filter (i.e., the function of geometry engine) directly on the rows in the table. (This can happen for various reasons... »

My questions:

(1) where can I find more information on the "variety of patterns" when this happens?

(2) is it possible to force Oracle Spatial not use filter primary and go directly to the secondary filter? The reason why I want to do this is that I'm doing my own prior filtering that corresponds to the primary filter and I have a condition of additional query (with spatial condition), which allows to select only those that are previously filtered.

(3) or is there another Oracle Spatial function exactly like SDO_ANYINTERACT, but applies only the secondary filter (and therefore does not require an spatial index)?

Any help is greatly appreciated.

Upendra

(1) for example, select * tab where c1 = 1 and sdo_anyinteract (...) = "TRUE";

If "c1 = 1" is very selective, say only a single line or for very little is returned.

sdo_anyinteract (...) cannot pass through the spatial index.

(2) you can always use the / * + full * / reference as:

Select / * + full (a) * / * from tab where sdo_anyinteract (...) = "TRUE";

(3) SDO_GEOM. RELATE() seems to be what you are looking for.

Tags: Database

Similar Questions

  • Error creating the Spatial Index for SRID 8307 on newly hardened database

    Oracle 11g Rel2, Windows 2003 platform

    Help, please...

    Meeting with error message:
    ERROR on line 1:
    ORA-29855: an error has occurred in the execution of routine ODCIINDEXCREATE
    ORA-13249: internal error in the Spatial index: [mdidxrbd]
    ORA-13249: geodetic initialization error turn
    ORA-13249: SRID 8307 does not exist in the table MDSYS.CS_SRS
    ORA-29400: data cartridge error
    ORA-04063: package body 'MDSYS. SDO_CS"contains errors
    ORA-06512: at the 'MDSYS. SDO_INDEX_METHOD_10I', line 10

    After running the command

    INSERT INTO USER_SDO_GEOM_METADATA VALUES
    ("PointGeometry",
    "pointGeom,"
    MDSYS.sdo_dim_array (mdsys.sdo_dim_element ('Longitude',-180, 180, 1),
    mdsys.sdo_dim_element('Latitude',-90,90,1)),
    8307
    );

    CREATE the INDEX IDX_POINTGEOMETRY on PointGeometry (pointGeom) indextype is mdsys.spatial_index parameters('LAYER_GTYPE=POINT');

    When I ask mdsys.sdo_cs I see that there are actually SRID 8307. This index was created in this schema without problem. The problem only arises once the hardened customer database and we tried to recreate the schema (and index).

    Probably not coincidentally, I also get error:
    ORA-29855: an error has occurred in the execution of routine ODCIINDEXCREATE
    ORA-04063: package body "CTXSYS. DRIXMD' has errors
    ORA-06508: PL/SQL: called program unit is not found: 'CTXSYS. DRIXMD ".
    ORA-06512: at "CTXSYS. DRUE", line 145
    ORA-06512: at "CTXSYS. TEXTINDEXMETHODS', line 366
    ORA-04063: package body "CTXSYS. DRIXMD' has errors
    ORA-06508: PL/SQL: called program unit is not found: 'CTXSYS. DRIXMD ".

    When attempting to create and index Oracle Text context.

    Your help is greatly appreciated.

    Then, that's the problem.

    MDSYS user now has not run, and select privileges on the dbms_lob package.

    You must grant privileges on this package in MDSYS.

    Note that you can run into other issues of privilege package like this, so you must correct all by the granting of the
    required privileges for MDSYS.

    Siva

  • The details of the max/min for the spatial index

    Hello

    I am new to Oracle Spatial and perhaps this is a stupid question, but when I create an index for a table of geo, I always manually insert a line into the USER_SDO_GEOM_METADATA table. The DIMINFO table contains the bounding box, which are in my case X min/max / coordinated full geo (Lat/Long) of the table.

    The SDO_GEOMETRY column in my table of geo contains some polygons. How can I automatically query the table of geo to return the desired max/min X / Y coordinates? I'm looking for something like maxX (geo_data) SELECT... OF geo_table. Is this possible?

    Thank you!

    Hello Hans,.

    Well, I think that the old gods of Oracle Spatial of ages had intended a workflow by which metadata records were filled with knowledge not stored in the database or the spatial column.  Thus, for example the tolerance whence?  He comes to your head or your documentation that you hold outside the database, etc..  I mean that you put in this recording in order to enter the database.  So I would say that generally metadata was never intended to be created from the data.

    Now, we must know that the values stored in USER_SDO_GEOM_METADATA min/max are largely informative to my knowledge.  You can insert values garbage if you love without worrying much Oracle Spatial.  The only function I can think of who actually reads these values is the MD without papers. HHENCODE (everyone knows others?).  But that being said its always a good idea to avoid the garbage and properly document your spatial layers.

    So, in terms of generation of these values. I would say that your DIMINFO values should ideally include the size of your current data more any new data you could insert as part of your workflow.  So I would not shake this until your min/max values accurate unless your data is very, very static.  It could well be.  Still, usually I if I had a layer of data to the United States mainland that the values that run in the South enough to cover all the Florida keys, etc. (with some tampons too).  Even if I have no data for Florida keys in that exact moment.  It's rather subjective, to deduce the data, it must come from your documentation and your needs.

    But you probably still want something.  Good then, voila.

    SELECT
    a.bef || a.dim_xy || a.dim_3 || a.aft AS dim_info
    FROM (
      SELECT
       'MDSYS.SDO_DIM_ARRAY(' AS bef
      ,'MDSYS.SDO_DIM_ELEMENT(''X'',' || MDSYS.SDO_GEOM.SDO_MIN_MBR_ORDINATE(aa.shape,1) || ',' || MDSYS.SDO_GEOM.SDO_MAX_MBR_ORDINATE(aa.shape,1) || ',0.05)'
       ||
       ',MDSYS.SDO_DIM_ELEMENT(''Y'',' || MDSYS.SDO_GEOM.SDO_MIN_MBR_ORDINATE(aa.shape,2) || ',' || MDSYS.SDO_GEOM.SDO_MAX_MBR_ORDINATE(aa.shape,2) || ',0.05)'
       AS dim_xy
      ,CASE
       WHEN aa.shape.get_dims() > 2
       AND  aa.shape.get_lrs_dim() = 0
       THEN
          ',MDSYS.SDO_DIM_ELEMENT(''Z'',' || MDSYS.SDO_GEOM.SDO_MIN_MBR_ORDINATE(aa.shape,3) || ',' || MDSYS.SDO_GEOM.SDO_MAX_MBR_ORDINATE(aa.shape,3) || ',0.001)'
       ELSE
          NULL
       END AS dim_3
      ,')' AS aft
      FROM (
         SELECT
         MDSYS.SDO_AGGR_MBR(a.shape) AS shape
         FROM
         my_table a
      ) aa
    ) a;
    

    Note again once the tolerances must be hard-coded.

    And also it will not work for the LRS geometries.

    I respect the old gods and not go this route.

    See you soon,.

    Paul

  • Error in the spatial index

    Hello world

    I created a spatial index on a table, but I get the error message:

    ORA-13033: sdo_geometry sdo_elem_info_array data not available

    How can I write a SQL command to delete these unavailable records?

    Hello

    you will find an example with a similar error. Simply, you can validate spatial data, to find the invalid records:

    DROP   TABLE sdo_test;
    
    CREATE TABLE sdo_test (
      nr      NUMBER,
      GEOM     MDSYS.SDO_GEOMETRY);
    
    COMMIT;
    
    --correct
    INSERT INTO sdo_test VALUES (1,
      SDO_GEOMETRY(3302, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1),
        SDO_ORDINATE_ARRAY(-87.899771, 42.000853, 0, -87.899109, 42.000847, 54.8504622)));
    
    --correct
    INSERT INTO sdo_test VALUES (2,
      SDO_GEOMETRY(3302, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1),
        SDO_ORDINATE_ARRAY(-87.917489, 41.992077, 0, -87.917063, 41.99174, 51.4503307)));
    
    --empty SDO_ELEM_INFO_ARRAY
    INSERT INTO sdo_test VALUES (3,
      SDO_GEOMETRY(3302, 8307, NULL,  SDO_ELEM_INFO_ARRAY(),
        SDO_ORDINATE_ARRAY(-87.925704, 41.965994, 0, -87.925705, 41.965445, 60.9789892)));
    
    DELETE FROM USER_SDO_GEOM_METADATA
      WHERE TABLE_NAME = 'SDO_TEST' AND COLUMN_NAME = 'GEOM' ;
    
    INSERT INTO USER_SDO_GEOM_METADATA (TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
      VALUES ('SDO_TEST', 'GEOM',
        MDSYS.SDO_DIM_ARRAY
          (MDSYS.SDO_DIM_ELEMENT('X', -87.925705, -87.8991090, 0.001),
           MDSYS.SDO_DIM_ELEMENT('Y',  41.965445,  41.9654450, 0.001),
           MDSYS.SDO_DIM_ELEMENT('M',    0.00000,  60.9789892, 0.001)
         ),8307);
    
    --DROP   INDEX sdo_test_geom_spix;
    
    --ORA ERROR 13033
    CREATE INDEX sdo_test_geom_spix
              ON sdo_test(geom)
       INDEXTYPE IS MDSYS.SPATIAL_INDEX
    PARAMETERS('sdo_indx_dims=2');
    
    --find the invalid record
    SELECT nr, SDO_GEOM.VALIDATE_GEOMETRY(geom,0.001) val
      FROM sdo_test; 
    
    nr     val
    -----------------------
    1    TRUE
    2    TRUE
    3    13033
    

    Oops - where is the preview in the new design?

    Found while waiting for the syntax highlighting (-> switch to the Advanced Editor, paste your code, mark it, click on the > button (insert), select syntax highlighting, choose style... >)

  • on the SPATIAL index?

    I think, I do something wrong with my creations to index because they are not optimized.
    I have read and read the SPACE double guide of www.oracle.com

    The standard syntax for creating an index space oracle is:

    CREATE the INDEX Idx_name ON schema.table (column GEOMETRY)
    INDEXTYPE IS MDSYS. SPATIAL_INDEX;

    Also, I have to create the table recording: SDO_GEOM_METADATA_TABLE
    (SDO_OWNER, SDO_TABLE_NAME, SDO_COLUMN_NAME, SDO_DIMINFO, SDO_SRID)

    In my case, what I do is, perform an insert with a select, something like:

    Insert into Mdsys.Sdo_Geom_MetaData_Table (SDO_OWNER, SDO_TABLE_NAME, SDO_COLUMN_NAME, SDO_DIMINFO, SDO_SRID)
    (Select 'myOwner', mynewTable', 'GEOMETRY_COLUMN', Sdo_DIMINFO, SDO_SRID)
    Of Mdsys.Sdo_Geom_MetaData_Table
    Where Sdo_Owner = Owner_example
    And Sdo_Table_Name = Table_example;

    Do this, because I'm not 100% sure how to get the values for the column 'SDO_DIMINFO '.
    I was told to get xmin, ymin and xmax, ymax, but even with that, a table named "districts" of only 77 files takes me about 22 seconds (this table has 1 column geometry), I have a table called "places" which has about 600 records and it takes 1 second. (both with the indexes created in the same way).

    What could be wrong?
    What to check?

    Thank you very much.

    Panama,

    [1]

    . . . . Check whether the offending name and contact geometry game:

    SET SERVEROUT ON
    DECLARE
        x1  NUMBER;
        y1  NUMBER;
        x2  NUMBER;
        y2  NUMBER;
        Geom    MDSYS.SDO_GEOMETRY;
    BEGIN
        -- "NOTE: You need to identify the tablename and where-clause"
        SELECT geometry Into Geom FROM  WHERE ;
    
        x1 := Geom.SDO_ORDINATES(1);
        y1 := Geom.SDO_ORDINATES(2);
        x2 := Geom.SDO_ORDINATES(Geom.SDO_ORDINATES.COUNT()-1);
        y2 := Geom.SDO_ORDINATES(Geom.SDO_ORDINATES.COUNT());
        dbms_output.put_line('FromPt '||CHR(9)||'<'||x1||' , '||y1||'>');
        dbms_output.put_line('ToPt '||CHR(9)||'<'||x2||' , '||y2||'>');
    END;
    /
    
    -- "Your FromPt and ToPt should match. If not, the polygon doesn't close"
    

    Because your geometries are simple polygons consisting only of straight lines, you can correct the error by adding the coordinates of FromPt at the end of the table ordered.

    -- "DO NOT RUN THIS UNLESS YOU KNOW THE POLYGON DOESNT CLOSE"
    DECLARE
        x   NUMBER;
        y   NUMBER;
        Geom    MDSYS.SDO_GEOMETRY;
    BEGIN
        -- "NOTE: You need to identify the tablename and where-clause"
        SELECT geometry Into Geom FROM  WHERE ;
    
        x := Geom.SDO_ORDINATES(1);
        y := Geom.SDO_ORDINATES(2);
    
        Geom.SDO_ORDINATES.EXTEND(2);
        Geom.SDO_ORDINATES(Geom.SDO_ORDINATES.COUNT()-1) := x;
        Geom.SDO_ORDINATES(Geom.SDO_ORDINATES.COUNT()) := y;
    
        -- "NOTE: You need to identify the tablename and where-clause"
        UPDATE 
        SET geometry = Geom
        WHERE ;
    
        COMMIT;
    END;
    /
    

    Kind regards
    Noel

    Published by: Christmas Khan on May 4, 2011 13:53
    WARNING added to the second Q & D-small end.

  • Cannot create the spatial index

    It's a little bit of the puzzle for me this one, I made this little time on different system and I do not understand why it's here

    Oracle 11.1.0.7 Windows 64-bit

    We have simple following table:

    CREATE TABLE DASHBOARD. DSGEOEXCEPTION
    (
    GEOIDE NUMBER NOT NULL,
    ZORDER INTEGER DEFAULT 0 NOT NULL.
    HOUSENO VARCHAR2 (100),
    STREET VARCHAR2 (100),
    VARCHAR2 (100) SUBURBAN,.
    CITY VARCHAR2 (100),
    COUNTY OF VARCHAR2 (100),
    DESCRIPTION VARCHAR2 (200),
    MDSYS FORM. SDO_GEOMETRY
    )
    LOGGING
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    NOMONITORING;

    ALTER TABLE DASH. (ADD) DSGEOEXCEPTION
    CONSTRAINT DSGEOEXCEPTION_PK
    KEY ELEMENTARY SCHOOL
    (GEOIDE)) ;



    Insert values (user_sdo_geom_metadata)
    "DASHBOARD. DSGEOEXCEPTION',.
    "FORM."
    MDSYS. () SDO_DIM_ARRAY
    MDSYS. SDO_DIM_ELEMENT ('LONGITUDE',-180, 180, 0.00005),
    MDSYS. SDO_DIM_ELEMENT ('LATITUDE',-90, 90, 0.00005)
    ),
    8307);

    until then, everything is good.

    I run the two sql suite to ensure that everything is fine

    Select * from USER_SDO_GEOM_METADATA;
    Dashboard. DSGEOEXCEPTION, shape, ((LONGITUDE,-180, 180, 5E-5), (LATITUDE, -90, 90, 5th-5),), 8307
    select * from mdsys.sdo_geom_metadata_table
    DASHBOARD, dashboard. DSGEOEXCEPTION, shape, ((LONGITUDE,-180, 180, 5E-5), (LATITUDE, -90, 90, 5th-5),), 8307
    select * from ALL_SDO_GEOM_METADATA;


    first 2 return one row as planned last returns nothing

    creating the index

    CREATE INDEXES DASH. DSGEOEXCEPTION_SIDX ON DASHBOARD. DSGEOEXCEPTION
    (FORM)
    INDEXTYPE IS MDSYS. SPATIAL_INDEX
    NOPARALLEL;

    or

    CREATE INDEXES DASH. DSGEOEXCEPTION_SIDX ON DASHBOARD. DSGEOEXCEPTION
    (FORM)
    INDEXTYPE IS MDSYS. SPATIAL_INDEX;


    fails with the error:

    ORA-29855: an error has occurred in the execution of routine ODCIINDEXCREATE
    ORA-13203: cannot read the notice USER_SDO_GEOM_METADATA
    ORA-13203: cannot read the notice USER_SDO_GEOM_METADATA
    ORA-06512: at the 'MDSYS. SDO_INDEX_METHOD_10I', line 10



    According to one of the posts, I run this

    ALTER session set current_schema = MDSYS;
    @$ORACLE_HOME/md/admin/prvtgmd.plb

    but no difference I can always create index


    Any suggestions?

    Please, try the following:

    Insert values (user_sdo_geom_metadata)
    "DSGEOEXCEPTION,"
    "FORM."
    MDSYS. () SDO_DIM_ARRAY
    MDSYS. SDO_DIM_ELEMENT ('LONGITUDE',-180, 180, 0.00005),
    MDSYS. SDO_DIM_ELEMENT ('LATITUDE',-90, 90, 0.00005)
    ),
    8307);

  • How to create Spatial indexes in SQL Developer Data Modeler 4

    Hello

    What is the procedure to create a Spatial index in SDDM v4? I found myself at an impasse because of the following problems:

    (1) retro-engineering rate the spatial index, then I need to add them manually.

    (2) adding an index does not allow me to check the 'spatial', and does not allow me to add the sdo_geometry column in the index definition.

    (3) for the registration of the spatial properties for a table, I can not choose the name of the Spatial Index.

    I came across an old post (Data Modeler - cannot create a spatial index), but this post is no longer valid because SDDM V4 does not allow me to create an index without columns (definition of the incomplete index).

    Help is appreciated,

    Kind regards

    Richard.

    Hi Richard,

    Thanks for your update.  I'm scared, I was assuming you were using the stand alone rather than SQL Developer Data Modeler.

    I tried using SQL Developer 4.1.0.18.37 (ai2) using a thin connection and got the ClassCastException you have found.

    But when I used ai2 autonomous, maker of data using the same login details 'Advanced', it worked OK and imported from the spatial index.

    (I'm puzzled as to why these two seem to behave differently, as this is the version ai2 data integrated with SQL Developer ai2 maker).

    I then plugged and reverse engineering the same tables (yet) in a new model.

    Funny is that there is no error in the external journal this time, but the spatial properties are still not retroconcues correctly.

    Is it possible that you have not set the option to import the spatial properties?  I expect that the spatial properties would be imported or that the error should be registered.

    SQL Developer ai2 imported properly the spatial properties and the spatial index, when I used a basic connection and specified host, port, and SID or Service name.

    Another issue: SQL Developer relies on a certain JDK / JDBC library?

    Any Java JDK 1.8 should be good.

    David

  • spatial index

    I have a spatial table with an index on the geometry column.

    If I truncate the spatial table and then insert new spatial data into the table I have to delete and then recreate the spatial index?

    No, the spatial index is automatically maintained.

  • spatial index and normal index

    Hi space specialists,.

    I have a question for spatial index performance and how Oracle manages queries that have a space and regular condition combined. We are on the Oracle 10 g Enterprise Edition Release 10.2.0.4.0 database

    Take a query like this one (not a real query but based on the type of query that is generated by ArcGIS):

    Select objectid

    attribute

    geometry

    table

    where mdsys.sdo_filter (geometry, mdsys.sdo_geometry (: gtype1,: srid1, null,: elem_info1,: ordinates1), 'querytype = window') = 'TRUE '.

    and attribute = value

    In our scenario, we have a lot of rows in the table (2 million), but we have only a few lines (2000) where attribute = value.

    It seems that there is a scenario where the performance is really bad. It takes 5 seconds for the query to return the results and you're just too slow for our needs. There is a spatial index on a geometry and a normal index on the field for the attribute. The plan of the explain command shows that both the spatial index and the index of the attribute are used.

    Of course, we can break to the top of the table in separate tables by object type. This would make the index space datamodel much more efficient, but at the expense of our current simple, abstract.

    Do you have suggestions on how we can improve performance without too much impact on our datamodel? Oracle for example has an option where you can create a spatial index on a subset of the data in a table?

    Thank you!

    Rob

    Do not know whether or not the following works for your case:

    use the column range-key attribute to create a partitioned table Beach and then create a local spatial index.

  • Not the rows returned by the spatial query wrapped in SELECT * FROM...

    Hello

    When you run a query with SDO_EQUAL sub, I get a very strange behavior. The SDO_EQUAL query on its own works very well, but if I wrap in SELECT * from there, I get no results. If I wrap SDO_ANYINTERACT in SELECT * from there, I get the expected result.

    It seems like the spatial index is used during the execution of the ordinary, but not when SDO_EQUAL request wrapped in SELECT * FROM. Weird. The spatial index is also not used when SDO_ANYINTERACT is wrapped in SELECT * FROM... so I don't know why that returns the correct answer.

    I get this problem on 11.2.0.2 on Red Hat Linux 64-bit and 11.2.0.1 on Windows XP 32-bit (i.e., all versions of 11g I've tried). The query works as expected on 10.2.0.5 on Windows Server 2003 64-bit.

    Any ideas?

    Confused in Dublin (John)

    Test case...
    SQL> 
    SQL> -- Create a table and insert the same geometry twice
    SQL> DROP TABLE sdo_equal_query_test;
    
    Table dropped.
    
    SQL> CREATE TABLE sdo_equal_query_test (
      2  id NUMBER,
      3  geometry SDO_GEOMETRY);
    
    Table created.
    
    SQL> 
    SQL> INSERT INTO sdo_equal_query_test VALUES (1,
      2  SDO_GEOMETRY(3003, 81989, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1),
      3  SDO_ORDINATE_ARRAY(1057.39, 1048.23, 4, 1057.53, 1046.04, 4, 1057.67, 1043.94, 4, 1061.17, 1044.60, 5, 1060.95, 1046.49, 5, 1060.81, 1047.78, 5, 1057.39, 1048.23, 4)));
    
    1 row created.
    
    SQL> 
    SQL> INSERT INTO sdo_equal_query_test VALUES (2,
      2  SDO_GEOMETRY(3003, 81989, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1),
      3  SDO_ORDINATE_ARRAY(1057.39, 1048.23, 4, 1057.53, 1046.04, 4, 1057.67, 1043.94, 4, 1061.17, 1044.60, 5, 1060.95, 1046.49, 5, 1060.81, 1047.78, 5, 1057.39, 1048.23, 4)));
    
    1 row created.
    
    SQL> 
    SQL> -- Setup metadata
    SQL> DELETE FROM user_sdo_geom_metadata WHERE table_name = 'SDO_EQUAL_QUERY_TEST';
    
    1 row deleted.
    
    SQL> INSERT INTO user_sdo_geom_metadata VALUES ('SDO_EQUAL_QUERY_TEST','GEOMETRY',
      2  SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', 0, 100000, .0001), SDO_DIM_ELEMENT('Y', 0, 100000, .0001), SDO_DIM_ELEMENT('Z', -100, 4000, .0001))
      3  ,81989);
    
    1 row created.
    
    SQL> 
    SQL> -- Create spatial index
    SQL> DROP INDEX sdo_equal_query_test_spind;
    DROP INDEX sdo_equal_query_test_spind
               *
    ERROR at line 1:
    ORA-01418: specified index does not exist
    
    
    SQL> CREATE INDEX sdo_equal_query_test_spind ON sdo_equal_query_test(geometry) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    
    Index created.
    
    SQL> 
    SQL> -- Ensure data is valid
    SQL> SELECT sdo_geom.validate_geometry_with_context(sdo_cs.make_2d(geometry), 0.0001) is_valid
      2  FROM sdo_equal_query_test;
    
    IS_VALID
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    TRUE
    TRUE
    
    2 rows selected.
    
    SQL> 
    SQL> -- Check query results using sdo_equal
    SQL> SELECT b.id
      2  FROM sdo_equal_query_test a, sdo_equal_query_test b
      3  WHERE a.id = 1
      4  AND b.id != a.id
      5  AND sdo_equal(a.geometry, b.geometry) = 'TRUE';
    
            ID
    ----------
             2
    
    1 row selected.
    
    SQL> 
    SQL> -- Check query results using sdo_equal wrapped in SELECT * FROM
    SQL> -- Results should be the same as above, but... no rows selected
    SQL> SELECT * FROM (
      2       SELECT b.id
      3       FROM sdo_equal_query_test a, sdo_equal_query_test b
      4       WHERE a.id = 1
      5       AND b.id != a.id
      6       AND sdo_equal(a.geometry, b.geometry) = 'TRUE'
      7  );
    
    no rows selected
    
    SQL> 
    SQL> -- So that didn't work.  Now try sdo_anyinteract... this works ok
    SQL> SELECT * FROM (
      2       SELECT b.id
      3       FROM sdo_equal_query_test a, sdo_equal_query_test b
      4       WHERE a.id = 1
      5       AND b.id != a.id
      6       AND sdo_anyinteract(a.geometry, b.geometry) = 'TRUE'
      7  );
    
            ID
    ----------
             2
    
    1 row selected.
    
    SQL> 
    SQL> -- Now try a scalar query
    SQL> SELECT * FROM (
      2       SELECT b.id
      3       FROM sdo_equal_query_test a, sdo_equal_query_test b
      4       WHERE a.id = 1
      5       AND b.id != a.id
      6  );
    
            ID
    ----------
             2
    
    1 row selected.
    
    SQL> spool off
    Here is the plan of the explain output for the query that works. Note that the spatial index is used.
    SQL> EXPLAIN PLAN FOR
      2  SELECT b.id
      3  FROM sdo_equal_query_test a, sdo_equal_query_test b
      4  WHERE a.id = 1
      5  AND b.id != a.id
      6  AND sdo_equal(a.geometry, b.geometry) = 'TRUE';
    
    Explained.
    
    SQL> @?/rdbms/admin/utlxpls.sql
    
    PLAN_TABLE_OUTPUT
    ------------------------------------------------------------------------------------------------------------
    Plan hash value: 3529470109
    
    ------------------------------------------------------------------------------------------------------------
    | Id  | Operation                     | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
    ------------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT              |                            |     1 |  7684 |     3   (0)| 00:00:01 |
    |   1 |  RESULT CACHE                 | f5p63r46pbzty4sr45td1uv5g8 |       |       |            |       |
    |   2 |   NESTED LOOPS                |                            |     1 |  7684 |     3   (0)| 00:00:01 |
    |*  3 |    TABLE ACCESS FULL          | SDO_EQUAL_QUERY_TEST       |     1 |  3836 |     3   (0)| 00:00:01 |
    |*  4 |    TABLE ACCESS BY INDEX ROWID| SDO_EQUAL_QUERY_TEST       |     1 |  3848 |     3   (0)| 00:00:01 |
    |*  5 |     DOMAIN INDEX              | SDO_EQUAL_QUERY_TEST_SPIND |       |       |     0   (0)| 00:00:01 |
    ------------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       3 - filter("B"."ID"!=1)
       4 - filter("A"."ID"=1 AND "B"."ID"!="A"."ID")
       5 - access("MDSYS"."SDO_EQUAL"("A"."GEOMETRY","B"."GEOMETRY")='TRUE')
    ..... other stuff .....     
    Here is the plan of the explain output for the query is not working. Note that the spatial index is not used.
    SQL> EXPLAIN PLAN FOR
      2  SELECT * FROM (
      3     SELECT b.id
      4     FROM sdo_equal_query_test a, sdo_equal_query_test b
      5     WHERE a.id = 1
      6     AND b.id != a.id
      7     AND sdo_equal(a.geometry, b.geometry) = 'TRUE'
      8  );
    
    Explained.
    
    SQL> @?/rdbms/admin/utlxpls.sql
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------
    Plan hash value: 1024466006
    
    --------------------------------------------------------------------------------------------------
    | Id  | Operation           | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT    |                            |     1 |  7684 |     6   (0)| 00:00:01 |
    |   1 |  RESULT CACHE       | 2sd35wrcw3jr411bcg3sz161f6 |       |       |            |          |
    |   2 |   NESTED LOOPS      |                            |     1 |  7684 |     6   (0)| 00:00:01 |
    |*  3 |    TABLE ACCESS FULL| SDO_EQUAL_QUERY_TEST       |     1 |  3836 |     3   (0)| 00:00:01 |
    |*  4 |    TABLE ACCESS FULL| SDO_EQUAL_QUERY_TEST       |     1 |  3848 |     3   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       3 - filter("B"."ID"!=1)
       4 - filter("A"."ID"=1 AND "B"."ID"!="A"."ID" AND
                  "MDSYS"."SDO_EQUAL"("A"."GEOMETRY","B"."GEOMETRY")='TRUE')
    ..... other stuff .....               

    Yes, this is the bug 9740355. You can get a 11.2.0.1 patch, or wait for 11.2.0.3.

  • Problem in creating Spatial indexes

    Hello

    I am creating the Spatial index on my service. In vain.

    I created the function:

    create or replace
    FUNCTION VRAT_GEOMETRII (NUMBER obj_id)
    MDSYS RETURN. SDO_GEOMETRY
    DETERMINISTIC
    as
    MDSYS test1. SDO_GEOMETRY;
    Mt VARCHAR2 (32767).
    BEGIN
    MT: =' SELECT SDO_PC_PKG. () TO_GEOMETRY
    points,
    num_points,
    3) from pc_blktab2 WHERE obj_id =' | OBJ_ID;
    EXECUTE IMMEDIATE Mt INTO test1;
    Test1 RETURN;
    END;

    Updated metadata to update:
    INSERT INTO user_sdo_geom_metadata)
    TABLE_NAME,
    COLUMN_NAME,
    DIMINFO,
    SRID)
    VALUES)
    "PC_BLKTAB2,"
    ' st_mkara. VRAT_GEOMETRII (obj_id)',
    () SDO_DIM_ARRAY
    SDO_DIM_ELEMENT ('X', 930000000,1200000000, 10),
    SDO_DIM_ELEMENT('Y',420000000,930000000,10),
    SDO_DIM_ELEMENT ('Z', 0,1600000, 10)
    ),
    NULL - SRID VALUE
    );

    and I want to create the spatial index:

    CREATE INDEX test_blok3_idx
    ON PC_BLKTAB2 (VRAT_GEOMETRII (obj_id))
    INDEXTYPE IS MDSYS. SPATIAL_INDEX;

    but these errors:

    Error report:
    SQL error: ORA-29855: error when executing routine ODCIINDEXCREATE
    ORA-13249: internal error in the Spatial index: [mdidxrbd]
    ORA-13249: error in the Spatial index: index build failed
    ORA-13249: error in the spatial index: [mdrcrtxfergm]
    ORA-13249: error in the spatial index: [mdpridxtxfergm]
    ORA-29400: data cartridge error
    ORA-01422: exact fetch returns more than number of lines
    ORA-06512: at "ST_MKARA. VRAT_GEOMETRII', line 12
    ORA-06512: at the 'MDSYS. SDO_INDEX_METHOD_10I', line 10
    29855 00000 - "an error occurred in the execution of routine ODCIINDEXCREATE.
    * Cause: Cannot run the ODCIIndexCreate routine.
    * Action: Check if the routine was coded correctly.

    Thanks for help

    Kirin

    This looks like a problem in your function.
    Make sure that you run this function successfully for each obj_id.
    Looks for some obj_id SQL inside your function is a failure (returns more than one line).

    Siva

  • Cannot create spatial indexes in Oracle 11 g

    Hi all!
    I'm using Oracle 11 g 2 on Windows 2008 (64bitxR2). When I get errors when I create Spatial Index oracle11g2, but it works well with Oracle 10 g. I don't know what I did wrong, or do I need a fix for Oracle Spatial 11 g 2?
    Can you help me? Thanks for any help!


    ORA-29858: an error has occurred in the execution of the routine ODCIINDEXALTER
    ORA-29400: data cartridge error
    ORA-01403: no data found
    ORA-13249: internal error in the Spatial index: [mdidxrbd]
    ORA-13249: error in the Spatial index: index build failed
    ORA-13249: error in the spatial index: [mdrcrtxfergm]
    ORA-13249: error in the spatial index: [mdpridxtxfergm]
    ORA-13200: internal error [ROWID:AAAUmYAAIAAAJuFAAB] in space indexering.
    ORA-13206: [] internal error creating the spatial index
    ORA-13033: invalid data in the SDO_ELEM_INFO_ARRAY in the SDO_GEOMETRY object
    ORA-06512: vid 'MDSYS. SDO_INDEX_METHOD_10I', line 313

    DELETE FROM mdsys.sdo_coord_ref_system WHERE srid = 50632625;
    DELETE FROM mdsys.sdo_coord_op_param_vals WHERE coord_op_id = 50632625;
    DELETE FROM mdsys.sdo_coord_ops WHERE coord_op_id = 50632625;

    -COORD_OP_METHOD_ID = 9807: Transverse Mercator
    INSERT MDSYS. () SDO_COORD_OPS
    COORD_OP_ID, COORD_OP_NAME, COORD_OP_TYPE, COORD_OP_METHOD_ID.
    INFORMATION_SOURCE, DATA_SOURCE,
    SHOW_OPERATION, IS_LEGACY, IS_IMPLEMENTED_REVERSE, IS_IMPLEMENTED_FORWARD, REVERSE_OP)
    values)
    50632625, ' ST_74_0_GON_65: op-1 ', 'CONVERSION', 9807,.
    "Digpro AB, [email protected],"Digpro AB. "
    1, 'FALSE', 1, 1, 1);

    -Setting for the latitude of origin (0)
    INSERT MDSYS. () SDO_COORD_OP_PARAM_VALS
    COORD_OP_ID, COORD_OP_METHOD_ID, PARAMETER_ID, PARAMETER_VALUE, PARAM_VALUE_FILE_REF, UOM_ID)
    VALUES (50632625, 9807, 8801 0.000000, 9102, NULL);

    -Setting for east central meridian 18 ° 03' 28,044 "
    INSERT MDSYS. () SDO_COORD_OP_PARAM_VALS
    COORD_OP_ID, COORD_OP_METHOD_ID, PARAMETER_ID, PARAMETER_VALUE, PARAM_VALUE_FILE_REF, UOM_ID)
    VALUES (50632625, 9807, 8802, 18.05779, NULL, 9102);

    -Setting for the scale factor
    INSERT MDSYS. () SDO_COORD_OP_PARAM_VALS
    COORD_OP_ID, COORD_OP_METHOD_ID, PARAMETER_ID, PARAMETER_VALUE, PARAM_VALUE_FILE_REF, UOM_ID)
    VALUES (50632625, 9807, 8805, 0.99999425, NULL, 9201);

    -Setting for abscissa
    INSERT MDSYS. () SDO_COORD_OP_PARAM_VALS
    COORD_OP_ID, COORD_OP_METHOD_ID, PARAMETER_ID, PARAMETER_VALUE, PARAM_VALUE_FILE_REF, UOM_ID)
    VALUES (50632625, 9807, 8806, 100178.1808, NULL, 9001);

    -Setting for fictitious ordinate
    INSERT MDSYS. () SDO_COORD_OP_PARAM_VALS
    COORD_OP_ID, COORD_OP_METHOD_ID, PARAMETER_ID, PARAMETER_VALUE, PARAM_VALUE_FILE_REF, UOM_ID)
    VALUES (50632625, 9807, 8807,-6500614.7836, NULL, 9001);

    -Adds the system projected on top the geodetic system in rt90_dp_geosystem_102.sql
    -COORD_SYS_ID = 4400: CS Cartesian Axes. 2D: abscissa, ordinate (E, N). Directions: East, North. Unit of measure: m.
    -GEOG_CRS_DATUM_ID = 4619: SWEREF99
    INSERT MDSYS. () SDO_COORD_REF_SYSTEM
    SRID, COORD_REF_SYS_NAME, COORD_REF_SYS_KIND, COORD_SYS_ID.
    DATUM_ID, GEOG_CRS_DATUM_ID, SOURCE_GEOG_SRID, PROJECTION_CONV_ID.
    CMPD_HORIZ_SRID, CMPD_VERT_SRID, INFORMATION_SOURCE,
    DATA_SOURCE, IS_LEGACY, LEGACY_CODE, LEGACY_WKTEXT, LEGACY_CS_BOUNDS,
    IS_VALID, SUPPORTS_SDO_GEOMETRY)
    VALUES)
    50632625,'ST_74_0_GON_65:-1 ', 'PROJECTION', 4400,.
    NULL, 6619, 4619, 50632625,.
    NULL, NULL, 'Digpro AB, [email protected],
    'Digpro AB', 'FALSE', NULL, NULL, NULL,
    "TRUE", "TRUE");

    sqlplus kranskom/password
    -Update the metadata for the KRANSKOM schema
    Insert values (user_sdo_geom_metadata)
    "BOUCHIHAB", "SHAPE", HE SAID.
    () mdsys.sdo_dim_array
    MDSYS.sdo_dim_element ('Y',-100000, 200000, 0.0005).
    MDSYS.sdo_dim_element ('X',-100000, 200000, 0.0005),
    MDSYS.sdo_dim_element ('Z', -1000, 1000, 0.0005)
    ), 50632625
    );

    -Display content in column form (in the table GRAG)
    Insert into GRAG (SHAPE) values (MDSYS. SDO_GEOMETRY (3003,50632625, 'null', MDSYS. SDO_ELEM_INFO_ARRAY (1,5,1,1,2,1), MDSYS. SDO_ORDINATE_ARRAY(276.2339,-179.7433,0,276.2498,-179.7361,0,276.2668,-179.7324,0,276.2842,-179.7325,0,276.6235,-179.7691,0,276.793,-179.7731,0,276.8055,-179.772,0,276.8174,-179.7682,0,276.8281,-179.7619,0,277.073,-179.5793,0,277.2068,-179.4543,0,277.2122,-179.4481,0,277.2162,-179.4408,0,277.2186,-179.4329,0,277.2192,-179.4247,0,277.2159,-179.3107,0,277.3184,-178.9335,0,277.3252,-178.6913,0,277.3265,-178.5765,0,277.3258,-178.5683,0,277.3237,-178.5604,0,277.3201,-178.5531,0,277.3152,-178.5465,0,277.3092,-178.541,0,277.3023,-178.5366,0,277.2947,-178.5337,0,277.2867,-178.5321,0,277.1778,-178.5219,0,277.1731,-178.5219,0,277.1683,-178.5227,0,277.1637,-178.5244,0,277.1595,-178.5268,0,277.1558,-178.5299,0,277.1527,-178.5336,0,277.1503,-178.5378,0,277.1486,-178.5424,0,277.1478,-178.5471,0,277.1478 ,-178.5519,0,277.1536,-178.6151,0,277.1537,-178.6198,0,277.1529,-178.6244,0,277.1515,-178.6289,0,277.0012,-178.9885,0,276.9919,-179.0066,0,276.9797,-179.023,0,276.9651,-179.0373,0,276.2832,-179.6059,0,276.2804,-179.6079,0,276.2773,-179.6093,0,276.274,-179.6101,0,276.2706,-179.6103,0,276.2673,-179.61,0,276.264,-179.609,0,276.2609,-179.6075,0,276.2582,-179.6054,0,276.2559,-179.6029,0,276.2541,-179.6001,0,276.2528,-179.5969,0,276.252,-179.5935,0,276.2476,-179.5581,0,276.247,-179.5555,0,276.2459,-179.5529,0,276.2444,-179.5506,0,276.2425,-179.5485,0,276.2402,-179.5469,0,276.2377,-179.5456,0,276.235,-179.5449,0,276.2322,-179.5446,0,276.2294,-179.5449,0,276.2267,-179.5456,0,276.2242,-179.5468,0,276.2219,-179.5485,0,276.22,-179.5505,0,276.0132,-179.8127,0,276.0105,-179.8169,0,276.0086,- 179.8215,0,276.0076,-179.8263,0,276.0074,-179.8312,0,276.0082,-179.8361,0,276.0099,-179.8408,0,276.0124,-179.845,0,276.0157,-179.8488,0,276.0196,-179.8518,0,276.0239,-179.8541,0,276.0287,-179.8556,0,276.0336,-179.8562,0,276.0385,-179.8558,0,276.0433,-179.8546,0,276.0478,-179.8525,0,276.2339,-179.7433,0)));

    If the 2D, the value of 2002 data. otherwise assign 3002.

    Siva

  • Data Modeler - cannot create a spatial index

    Good day, colleagues!

    I have a version 584 of the Modeler of Dala.

    Here is her quote Guide of Modeler of Oracle SQL Developer data:

    "Properties of spatial definition 3.82.
    ...
    Benchmark ID: Value Oracle Spatial SRID. ...
    + Create Spatial Index: Determines if a spatial index is created. +
    Name of the spatial Index: name of the spatial index.
    ..."

    I have a SDO_GEOMETRY column in my table and want to create the spatial index.

    The problem is that there is no option "Create Spatial Index" in my space definition properties window. There is only 'The Spatial Index name' option. When I am creating the spatial index manually, I can't, because the option 'Space' for index creation is not active. I checked the table option 'Save as space Table', but it also did not help.

    So, I have no way to create a spatial index. How can I do?

    Hello usamytch,

    create spatial index is confusing. We will improve it in future releases. Here are the steps:
    (1) creation of index - no need to add columns
    (2) create the spatial column definition ('space properties' in the dialog table)
    (3) in the definition of the spatial column, you can select the size of the spatial column, coordinate ID system, and you can select one of the existing indexes to be used as a space.
    (4) after this index appear as space and you can define the spatial properties in the index dialog box
    (5) you must check 'Save as space Table' in order to get meta-space data generated by DDL

    There are additional space properties, that you can set in the physical model.

    Philippe

  • run immideate Create spatial index

    I can't create a spatial index in the package when using
    run immideate

    declare

    l_res varchar2 (500);
    Start
    l_res: = ' CREATE INDEXES INDXSDO1_elements
    (GEOMETRY)
    INDEXTYPE IS MDSYS. SPATIAL_INDEX';

    immediately run l_res;
    end;

    I get an exception:

    ORA-29855: an error has occurred in the execution of routine ODCIINDEXCREATE
    ORA-13249: internal error in the Spatial index: [mdidxrbd]
    ORA-13249: error in the Spatial index: index build failed
    ORA-13249: error in R-tree: [mdrcrtscrt]
    ORA-13231: unable to create the index table [$MDRT_FC41] creating R-tree
    ORA-13249: Stmt-run failure: CREATE TABLE 'GMT_TECH '. MDRT_FC41$ (NUMBER, NUMBER OF NODE_LEVEL, BLOB INFO NODE_ID) LOB (INFO) STORE (CACHE) AS NOLOGGING PCTFREE 2
    ORA-29400: data cartridge error
    ORA-01031: insufficient privileges
    ORA-06512: at the 'MDSYS. SDO_INDEX_METHOD_10I', line 10
    ORA-06512: at "GMT_TECH. REBUILDINDEX", line 66
    ORA-06512: at line 3 level

    Why does this happen?
    I can create indexes without immediate execution

    CREATE the INDEX INDXSDO1_elements
    (GEOMETRY)
    INDEXTYPE IS MDSYS. SPATIAL_INDEX


    Thank you!

    Have you granted 'create table' and "create sequence" for the user? To do this explicitly rather than by a role.

  • Spatial index on a Partition from the list?

    Hello

    Environment:
    10g, SUSE Linux.

    Question:
    Spatial indexing can do on list go?
    (We can do on the beach of Partitions).




    Thank you
    Sean

    No, this is not yet supported.

    Siva

Maybe you are looking for

  • Windows 10 display problem

    Hello experts! I am running mac v10.11.4 and vmware 8.0.1 and I installed windows 10 on vmware but when I run windows, its very bad display and keep a space between the edge and the resolution is very bad and I checked the display resolution that is

  • Password administrator or power on password

    Help me please guys administrator password or power on password disabled sistem 52677428

  • Windows XP Professional blue screen/loop

    I have a computer that I had difficulty. It has Windows XP Professional. As it starts, it passes POST, however it stops during the BIOS. And the start-up process in a loop. Before the loop is executed at the beginning, I'm able to see a flash of blue

  • See the Playlist length while playing music

    Hey everybody, What really annoys me about the Media Player, it's that I do not see how long my playlist will run while the songs play already.You can see the length of the playlist in the media library in the upper right corner in the title of the a

  • Windows 7 does not recognize or play DVDs in the player

    I have a Toshiba Satellite C655D under Windows 7 Home Premium.  A few months ago, I noticed that some DVD would not play on my DVD player, but others.  At first I thought it was just the DVD that I was getting their local library and the other that I