½â¾öSQL ËÀËøµÄÓï¾ä
ALTER procedure [dbo].[sp_lock_check]
@spid1 int = NULL,
@spid2 int = NULL
as
set nocount on
if @spid1 is not NULL
begin
select convert (smallint, req_spid) As spid,
loginame=rtrim(loginame),hostname ,t2.name,
rsc_dbid As dbid,
rsc_objid As ObjId,
rsc_indid As IndId,
substring (v.name, 1, 4) As Type,
substring (rsc_text, 1, 16) as Resource,
substring (u.name, 1, 8) As Mode,
substring (x.name, 1, 5) As Status
from master.dbo.syslockinfo(nolock),
master.dbo.spt_values v(nolock),
master.dbo.spt_values x(nolock),
master.dbo.spt_values u(nolock),
master.dbo.sysprocesses t1(nolock),
sysobjects t2(nolock)
where master.dbo.syslockinfo.rsc_type = v.number
and v.type = 'LR'
and master.dbo.syslockinfo.req_status = x.number
 
Ïà¹ØÎĵµ£º
±ê×¼µÄ SQL µÄ½âÎö˳ÐòΪ:
(
1
).
from
×Ó¾ä, ×é×°À´×Ô²»Í¬Êý¾ÝÔ´µÄÊý¾Ý
(
2
).
WHERE
×Ó¾ä, »ùÓÚÖ¸¶¨µÄÌõ¼þ¶Ô¼Ç¼½øÐÐɸѡ
(
3
).
GROUP
BY
×Ó¾ä, ½«Êý¾Ý»®·ÖΪ¶à¸ö·Ö×é
(
4
).ʹÓþۺϺ¯Êý½øÐмÆËã
(
5
).ʹÓÃ
HAVING
×Ó¾äɸѡ·Ö×é
(
6
).¼ÆËãËùÓеıí´ïʽ
......
SQL Server ÒÑ·â鎖Ôª¼þ 'xp_cmdshell' µÄ ³ÌÐò 'sys.xp_cmdshell'
Ö®´æÈ¡£¬Òò為´ËÔª¼þÒÑ經ÓÉ´ËËÅ·þÆ÷µÄ°²È«ÐÔ組態關閉¡£Ïµ統¹ÜÀí員¿ÉÒÔʹÓà sp_configure 來啟Óà 'xp_cmdshell'
µÄʹÓá£ÈçÐèÓÐ關啟Óà 'xp_cmdshell' µÄ詳಄ ......
http://inthirties.com:90/thread-1202-1-1.html
v$sqltext
´æ´¢µÄÊÇÍêÕûµÄSQL,SQL±»·Ö¸î
SQL> desc v$sqltext
Name Null? Type
----------------------------------------- -------- ----------------------------
ADDRESS ......
½ñÌìºÜÓôÃÆ,ʵÑéÊҵķþÎñÆ÷¶«Î÷¶¼Ã»ÓÐÁË,¶øÎÒµÄÊý¾Ý¿âÓÖÔÚÄÄÀï,ÎÒÓÖûÓб¸·Ý,°ÑÎÒÒÖÓôµÄÒªÃü,ÐÒ¿÷ÎÒÓõÄlinq to sql.×ÐϸÏëÏë,ËûµÄdbmlÎļþ»ù±¾°üº¬ÁËÊý¾Ý¿âµÄËùÓÐÄÚÈÝ,ËùÒÔ,Ò»¶¨Óа취´ÓdbmlÎļþÖд´½¨Êý¾Ý¿â!
Ñо¿ÁËÒ»¶ÎÊ ......
¡¡ÎÒ¹«Ë¾ÔÚ×齨¾ÖÓòÍøʱ£¬¿¼Âǵ½ÉÌÒµÆóÒµµÄÌص㣬×Ðϸ¿¼Á¿Á˹º¡¢Ïú¡¢´æÈý´ó»·½ÚÖз¢ÉúµÄ¸÷ÖÖÊý¾Ý¼°Æä´æ´¢ÎÊÌâºó£¬Ñ¡¶¨ÁËÒÔWindows 2000 ServerΪ²Ù×÷ϵͳ£¬SQL Server 2000ΪÊý¾Ý¿âƽ̨À´´î½¨¾ÖÓòÍøµÄÓ¦ÓÃϵͳµÄÈí¼þƽ̨£¬ÒÔÍøÏßΪÔØÌ彫¹º¡¢Ïú¡¢´æµÈºËÐIJ¿ÃŵļÆËã»úͨ¹ý¾ÖÓòÍøƽ̨½ôÃܵØÁ¬½ÓÆðÀ´¡£ÕâÑù£¬¸÷¸öºËÐIJ¿ÃÅÿÌì ......