mystat:
set echo off
set verify off
column value new_val V
define S="&1"
column name format a45
set autotrace off
select a.name, b.value
from v$statname a, v$mystat b
where a.statistic# = b.statistic#
and lower(a.name) like '%' || lower('&S')||'%'
-- and lower(a.name) = lower('&S')
/
set echo on
mystat2:
set echo off
set verify off
column diff format a18
select a.name, b.value Value, to_char(b.value-&V,'999,999,999,999') diff
from v$statname a, v$mystat b
where a.statistic# = b.statistic#
and lower(a.name) like '%' || lower('&S')||'%'
/
set echo on
可以通过运行mystat,mystat2计算差值
@mystat “redo size”
update 。。。。
@mystat2
可以看到update使用了多少redo
column value new_val V 把第一次运行的value保存为V
define S="&1" 定义S
在sqlplus命令下,可以使用&1...&n接受参数