dba常用sql-2(轉)
//統計每個當前使用者的命中率
SELECT USERNAME,
V$SESSION.SID,
CONSISTENT_GETS,
BLOCK_GETS,
PHYSICAL_READS,
100*(CONSISTENT_GETS+BLOCK_GETS-PHYSICAL_READS)/(CONSISTENT_GETS+BLOCK_GETS) HitRatio
FROM V$SESSION,V$SESS_IO
WHERE V$SESSION.SID=V$SESS_IO.SID
AND (V$SESS_IO.CONSISTENT_GETS+V$SESS_IO.BLOCK_GETS)>0
AND V$SESSION.USERNAME IS NOT NULL;
//累積命中率
select sum(decode(name,'consistent gets',value,0)) consistent,
sum(decode(name,'db blocks gets',value,0)) dbblockgets,
sum(decode(name,'physical reads',value,0)) physrds,
round(((sum(decode(name,'consistent gets',value,0))+
sum(decode(name,'db blocks gets',value,0))-
sum(decode(name,'physical reads',value,0)))/
(sum(decode(name,'consistent gets',value,0))+
sum(decode(name,'db blocks gets',value,0))))*100,2) Hitratio
from v$SYSSTAT;
//快取記憶體命中率
select name,value from v$sysstat where name in('physical reads','db block gets','consistent gets');
//計算資料庫快取命中率
select sum(pins-reloads)/sum(pins) from v$librarycache;
//計算字典快取命中率
select sum(gets-getmisses-usage-fixed)/sum(gets) from v$rowcache;
//除錯回滾段
select sum(waits),sum(gets),sum(waits)/sum(gets) from v$rollstat;
select shrinks from v$rollstat;
//redo除錯
select name,value from v$sysstat where name='redo buffer allocation retries';
//檢視每個會話開啟的遊標數
select sid,count(*) from v$open_cursor
group by sid;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9417382/viewspace-932233/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- dba常用sql-1(轉)SQL
- dba常用sql-3(轉)SQL
- Oracle DBA常用命令 [ 轉載]Oracle
- 經典SQL-2SQL
- oracle DBA 常用監控指令碼1(轉)Oracle指令碼
- DBA常用SQLSQL
- dba常用指令碼指令碼
- GreenPlum DBA常用SQLSQL
- DBA常用的一些SQL和檢視(轉)SQL
- ORACLE DBA常用SQL指令碼工具->管理篇(1) (轉)OracleSQL指令碼
- Oracle dba 常用檢視Oracle
- Oracle DBA常用查詢Oracle
- dba 常用維護sqlSQL
- DBA常用SQL語句SQL
- Oracle DBA常用sql分享OracleSQL
- Oracle資料庫DBA日常Sql列表及常用檢視(轉)Oracle資料庫SQL
- DBA常用的linux命令Linux
- DBA 常用的10個SQLSQL
- DBA常用SQL語句系列SQL
- 8個DBA最常用的監控Oracle資料庫的常用shell指令碼--轉Oracle資料庫指令碼
- mongodb dba常用的nosql語句MongoDBSQL
- sqlserver dba常用的sql語句SQLServer
- MySQL DBA 常用手冊小結MySql
- 【UNIX】DBA常用的linux命令Linux
- Oracle DBA常用監控指令碼Oracle指令碼
- Oracle EBS DBA 常用命令Oracle
- MySQL DBA 管理常用命令MySql
- MySQL DBA常用手冊小結MySql
- 從DBA到Oracle Applications DBA的轉變過程 (轉)OracleAPP
- MongoDB DBA常用的NoSQL語句(全)MongoDBSQL
- postgresql dba常用sql查詢語句SQL
- mysql dba常用的查詢語句MySql
- ORACLE DBA常用語句和指令碼Oracle指令碼
- DBA常用SQL語句[sql server] 2SQLServer
- DBA筆試題(轉)筆試
- DBA常用系統監控命令(之一)
- DBA常用的資料字典檢視(一)
- DBA的性格(轉自老白的dba優化手記)優化