sqlserver Êý¾Ý¿âËÀËøºó¶à³¤Ê±¼ä½âËø£¿
¸÷λ´óÏÀ£¬sqlserver Êý¾Ý¿âËÀËøºó£¬»á²»»á×Ô¶¯½âËøÄØ£¿¶à³¤Ê±¼äÄÜ×Ô¶¯½âËøÄØ£¿Ð»Ð»£¡
SQL code:
use master
go
create procedure sp_who_lock
as
begin
declare @spid int,@bl int,
@intTransactionCountOnEntry int,
@intRowcount int,
@intCountProperties int,
@intCounter int
create table #tmp_lock_who (
id int identity(1,1),
spid smallint,
bl smallint)
IF @@ERROR<>0 RETURN @@ERROR
insert into #tmp_lock_who(spid,bl) select 0 ,blocked
from (select * from sysprocesses where blocked>0 ) a
where not exists(select * from
(select * from sysprocesses where blocked>0 ) b
where a.blocked=spid)
union select spid,blocked from sysprocesses where blocked>0
IF @@ERROR<>0 RETURN @@ERROR
-- ÕÒµ½ÁÙʱ±íµÄ¼Ç¼Êý
select @intCountProperties = Count(*),@intCounter = 1
from #tmp_lock_who
IF @@ERROR<>0 RETURN @@ERROR
if @intCountProperties=0
select 'ÏÖÔÚûÓÐ×èÈûºÍËÀËøÐÅÏ¢' as message
-- Ñ»·¿ªÊ¼
while @intCounter <= @intCountProperties
begin
-- È¡µÚÒ»Ìõ¼Ç¼
select @spid = spid,@bl = bl
from #tmp_lock_who where Id = @intCounter
begin
if @spid =0
select 'ÒýÆðÊý¾Ý¿âËÀËøµÄÊÇ: '+ CAST(@bl AS VARCHAR(10))
+ '½ø³ÌºÅ,ÆäÖ´ÐеÄSQLÓï·¨ÈçÏÂ'
else
select '½ø³ÌºÅSPID£º'+ CAST(@spid AS VARCHAR(10))+ '±»'
+ '½ø³ÌºÅSPID£º'+ CAST(@bl AS VARCHAR(10)) +'×èÈû,Æäµ±
Ç°½ø³ÌÖ´ÐеÄSQLÓï·¨ÈçÏÂ'DBCC INPUTBUFFER
×Ô¼ºÊÔÏÂ
{{--
Ïà¹ØÎÊ´ð£º
ÈçÌâ
Ö»ÓÐ100·Ö¸øÁË¡£¡£¡£
ÄĸöÐÐÒµ£¿
ÎÒÏëÍøÉϵÄÔ´Âë¿Ï¶¨²»ÄÜÍêÈ«Âú×ã¸öÈËÏë·¨
×îºó»¹µÃ×Ô¼ºÕû
ÍƼöÒ»¿î×ÔÖú½¨Õ¾Èí¼þ£º·çѶ
C#+SQL
¿ÉÒÔÉè¼Æ³ö±È½ÏÁé»îµÄÍøÕ¾
ʲôÐÐÒµ°¡....
µ½51aspx.co ......
sqlserverÓÐûÓÐÏóoracleÄÇÑù¿ÉÒÔtest´æ´¢¹ý³Ì ,µ¥²½µ÷ÊÔ.²»Ó¦¸ÃûÓаÑ,ÎÒÔõôûÕÒµ½ÄØ? Òª²»È»ÉÔ΢³¤µãµÄ´æ´¢¹ý³ÌÔõôµ÷ÊÔÄØ?
ºÃÏóûÓÐ.
ûÓаÉ
ÓУ¬²éѯ·ÖÎöÆ÷ÖÐÓÒ¼ü´æ´¢¹ý³Ì£¬µ¥²½µ÷ÊÔ
°Ù¶ÈÉÏÈ¥ÕÒһϠ......
±íÖÐÊý¾Ý 700ÍòÌõ×óÓÒ£¬29¸ö×ֶΣ¬×Ô¶¯Ôö³¤ÁÐÉèΪÖ÷¼ü£¬ ʹÓÃcount£¨1£© ²éѯ×ÜÌõÊýÐèÒª1·ÖÖÓ£¬
select top 1000 ×Ö¶ÎÃû from ±í order by ʱ¼ä(¸Ã×Ö¶ÎÓÐÖظ´ÖµºÍnullÖµ) ÕâÑùµÄÓï¾ä²éѯ¸üÊÇÂýµÃ»ù± ......
1.
select top 20 id,title,PageUrl from Infor
where title like 'ÒÔµÂÅäÌì,Ã÷µÂÉ÷%' order by id desc
CPU ʱ¼ä = 0 ºÁÃ룬ռÓÃʱ¼ä = 39 ºÁÃë¡£
2.
select top 20 id,title,PageUrl ......
xp(sp3)ϵͳ°²×°ÁËsqlserver2000£¬sp3£¬sp4²¹¶¡¶¼´òÁË¡£¶øÇÒ±¾»úÒ²ÄÜÁ¬½Ó·ÃÎÊ¡£
ÎÊÌâÊÇ£º
±¾»útelnet ip 1433 ×ÜÊÇÌáʾÁ¬½Óʧ°Ü£¬
¶øÇÒnetstat -naʱ£¬¿´²»µ½1433¶Ë¿Ú±»Õ¼ÓÃ
(¿Ï¶¨µÄÊÇ£º¶Ë¿ÚÊÇ1433£¬¿ªÆ ......