計算session的日誌生成量

oracle_ace發表於2008-01-20

看了tom的書,把如何計算當前session的日誌生成量羅列在這裡
redostart.sql
----------------
set verify off
column value new_val V
define S="redo size"

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')||'%'
/


redoend.sql
------------------
set verify off
select a.name,b.value V,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')||'%'
/

這裡在補充一下
如果我要監控其他session的日誌生成量呢?
這時我們可以利用v$sessstat來代替v$mystat這個檢視

redostart.sql
------------------
set verify off
column value new_val V
define S="&1"

set autotrace off

select a.name,b.value
from v$statname a,v$sesstat b
where a.statistic#=b.statistic#
and lower(a.name) like '%' || lower('redo size')||'%'
and b.sid=&S
/


redoend.sql
-----------------
set verify off
select a.name,b.value V,to_char(b.value-&V,'999,999,999,999') diff
from v$statname a,v$sesstat b
where a.statistic#=b.statistic#
and lower(a.name) like '%'||lower('redo size')||'%'
and b.sid=&S
/



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12361284/viewspace-153405/,如需轉載,請註明出處,否則將追究法律責任。

相關文章