Search code examples
sql-server-2008processwindows-server-2008pidspid

sys sysprocesses in sql server list kpid 4056 but kpid not exist in server process


i am runnig query from sys.sysprocesses
one of the results is process with kpid '4056' and SPId 390 but when i saw the windows task manager or tasklist from command prompt 1-i tried to kill this process with kill 390 in sql server:it doesnt kill and stay in kill/rollbak 2- i tried to kill via command prompt taskkill /pid 4056 it says that:"process with this PID not exits." anyway to kill this process?


Solution

  • in my story it was failure of killing a process ran against Sharepoint with the following similar query and remaining in a killed/rollback status for a long time. and i tried to resolve the issue without restarting sql server which i was not successful but shows you where you can find the KPID and how to kill them

    SELECT  f1, f2
        FROM    OPENROWSET('Microsoft.ACE.OLEDB.12.0',
                           'WSS;IMEX=1; DATABASE=http://portal.local/AA/XX/YY;LIST=Feedback;VIEW=;RetrieveIds=Yes;',
                           'SELECT   f1, f2  FROM LIST') AS derivedtbl_1
    
    • use Process Explorer to find the right instance of sqlserver.exe by looking the location displayed in mouse over tooltip
    • go to threads node and you will find the kernel thread there
      • but killing it is not recommended and will Hang SQL server and it make you to restart it in my case
    • restart DTC(distributed Transaction Coordinator) service and SQL server agent service is another recommendation with may help killing the kpid safely in that machine