Thursday, October 20, 2016

How to check which process killed the application process?

In the database server, we need to search for the string Kill in the SQLServer’s Error Log.
In SQLServerManagementWizard, Select the menus Management->SQL Server Logs-> <ERRORLOG> -> Search

Enter the string “Kill”, then click Search

If the search affects the server's performance or takes long time (It happens if the Error-Log size is too big), the Error-Log file can be copied to another machine, and then the following command can be used to find the lines that have the string Kill.

Example:
 findstr "Kill" ERRORLOG

(NOTE: K is upper case in Kill.   ERRORLOG is filename)

This usually displays the Process ID of the killed process, and the Host process ID of the killing process.  Using the host_process_id, the login_name that killed the process can found from the the table sys.dm_exec_sessions.

select login_name from sys.dm_exec_sessions where host_process_id = 'host process id got from the log';


No comments:

Post a Comment