1、當(dāng)前數(shù)據(jù)庫(kù)各個(gè)終端連接數(shù)
SELECT "連接數(shù)","終端名稱(chēng)"
FROM ( SELECT COUNT(TERMINAL) AS 連接數(shù),
TERMINAL AS 終端名稱(chēng)
FROM v$sessionGROUP BY TERMINAL
)
ORDER BY 連接數(shù) DESC;
2、查詢性能最差的SQL
SELECTdisk_reads,executions,rows_processed,
first_load_time,sql_text
FROMsys.v_$sqlarea
WHEREdisk_reads >10
AND executions < 10
ORDER BYfirst_load_time;
3、找使用CPU多的用戶session
SELECT a.sid,spid,status,substr(a.program,1,40) prog,
a.terminal,osuser,value/60/100 value
FROM v$session a,v$process b,v$sesstat c
WHERE c.statistic#=12
AND c.sid=a.sid
AND a.paddr=b.addr
ORDER BY VALUE DESC;
4、當(dāng)前各用戶運(yùn)行什么SQL語(yǔ)句
SELECTosuser, username, sql_text
FROMv$session a, v$sqltext b
WHEREa.sql_address =b.address
ORDER BY address, piece;