安裝statspack
SQL>connect / as sysdba
SQL>@?/rdbms/admin/spcreate
解除安裝
SQL>connect / as sysdba
SQL>@?/rdbms/admin/spdrop
/*
收集資訊前把timed_statistics = true;
alter system set timed_statistics
= true;
*/
收集資訊
SQL>connect perfstat/perfstat
SQL>execute statspack.snap;
自動收集
SQL>connect
perfstat/perfstat
SQL>@?/rdbms/admin/spauto
刪掉自動收集的job.
SQL>select * from user_jobs;
SQL>exec dbms_job.remove(JOB_ID)
/*
execute
statspack.snap(i_snap_level=>10, i_modify_parameter=>'true');
Levels
= 5 Additional data: SQL Statements
Levels = 6 This level includes all
statistics gathered in the lower level(s).
Levels = 7 segments level statistics
Levels =
10 Additional statistics: Child latches
i_modify_parameter=>'true'/'false' 決定是否儲存level 的值,下一次執行繼續使用
*/
產生報告
SQL>conect perfstat/perfstat
SQL>@?/rdbms/admin/spreport