Created
June 19, 2014 15:18
-
-
Save lud/e40ee6288a1e72cd3baf to your computer and use it in GitHub Desktop.
Recreate Oracle Spatial indexes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE | |
TYPE curs IS REF CURSOR; | |
c curs; | |
q varchar2(200); | |
idx VARCHAR(200); | |
tab VARCHAR(200); | |
col VARCHAR(200); | |
BEGIN | |
q := 'select index_name,table_name,column_name from user_sdo_index_info'; | |
OPEN c FOR q; | |
LOOP | |
FETCH c into idx,tab,col; | |
EXIT WHEN c%NOTFOUND; | |
SYS.dbms_output.put('Supression de l''index ' || idx || ' sur ' || tab); | |
execute immediate 'drop index ' || idx; | |
SYS.dbms_output.put_line(' ok'); | |
SYS.dbms_output.put('Création de l''index ' || idx || ' sur ' || tab); | |
execute immediate 'create index ' || idx || ' on ' || tab || '(' || col || ') INDEXTYPE IS mdsys.spatial_index'; | |
SYS.dbms_output.put_line(' ok'); | |
END LOOP; | |
CLOSE c; | |
END; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment