【12c新特性】dbms_stats report_gather_auto_stats统计信息报告特性

版本12c中引入了dbms_stats 的一系列report_*  函数,用以在收集统计信息前 向用户汇报预备将执行的统计对象和统计情况。

 

例如report_gather_auto_stats

 

function report_gather_auto_stats (
detail_level varchar2 default ‘TYPICAL’,
format varchar2 default ‘TEXT’)
return clob;

– This procedure runs auto stats gathering job in reporting mode. That is,
– stats are not actually collected, but all the objects that will be
– affected when auto stats gathering is invoked are reported.
– The detail level for the report is defined by the detail_level
– input parameter. Please see the comments for report_single_stats_operation
– on possible values for detail_level and format.

 

具体使用:

 

SQL> variable c clob;
SQL> exec :c:=dbms_stats.report_gather_auto_stats();

PL/SQL procedure successfully completed.

SQL> set long 999

 

SQL> print :c;

C
——————————————————————————–
——————————————————————————–
——————————————————————————–
—————————————
| Id | Operation | Target | Start Time | E
nd Time | Status | Total Tasks | Successful Tasks | Failed Tasks | Active Tasks
|
——————————————————————————–
——————————————————————————–
—————————————
| 1317 | gather_database_stats (auto) (reporting mode) | AUTO | |
| | 187 | | |
|
——————————————————————————–
——————————————————————————–
—————————————
——————————————————————————–
——————————————————————————–
—————————————
|

|
| ——————————————————————————
——————————————————————————–
————————————- |
|
T A S K S
|
| ——————————————————————————
——————————————————————————–
————————————- |
| —————————————————————————
——————————————————————————–
———————————- |
| | Target | Type | Start Tim
e | End Time | Status
| |
| —————————————————————————
——————————————————————————–
———————————- |
| | SYS.BBW | TABLE |