Created
November 10, 2010 21:54
-
-
Save SathyaBhat/671602 to your computer and use it in GitHub Desktop.
Analyze & Compute Oracle Table Statistics & Rebuild & Move indexes to different tablespace
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
SET NEWPAGE 0 PAGESIZE 0 FEEDBACK OFF HEADING OFF | |
spool analyze_rebuild_index.sql | |
SELECT 'ALTER TABLE '||TABLE_NAME|| ' INITRANS 30;' FROM USER_TABLES; | |
SELECT 'ALTER INDEX '||INDEX_NAME|| ' INITRANS 50;' FROM USER_INDEXES; | |
SELECT 'ALTER INDEX '||INDEX_NAME||' REBUILD TABLESPACE INDX ;' FROM USER_INDEXES; | |
SELECT 'ALTER INDEX '||INDEX_NAME|| ' REBUILD;' FROM USER_INDEXES; | |
SELECT 'ANALYZE TABLE '||TABLE_NAME ||' COMPUTE STATISTICS;' FROM USER_TABLES; | |
spool off | |
@analyze_rebuild_index.sql | |
EXECUTE DBMS_STATS.GATHER_SCHEMA_STATS(OWNNAME => :USER_NAME,METHOD_OPT=> 'FOR ALL INDEXED COLUMNS',DEGREE => 8,CASCADE => TRUE); |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment