Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¹ØÓÚOracleµÄsession

¹ØÓÚ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 Data Gurad ÀíÂÛ֪ʶ


RAC£¬ Data Gurad£¬ Stream ÊÇOracle ¸ß¿ÉÓÃÐÔÌåϵÖеÄÈýÖÖ¹¤¾ß£¬Ã¿¸ö¹¤¾ß¼´¿ÉÒÔ¶ÀÁ¢Ó¦Óã¬Ò²¿ÉÒÔÏ໥ÅäºÏ¡£ ËûÃǸ÷×ԵIJàÖص㲻ͬ£¬ÊÊÓó¡¾°Ò²²»Í¬¡£
RAC ËüµÄÇ¿ÏîÔÚÓÚ½â¾öµ¥µã¹ÊÕϺ͸ºÔؾùºâ£¬Òò´ËRAC ·½°¸³£ÓÃÓÚ7*24 µÄºËÐÄϵͳ£¬µ«RAC ·½°¸ÖеÄÊý¾ÝÖ»ÓÐÒ»·Ý£¬¾¡¹ ......

oracleÁ·Ï°Ì⣨mldnÊÓƵ£©Ò»

1,Áгö×îµÍн½ð´óÓÚ1500µÄ¸÷ÖÖ¹¤×÷¼°´ÓÊ´˹¤×÷µÄÈ«²¿¹ÍÔ±ÈËÊý¡£
select job,count(empno) from emp
where job in(select job from emp group by job having min(sal)>1500)
group by job;
2£¬Áгöн½ð¸ßÓÚ¹«Ë¾Æ½¾ùн½ðµÄËùÓÐÔ±¹¤ËùÔÚ²¿ÃÅ£¬Éϼ¶Áìµ¼£¬¹«Ë¾µÄ¹¤×ʵȼ¶¡£
select e.ename,d.dname,m.ename,e.sal,sa. ......

oracleÁ·Ï°£¨mldnÊÓƵ¿Î³Ì£©Èý

×ÛºÏÁ·Ï°
ѧÉúÔ˶¯»á±ÈÈüÐÅÏ¢Êý¾Ý¿â
1£¬Ô˶¯Ô±sporter£¨Ô˶¯Ô±±àºÅsporterid£¬Ô˶¯Ô±ÐÕÃûname£¬Ô˶¯Ô±ÐÔ±ðsex£¬ËùÊôϵºÅdepartment£©
2£¬ÏîÄ¿item£¨ÏîÄ¿±àºÅitemid£¬ÏîÄ¿Ãû³Æitemname£¬ÏîÄ¿±ÈÈüµØµãlocation£©
3£¬³É¼¨grade£¨Ô˶¯Ô±±àºÅsporterid£¬ÏîÄ¿±àºÅitemid£¬»ý·Ömark£©
½¨±í
1£¬¶¨Òå¸÷¸ö±íµÄÖ÷ÂëÍâÂëÔ¼Êø
2£¬ ......

OracleÄÚÖýÇÉ«connectÓëresourceµÄȨÏÞ

Ê×ÏÈÓÃÒ»¸öÃüÁÓèuserÓû§connect½ÇÉ«ºÍresource½ÇÉ«£º
grant connect,resource to user;
ÔËÐгɹ¦ºóÓû§°üÀ¨µÄȨÏÞ:
CONNECT½ÇÉ«£º --ÊÇÊÚÓè×îÖÕÓû§µÄµäÐÍȨÀû£¬×î»ù±¾µÄ
ALTER SESSION --Ð޸ĻỰ
CREATE CLUSTER --½¨Á¢¾Û´Ø
CREATE DATABASE LINK --½¨Á¢Êý¾Ý¿âÁ´½Ó
CREATE SEQUENCE --½¨Á¢ÐòÁÐ
CREAT ......

OracleÖÐstart with¡­connect by prior×Ó¾äÓ÷¨

OracleÖÐstart with…connect by prior×Ó¾äÓ÷¨
connect by Êǽṹ»¯²éѯÖÐÓõ½µÄ£¬Æä»ù±¾Óï·¨ÊÇ£º
select … from tablename
start with Ìõ¼þ1
connect by Ìõ¼þ2
where Ìõ¼þ3;
Àý£º
select * from table
start with org_id = ‘HBHqfWGWPy’
connect by prior org_id = parent_id;
  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ