oracle 分析语句

来源:互联网 发布:绿标网址域名防红跳转 编辑:程序博客网 时间:2024/06/05 00:19

 
Exec dbms_stats.gather_schema_stats(ownname=>'用户名称',estimate_percent=>100,cascade=> TRUE, degree =>12);


    含义解释 ownname:填写需要分析的用户(该用户下所有表都将被分析)
              estimate_percent:分析抽样的力度
              cascade:是否对索引进行分析
              degree:并行处理的cpu数量

对单个表做分析推荐使用 analyze table 表名 compute statistics;(将会把表下的索引一起分析) 对单个索引进行分析推荐使用 analyze index 索引名 compute statistics;



当然对单个表或者索引的分析也可以采用

        dbms_stats.gather_index_stats
dbms_stats.gather_table_stats
(exec dbms_stats.gather_table_stats(ownname=>'hbsps',tabname=>'fail_reason',estimate_percent=>100,cascade=> TRUE);
)