{"id":193,"date":"2012-05-03T13:00:23","date_gmt":"2012-05-03T13:00:23","guid":{"rendered":"https:\/\/sqlserverlearner.azurewebsites.net\/2012\/05\/03\/who-killed-my-sql-server-process\/"},"modified":"2012-05-03T13:00:23","modified_gmt":"2012-05-03T13:00:23","slug":"who-killed-my-sql-server-process","status":"publish","type":"post","link":"https:\/\/sqlserverlearner.com\/2012\/05\/03\/who-killed-my-sql-server-process\/","title":{"rendered":"Who Killed My SQL Server Process?"},"content":{"rendered":"

Who Killed My SQL Server process – session – connection – spid?<\/strong>
\nIf you are sharing single database server with multiple users you might many times end up your process being force killed and an error message shown below comes up.
\n
\nMsg 233, Level 20, State 0, Line 0
\nA transport-level error has occurred when sending the request to the server. (provider: Shared Memory Provider, error: 0 – No process is on the other end of the pipe.)
\n<\/font><\/p>\n

You might be interested in policing as to who killed your process?
\nWas it done intentionally or some server side error occurred?<\/p>\n

In this post let us analyze a technique to sport the user who killed your process:<\/p>\n

Using SQL Server error Log:<\/strong>
\nSQL Server logs errors to the sql server error log, It can be found that it also logs the killing of processes in its error log.<\/p>\n

So first query the latest error log for the word kill.
\n[sql]
\nEXEC sys.xp_readerrorlog 0,1,’kill’
\n[\/sql]
\nIf you cannot find any results then continue with the next error log
\n[sql]
\nEXEC sys.xp_readerrorlog 1,1,’kill’
\n[\/sql]<\/p>\n

You can find the logdate,the killed SPID ,Host name and host processid that killed the process in the result<\/p>\n

\"\"<\/a>
Killed Processes<\/figcaption><\/figure>\n

Now find out the record for your processid in the result.<\/p>\n

To find the user who killed your process run the below queries replacing the host process id with the value that you found out in the above step.<\/p>\n

[sql]
\nselect login_name,* from sys.dm_exec_sessions where host_process_id = ‘[host process ID]’
\n[\/sql]<\/p>\n

The login_name in the result gives you the login name of the user who killed your process.<\/p>\n

\"\"<\/p>\n

Hope this post helps..
\nApplicable to sql server 2005,sql server 2008,sql server 2008 r2,sql server 2012
\nAlso read:
Read SQL Server Error Log Using TSQL Query<\/a><\/p>\n

Do Comment if you wanted to discuss further or have any issues.<\/p>\n","protected":false},"excerpt":{"rendered":"

Who Killed My SQL Server process – session – connection – spid? If you are sharing single database server with multiple users you might many times end up your process being force killed and an error message shown below comes up. Msg 233, Level 20, State 0, Line 0 A transport-level error has occurred when…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1908,3],"tags":[1909,1910,1911,1912,1913,1914,1915,1916,1917,1918,1919,1920],"_links":{"self":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/193"}],"collection":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/comments?post=193"}],"version-history":[{"count":0,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/193\/revisions"}],"wp:attachment":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/media?parent=193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/categories?post=193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/tags?post=193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}