- 最后登录
- 2015-1-8
- 在线时间
- 73 小时
- 威望
- 13
- 金钱
- 522
- 注册时间
- 2012-3-15
- 阅读权限
- 10
- 帖子
- 42
- 精华
- 0
- 积分
- 13
- UID
- 306
|
2#
发表于 2013-1-22 11:33:08
感觉你写的有问题,你试试下面这个代码看看。- SQL> set lines 150 pages 150
- SQL> col BEGIN_INTERVAL_TIME for a23
- SQL> col PLAN_HASH_VALUE for 9999999999
- SQL> col date_time for a18
- SQL> col snap_id heading 'SnapId'
- SQL> col executions_delta heading "No. of exec"
- SQL> col sql_profile heading "SQL|Profile" for a7
- SQL> col date_time heading 'Date time'
- SQL> col avg_lio heading 'LIO/exec' for 99999999999.99
- SQL> col avg_cputime heading 'CPUTIM/exec' for 9999999.99
- SQL> col avg_etime heading 'ETIME/exec' for 9999999.99
- SQL> col avg_pio heading 'PIO/exec' for 9999999.99
- SQL> col avg_row heading 'ROWs/exec' for 9999999.99
- SQL> SELECT DISTINCT S.SNAP_ID,
- 2 PLAN_HASH_VALUE,
- 3 TO_CHAR(S.BEGIN_INTERVAL_TIME, 'mm/dd/yy_hh24mi') ||
- 4 TO_CHAR(S.END_INTERVAL_TIME, '_hh24mi') DATE_TIME,
- 5 SQL.EXECUTIONS_DELTA,
- 6 SQL.BUFFER_GETS_DELTA /
- 7 DECODE(NVL(SQL.EXECUTIONS_DELTA, 0),
- 8 0,
- 9 1,
- 10 SQL.EXECUTIONS_DELTA) AVG_LIO,
- 11 --SQL.ccwait_delta,
- 12 (SQL.CPU_TIME_DELTA / 1000000) /
- 13 DECODE(NVL(SQL.EXECUTIONS_DELTA, 0),
- 14 0,
- 15 1,
- 16 SQL. EXECUTIONS_DELTA) AVG_CPUTIME,
- 17 (SQL.ELAPSED_TIME_DELTA / 1000000) /
- 18 DECODE(NVL(SQL.EXECUTIONS_DELTA, 0),
- 19 0,
- 20 1,
- 21 SQL. EXECUTIONS_DELTA) AVG_ETIME,
- 22 SQL.DISK_READS_DELTA /
- 23 DECODE(NVL(SQL.EXECUTIONS_DELTA, 0),
- 24 0,
- 25 1,
- 26 SQL.EXECUTIONS_DELTA) AVG_PIO,
- 27 SQL.ROWS_PROCESSED_TOTAL /
- 28 DECODE(NVL(SQL.EXECUTIONS_DELTA, 0),
- 29 0,
- 30 1,
- 31 SQL.EXECUTIONS_DELTA) AVG_ROW
- 32 --,SQL.sql_profile
- 33 FROM DBA_HIST_SQLSTAT SQL, DBA_HIST_SNAPSHOT S
- 34 WHERE SQL.INSTANCE_NUMBER = (SELECT INSTANCE_NUMBER FROM V$INSTANCE)
- 35 AND SQL.DBID = (SELECT DBID FROM V$DATABASE)
- 36 AND S.SNAP_ID = SQL.SNAP_ID
- 37 AND SQL_ID IN ('&SQLID')
- 38 ORDER BY S.SNAP_ID
复制代码 |
|