After a period of study, I will now share my experience on the establishment of spatial indexes as follows. If the data is imported from someone else's library, if a space index was previously built, then you need to delete it to establish your own spatial index (otherwise it will be easy to make an error), if it is entirely your own data, or before you have not established a spatial index that can be directly established.
First, the query to determine whether the data has been established corresponding spatial metadata
SELECT * from User_sdo_geom_metadata t where t.sdo_table_name like '% table name% ';
If there is a connection with your watch, please delete it.
SELECT * from User_ind_columns t where t.index_name= ' index name ';
Then the spatial index can be established, and the spatial metadata is established first, and the statement is as follows.
INSERT into Mdsys.sdo_geom_metadata_table (Sdo_owner,sdo_table_name,sdo_column_name,sdo_diminfo,sdo_srid)
VALUES (' Table space ', ' table name ', ' GEOM ' (space field name) ',
Mdsys. Sdo_dim_array
(Mdsys. Sdo_dim_element (' X ', -180.0, 180.0, 0.00005),
Mdsys. Sdo_dim_element (' Y ', -90.0,90.0, 0.00005)
),
NULL);
Establishes user metadata.
INSERT into User_sdo_geom_metadata (table_name, COLUMN_NAME, Diminfo, SRID)
VALUES (' table name ', ' Real_geom (space field name) ',
Mdsys. Sdo_dim_array
(Mdsys. Sdo_dim_element (' X ', -180, 180, 0.00000000050),
Mdsys. Sdo_dim_element (' Y ', -90, N, 0.00000000050)),
NULL);
Create an index
CREATE index index name on table name (field name) Indextype is Mdsys. Spatial_index;
If you cannot create a success, the general situation is that the previous library results have already created the space index, just to delete the previously indexed items.