¹ØÓÚOracleµÄsession
1.ÈçºÎ²é¿´session¼¶µÄµÈ´ýʼþ£¿
µ±ÎÒÃǶÔÊý¾Ý¿âµÄÐÔÄܽøÐе÷Õûʱ£¬Ò»¸ö×îÖØÒªµÄ²Î¿¼Ö¸±ê¾ÍÊÇϵͳµÈ´ýʼþ¡£$system_event,v$session_event,v$session_waitÕâÈý¸öÊÓͼÀï¼Ç¼µÄ¾ÍÊÇϵͳ¼¶ºÍsession¼¶µÄµÈ´ýʼþ£¬Í¨¹ý²éѯÕâЩÊÓͼÄã¿ÉÒÔ·¢ÏÖÊý¾Ý¿âµÄһЩ²Ù×÷µ½µ×Ôڵȴýʲô£¿ÊÇ´ÅÅÌI/O£¬»º³åÇø棬»¹ÊDzåËøµÈµÈ¡£
ͨ¹ýÈçÏÂsqlÄã¿ÉÒÔ²éѯÄãµÄÿ¸öÓ¦ÓóÌÐòµ½µ×Ôڵȴýʲô£¬´Ó¶øÕë¶ÔÕâЩÐÅÏ¢¶ÔÊý¾Ý¿âµÄÐÔÄܽøÐе÷Õû¡£
Select s.username,s.program,s.status,se.event,se.total_waits,se.total_timeouts,se.time_waited,se.average_wait
from v$session s, v$session_event se
Where s.sid=se.sid And se.event not like 'SQl*Net%' And s.status ='ACTIVE' And s.username is not null
2.oracleÖвéѯ±»ËøµÄ±í²¢ÊÍ·Åsession
SELECT A.OWNER,A.OBJECT_NAME,B.XIDUSN,B.XIDSLOT,B.XIDSQN,B.SESSION_ID,B.ORACLE_USERNAME, B.OS_USER_NAME,B.PROCESS, B.LOCKED_MODE, C.MACHINE,C.STATUS,C.SERVER,C.SID,C.SERIAL#,C.PROGRAM
from ALL_OBJECTS A,V$LOCKED_OBJECT B,SYS.GV_$SESSION C
WHERE ( A.OBJECT_ID = B.OBJECT_ID ) AND (B.PROCESS = C.PROCESS ) ORDER BY 1,2
ÊÍ·Åsession Sql:
alter system kill session 'sid, serial#'
alter system kill session '379, 21132'
alter system kill session '374, 6938'
3.²é¿´Õ¼ÓÃϵͳio½Ï´óµÄsession
SELECT se.sid,se.serial#,pr.SPID,se.username,se.status,se.terminal,se.program,se.MODULE,se.sql_address,st.event,st.p1text,si.physical_reads,si.block_changes
from v$session se,¡¡v$session_wait st,v$sess_io si,v$process pr
WHERE st.sid=se.sid ¡¡AND st.sid=si.sid AND se.PADDR=pr.ADDR AND se.sid>6¡¡AND st.wait_time=0 AND st.event NOT LIKE '%SQL%' ORDER BY physical_reads DESC
4.ÕÒ³öºÄ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
5.²éѯsession±»ËøµÄsql¿ÉÒÔÓÃÒ»ÏÂÓï¾ä
Oracle Database 10g Release 2 (10.2.0.1.0) Enterprise/Standard Edition for Microsoft Windows (32-bit)
http://download.oracle.com/otn/nt/oracle10g/10201/10201_database_win32.zip
http://download.oracle.com/otn/nt/oracle10g/10201/10201_client_win32.zip
http://download.oracle.com/otn/nt/oracle10g/10 ......
1. ²é¿´Êý¾ÝµÄ×Ö·û¼¯
sqlplus> col parameter format a30
sqlplus> col value format a30
sqlplus> select * from nls_database_parameter
PARAMETER VALUE
------------------------------ --------------------
...
NLS_CH ......