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

DBA³£ÓÃsql(¶þ)

 session״̬£º
STATUS VARCHAR2(8) Status of the session:
ACTIVE - Session currently executing SQL
INACTIVE - sql¼°ÆäsessionûÓÐÊÍ·Å»òÕý³£Í˳ö......
KILLED - Session marked to be killed
CACHED - Session temporarily cached for use by Oracle*XA
SNIPED - Session inactive, waiting on the client
²éѯÊý¾Ý¿âÖгÖËøºÍµÈ´ýËøµÄÓû§ÐÅÏ¢
select  distinct o.object_name, sh.sid "SID", sh.SERIAL# "SERIAL", sh.username||'('||sh.sid||','||sh.SERIAL#||')' "Holder",
        sw.username||'('||sw.sid||','||sw.SERIAL#||')' "Waiter",
        decode(lh.lmode, 1, 'null', 2,
              'row share', 3, 'row exclusive', 4,  'share',
              5, 'share row exclusive' , 6, 'exclusive')  "Lock Type"
  from v$session sw, v$lock lw,all_objects o,  v$session sh, v$lock lh
where lh.id1  = o.object_id
  and  lh.id1  = lw.id1
  and  sh.sid  = lh.sid
  and  sw.sid  = lw.sid
  and  sh.lockwait is null
  and  sw.lockwait is not null
  and  lh.type = 'TM'
  and  lw.type = 'TM';
select /*+ NO_MERGE(a) NO_MERGE(b) NO_MERGE(c) */ 'Wait' "Status", a.username, a.machine, a.sid, a.serial#, a.last_call_et "Seconds", b.id1, c.sql_text "SQL"
from v$session a, v$lock b, v$sqltext c
where a.username is not null
and a.lockwait = b.kaddr
and c.hash_value =a.sql_hash_value
union
select /*+ NO_MERGE(a) NO_MERGE(b) NO_MERGE(c) */ 'Lock' "Status", a.username, a.machine, a.sid, a.serial#, a.last_call_et "Seconds", b.id1, c.sql_text "SQL"
from v$session a, v$lock b, v$sqltext c
where b.id1 in
(select /*+ NO_MERGE(d) NO_MERGE(e) */ distinct e.id1
from v$session d, v$lock e
where d.lockwait = e.kaddr)
and a.username is not null
and a.sid = b.sid
and b.request=0
and c.ha


Ïà¹ØÎĵµ£º

sql 2005 ´æ´¢¹ý³Ì·ÖÒ³ java ´úÂë

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ ......

sql´æ´¢¹ý³Ì

 ÔÚASP.NetÏîÄ¿ÖÐʹÓô洢¹ý³Ì,Ê×ÏÈ¿ÉÒÔÌá¸ßÊý¾Ý¿âµÄ°²È«ÐÔ£¬Æä´Î¿ÉÒÔÌá¸ßÔËÐÐSQL´úÂëÔËÐеÄËٶȣ¬ÔÚ´óÐÍÏîÄ¿ÖÐÒ»°ãÊDZز»¿ÉÉٵġ£Visual Studio.NetΪSQLµÄ´æ´¢¹ý³ÌÌṩÁËÇ¿´óµÄÖ§³Ö£¬Äú¼È¿ÉÒÔͨ¹ývisual studio.netÀ´Ð½¨´æ´¢¹ý³Ì£¬Ò²¿ÉÒÔÖ±½ÓÔÚSql ServerµÄ²éѯ·ÖÎöÆ÷ÖÐÔËÐУ¬»¹¿ÉÒÔͨ¹ýÆóÒµ¹ÜÀíÆ÷´´½¨£¬Ê¹ÓÃÆðÀ´Ò² ......

³£ÓõÄSQLÓï¾ä×ܽá

 ÏÖÔÚ·¢ÏÖSQLÓï¾äȷʵÊÇÌ«Ç¿´óÁË£¬ÒÔºóÓöµ½ÎÊÌâÒª¾¡Á¿ÏȺúÃ˼¿¼Ï£¬²»Òª°´ÕÕ×µÄ·½·¨À´×ö£¡
1.´ÓtblFaultDetailTemp±íÖУ¬ÕÒµ½ID=14µÄÏ²¢½«ËùÁгöµÄËĸö×ֶεÄÖµ¿½±´µ½tblFaultDetail±íÖÐ
Insert into tblFaultDetail(Code,FileType,FaultCode,FaultRect) select Code,FileType,FaultCode,FaultRect from tblF ......

SQL ÓÐÌõ¼þµØɸѡÖظ´Êý¾Ý

 --»ù´¡Á˽⣺
1) select distinct name from table --´ò¿ªÖظ´¼Ç¼µÄµ¥¸ö×Ö¶Î
2) select * from table where fid in(Select min(fid) from table group by name)--´ò¿ªÖظ´¼Ç¼µÄËùÓÐ×Ö¶ÎÖµ
3) select * from table where name in(select name from table group by name having count(name)=1)--´ò¿ªÖظ´ÈÎÒâ´ÎÊýµ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ