Last active
August 29, 2015 14:07
-
-
Save fljdin/5d38a52461dea9fb778a to your computer and use it in GitHub Desktop.
Workaround ORA-01652 when creating function-based index on partitioned table
This file contains 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
CREATE INDEX &schema.&index_part | |
ON &schema.&table_name(TO_NUMBER(TO_CHAR(TO_DATE(TO_CHAR(&column),'YYYYMMDD'),'IYYYIW'))) | |
LOCAL UNUSABLE; |
This file contains 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
select count(1) | |
from dba_ind_partitions | |
where index_name = '&index_part' and status != 'USABLE'; |
This file contains 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 | |
sql_query VARCHAR2(500); | |
BEGIN | |
FOR r IN ( | |
select rownum, 'alter index '||index_owner||'.'||index_name||' rebuild partition ' || partition_name || ' parallel(degree 4)' query | |
from dba_ind_partitions where index_name = '&index_part' and status != 'USABLE' | |
) | |
LOOP | |
execute immediate r.query; | |
--dbms_output.put_line(r.rownum || ': ' || r.query); | |
END LOOP; | |
END; | |
/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment