Eddie Lim’s Blog @ lucifernet.com

Just another Eddie Lim’s weblog

Archive for March, 2009

MSSQL Kill deadlock process

Nowaday not doing JDE anymore, but still touching some MSSQL T-SQL for time being, because of the stupid system and poorly implemented Database Design

i need to search and kill DB process which is not good

below is the syntax that use to kill process

use master
go
declare @spid int,@bl int
DECLARE s_cur CURSOR FOR
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 OPEN s_cur FETCH NEXT FROM s_cur INTO @spid,@bl WHILE @@FETCH_STATUS = 0 begin if @spid =0 select ‘deadlock: ‘+ CAST(@bl AS VARCHAR(10)) + ‘sql p:’
else
select ‘SPID:’+ CAST(@spid AS VARCHAR(10))+ ‘by’ + ‘SPID:’+ CAST(@bl AS
VARCHAR(10)) +’locksql’
DBCC INPUTBUFFER (@bl )
FETCH NEXT FROM s_cur INTO @spid,@bl
end
CLOSE s_cur
DEALLOCATE s_cur

Post Footer automatically generated by wp-posturl plugin for wordpress.

posted by admin in Uncategorized and have No Comments

My home server crashes

My home server crashes finally, installed a new hardisk with CentOS 5.1 to replace the old Fedora Core 2

i eventually can’t restore all my previous data, as the hardisk refuses to boot at all, the story of the day, do some backup even you are running none critical services and hardisk nowaday won’t cost you much.

in the mean time, read my photoblog at http://blog.edonesolutions.com

Post Footer automatically generated by wp-posturl plugin for wordpress.

posted by admin in Uncategorized and have No Comments

Switch to our mobile site