Describe 語覈磯 here
set linesize 200 pagesize 999
spool c:\session_monitoring.txt
select sid, username from v$session;
----------------------------------
-- 覦 蠍 曙 覲 蟆!!
----------------------------------
--
-- Oracle 8.1.6 ろ 蟆
-- 企豪 sid襯 k.
-- 襦蠏碁 螳襦 kill 譴企朱 Serial# 螻 覲.
-- alter system kill session 'sid, serial#'; 覈轟朱 kill .
-- define朱 譟壱 蟆 襦&sid 朱 螳 k.
-- ( : define sid = 12)
-----------------
--語 覈磯--
-----------------
col NAME FOR a60
SELECT a.sid, b.NAME, a.VALUE
FROM v$sesstat a, v$statname b
WHERE a.statistic# = b.STATISTIC#
AND VALUE > 10000
AND a.sid = &sid
ORDER BY 1;
--------------------------------
--語 SQL覓 谿剰鍵--
--------------------------------
select a.piece || ' ' || a.sql_text
from v$sqltext_with_newlines a, v$session b
where a.address = b.saddr
and b.sid = &sid
order by 1;
-------------------------
--語 企欧 糾 覲--
-------------------------
col event format a30
col t_wait format 999999
col t_out format 99999
col t_waitd format 99999
col m_wait format 99999
select event,
total_waits t_wait,
total_timeouts t_out,
time_waited t_waited,
average_wait a_wait,
max_wait m_wait
from v$session_event
where sid = &sid;
------------------
--語 wait 覲--
------------------
col p1text format a10
col p2text format a10
col p3text format a10
col e_name format a20
col p3 format 999
select
SID,
substr(EVENT, 1, 20) e_name,
P1 ,
P1RAW,
P3TEXT,
P3
from v$session_wait
WHERE SID=&sid;
-----------------------
--PGA, UGA 願鍵--
-----------------------
col username format a20
col program format a20
col pga format a20
col uga format a20
col terminal format a20
select max(decode(t2.num, 1, sid)) sid,
max(decode(t2.num, 1, username)) username,
max(decode(t2.num, 1, pgm)) program,
max(decode(t2.num, 1, terminal, 'UGA, PGA 螻 :')) terminal,
sum(pga)||'K' pga,
sum(uga)||'K' uga
from (
select a.sid, a.username, substr(a.program, 1, 25) as pgm, a.terminal,
max(decode(c.name, 'session pga memory', trunc(value/1000), 0)) pga,
max(decode(c.name, 'session uga memory', trunc(value/1000), 0)) uga
from v$session a, v$sesstat b, v$statname c
where a.sid = b.sid
and b.statistic# = c.statistic#
and c.name like 'session%'
group by a.sid, a.username, substr(a.program, 1, 25), a.terminal) t1,
(select 1 as num from dual union all select 2 from dual) t2
group by decode(t2.num, 1, sid);
spool off