ora92中跟staspacck相关的两个脚本

1.spuexp.par

是个用于exp的参数文件,用于导出statspack表的数据,其内容为:

$ cat spuexp.par

file=spuexp.dmp log=spuexp.log compress=y grants=y indexes=y rows=y constraints=y owner=PERFSTAT consistent=y

使用方法为:  exp perfstat/perfstat parfile=spuexp.par

2.   sprepsql.sql  用于根据给定的前后两个snap id 和SQL Hash值生成SQL的报告,例子如下:

STATSPACK SQL report for Hash Value: 2618850598

DB Name         DB Id    Instance     Inst Num Release     Cluster Host
———— ———– ———— ——– ———– ——- ————
WHCJ          3835953590 whcj                1 9.2.0.7.0   NO      localhost

Start Id     Start Time         End Id      End Time       Duration(mins)
——— ——————- ——— ——————- ————–
1 25-Oct-10 09:49:23          2 25-Oct-10 10:11:44           22.35

SQL Statistics
~~~~~~~~~~~~~~
-> CPU and Elapsed Time are in seconds (s) for Statement Total and in
milliseconds (ms) for Per Execute
% Snap
Statement Total      Per Execute   Total
—————  —————  ——
Buffer Gets:               3              3.0     .01
Disk Reads:               0              0.0     .00
Rows processed:               0              0.0
CPU Time(s/ms):               0               .0
Elapsed Time(s/ms):               0               .1
Sorts:               0               .0
Parse Calls:               1              1.0
Invalidations:               0
Version count:               1
Sharable Mem(K):              17
Executions:               1

SQL Text
~~~~~~~~
select local_tran_id, global_tran_fmt, global_oracle_id, global_
foreign_id,        state, status, heuristic_dflt,        session
_vector, reco_vector, 3600*24*(sysdate-reco_time),        3600*2
4*(sysdate-nvl(heuristic_time,fail_time)), global_commit#, type#
from pending_trans$  where session_vector != ‘00000000′

Plans in shared pool between Begin and End Snap Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Shows the Execution Plans found in the shared pool between the begin and end
snapshots specified.  The values for Rows, Bytes and Cost shown below are those
which existed at the time the first-ever snapshot captured this plan – these
values often change over time, and so may not be indicative of current values
-> Rows indicates Cardinality, PHV is Plan Hash Value
-> ordered by Plan Hash Value

——————————————————————————–
| Operation                      | PHV/Object Name     |  Rows | Bytes|   Cost |
——————————————————————————–
——————————————————————————–

End of Report

当前没有评论!

抱歉,这篇日志的评论已关闭。