January 18, 2010 at 9:36 am
Hello,
I am wondering if it is possible to send some internal message before I kill a process, this would be useful when I need to do an emergency patch/reboot...
thanks
January 18, 2010 at 2:45 pm
You can make use of database mail to send mail to end users before killing their processes.
Another way is to use NET SEND command if messenger service is enabled.
Example:
select 'EXEC xp_cmdshell '+'''Net Send '+rtrim(hostname)+' Please logoff from the system-Starting Sys. maitenance--DBA''' from sysprocesses
where db_name(dbid)='DatabaseNAME' group by hostname
--Execute Output of above command for e.g. EXEC xp_cmdshell 'Net Send A356FZDZYXN7VTB Please logoff from SQL Server-Starting Sys. maintenance--DBA'
Second Step---Kill all the users specific to a particular database
MJ
January 18, 2010 at 5:43 pm
select 'EXEC xp_cmdshell '+'''Net Send '+rtrim(hostname)+' Please logoff from the system-Starting Sys. maitenance--DBA''' from sysprocesses
where db_name(dbid)='DatabaseNAME' group by hostname
--Execute Output of above command for e.g. EXEC xp_cmdshell 'Net Send A356FZDZYXN7VTB Please logoff from SQL Server-Starting Sys. maintenance--DBA'
I don't think that enabling xp_cmdshell its a good idea. It is a security risk.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply