sql18



[Q]          
[A]         analyze   
 Analyze table tablename compute statistics; 
Analyze index indexname estimate statistics; 
ANALYZE TABLE tablename COMPUTE STATISTICS 
     FOR TABLE 
     FOR ALL COLUMNS 
     FOR ALL INDEXES 
     FOR ALL INDEXED COLUMNS; 
  。 
             ,      
Dbms_utility(8i      ) 
Dbms_stats(8i        ) 
  
dbms_stats.gather_schema_stats(ownname=>User,estimate_percent=>100,cascade=> TRUE); 
               
1.       ,    DBMS_STATS,     Analyze  。  
a)        ,     ,  Table  
b)                      。  
c)          Compute Statistics:    ,   ,  ,      
d)            
e)                
2.  DBMS_STATS     
a)    Validate Structure  
b)      CHAINED ROWS,     CLUSTER TABLE   ,         Analyze  。  
c)  DBMS_STATS          Analyze,    Cascade False,       True  
3.    oracle 9   External Table,Analyze    ,    DBMS_STATS     。 
  
[Q]          
[A]  rebuild  ,                  
rebuild           ,                        
    
  alter index index_name rebuild tablespace ts_name 
        storage(……); 
               ,       ,  ,                
SQL> set heading off 
SQL> set feedback off 
SQL> spool d:\index.sql 
SQL> SELECT 'alter index ' || index_name || ' rebuild ' 
||'tablespace INDEXES storage(initial 256K next 256K pctincrease 0);' 
FROM all_indexes 
WHERE ( tablespace_name != 'INDEXES' 
OR next_extent != ( 256 * 1024 ) 
) 
AND owner = USER 
SQL>spool off 
             
alter index index_name coalesce,                leaf block 
    ,                   ,     。