- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
3#
发表于 2014-8-19 10:43:18
- key point 9hfkh0vxd9wq0
- select plan_table_output from table (dbms_xplan.display_awr('9hfkh0vxd9wq0',null,null,'ADVANCED+PEEKED_BINDS'));
- SELECT *
- FROM (SELECT '1.v$sql'||'实例号:'||GV$SQL.inst_id source,
- SQL_ID,
- plan_hash_value,
- TO_CHAR (FIRST_LOAD_TIME) begin_time,
- '在cursor cache中' end_time,
- executions "No. of exec",
- (buffer_gets / executions) "LIO/exec",
- (cpu_time / executions / 1000000) "CPUTIM/exec",
- (elapsed_time / executions / 1000000) "ETIME/exec",
- (disk_reads / executions) "PIO/exec",
- (ROWS_PROCESSED / executions) "ROWs/exec"
- FROM Gv$SQL
- WHERE sql_id = '9hfkh0vxd9wq0'
- UNION ALL
- SELECT '2.sqltuning set' source,
- sql_id,
- plan_hash_value,
- 'JUST SQLSET NO DATE' begin_time,
- 'JUST SQLSET NO DATE' end_time,
- EXECUTIONS "No. of exec",
- (buffer_gets / executions) "LIO/exec",
- (cpu_time / executions / 1000000) "CPUTIM/exec",
- (elapsed_time / executions / 1000000) "ETIME/exec",
- (disk_reads / executions) "PIO/exec",
- (ROWS_PROCESSED / executions) "ROWs/exec"
- FROM dba_sqlset_statements
- WHERE SQL_ID = '9hfkh0vxd9wq0'
- UNION ALL
- SELECT '3.dba_advisor_sqlstats' source,
- sql_id,
- plan_hash_value,
- 'JUST SQLSET NO DATE' begin_time,
- 'JUST SQLSET NO DATE' end_time,
- EXECUTIONS "No. of exec",
- (buffer_gets / executions) "LIO/exec",
- (cpu_time / executions / 1000000) "CPUTIM/exec",
- (elapsed_time / executions / 1000000) "ETIME/exec",
- (disk_reads / executions) "PIO/exec",
- (ROWS_PROCESSED / executions) "ROWs/exec"
- FROM dba_sqlset_statements
- WHERE SQL_ID = '9hfkh0vxd9wq0'
- UNION ALL
- SELECT DISTINCT
- '4.dba_hist_sqlstat' || '实例号:' || SQL.INSTANCE_NUMBER
- source,
- sql_id,
- PLAN_HASH_VALUE,
- TO_CHAR (s.BEGIN_INTERVAL_TIME ,'YYYY-MM-DD hh24:mi:ss') begin_time,
- TO_CHAR (s.END_INTERVAL_TIME,'YYYY-MM-DD hh24:mi:ss') end_time,
- SQL.executions_delta,
- SQL.buffer_gets_delta
- / DECODE (NVL (SQL.executions_delta, 0),
- 0, 1,
- SQL.executions_delta)
- "LIO/exec",
- (SQL.cpu_time_delta / 1000000)
- / DECODE (NVL (SQL.executions_delta, 0),
- 0, 1,
- SQL.executions_delta)
- "CPUTIM/exec",
- (SQL.elapsed_time_delta / 1000000)
- / DECODE (NVL (SQL.executions_delta, 0),
- 0, 1,
- SQL.executions_delta)
- "ETIME/exec",
- SQL.DISK_READS_DELTA
- / DECODE (NVL (SQL.executions_delta, 0),
- 0, 1,
- SQL.executions_delta)
- "PIO/exec",
- SQL.ROWS_PROCESSED_DELTA
- / DECODE (NVL (SQL.executions_delta, 0),
- 0, 1,
- SQL.executions_delta)
- "ROWs/exec"
- FROM dba_hist_sqlstat SQL, dba_hist_snapshot s
- WHERE SQL.INSTANCE_NUMBER = s.INSTANCE_NUMBER
- AND SQL.dbid = (SELECT dbid FROM v$database)
- AND s.snap_id = SQL.snap_id
- AND sql_id IN ('9hfkh0vxd9wq0'))
- ORDER BY source, begin_time DESC;
复制代码 |
|