Hi all!
I have a problem with my SQL server. For various reasons my sql server is full of databse processes with status sleeping. By time this will eventually freeze the system.
I figured out the solution: I code this SQL Server job, witch will automatically delete all sleeping processes:
select 'kill '+convert(char,spid) from master..sysprocess
where
status = 'sleeping' and
spid > 50 and
AND DATEDIFF( minute, last_batch, GetDate() ) > 60
This select statement is working fine, i get result set of commands to kill the wanted prosedures. But thats all. My job does not actually run the command to kill the procedures.
I examined the situation also in the SQL Server query analyzer - I get result set of kill commands:
Kill 59
Kill 66
Kill 101
but thats all.
So now to my big question: How can I make it so, that the system will also run the kill commands. I have tried with ECEX etc, but I cant find the right way to do it. Could anyone please help me?
Ernest