oracle空间索引创建

--1)、插入空间索引元数据
insert into mdsys.sdo_geom_metadata_table
  (sdo_owner, sdo_table_name, sdo_column_name, sdo_diminfo)
values
  ('GWM_TEST', --索引用户名
   'GS_DYNAMIC_GRID_P', --表名称
   'GWM_GEOMETRY', --空间字段
   mdsys.sdo_dim_array(mdsys.sdo_dim_element('x',
                                             -5000000,
                                             5000000,
                                             0.000005),
                       mdsys.sdo_dim_element('y',
                                             -5000000,
                                             5000000,
                                             0.000005),
                       mdsys.sdo_dim_element('z', 0, 0, 0.000005)));
                      
--2)、查询空间索引元数据,首先要向该视图插入一条记录,确保有一条对应的记录,方可进行第三步
select * from user_sdo_geom_metadata;
--3)、创建空间索引
CREATE INDEX IDX_GS_dynamic_grid_P_SPATIAL ON gs_dynamic_grid_p(gwm_geometry) INDEXTYPE IS MDSYS.SPATIAL_INDEX;

--删除空间索引
drop index IDX_GS_dynamic_grid_P_SPATIAL;
--查询空间索引元数据
select * from mdsys.sdo_geom_metadata_table;
--查询空间索引
select INDEX_NAME,
       TABLE_OWNER,
       TABLE_NAME,
       STATUS,
       ITYP_OWNER,
       ITYP_NAME,
       DOMIDX_STATUS,
       DOMIDX_OPSTATUS
  from user_indexes
where ITYP_NAME is not null;

待续。。。

你可能感兴趣的:(mdsys)