Sql-server – Resume a suspended task

rollbacksql server

I was applying an index to a database with archived data. I knew this would take quite a while. It was at 14 hours running when I left it last night. I came back to it this morning and enterprise manager told me it had lost connection.

On checking activity monitor on the server, I can see the task. Its state is SUSPENDED with a wait type of IO_COMPLETION.

Is there a way to resume this or kill it off and start again?

I ran sp_who2 but it's not being blocked by any other activity and has a status of ROLLBACK. If I then run kill 61 with statusonly, SQL tells me that;

Status report cannot be obtained. Rollback operation for Process ID 61
is not in progress.

Just looking for options on what I can do/try next. Thanks.

Best Answer

kill 61 with statusonly. SQL tells me that,Status report cannot be obtained. Rollback operation for Process ID 61 is not in progress

It seems Kill With statusonly reports ,only when the session is being killed manually

From Paul Randal :(Emphasis mine)

KILL WITH STATUSONLY generates a report only if the session ID or UOW is currently being rolled back because of a previous KILL session ID|UOW statement.

So in your case,the operation was not killed..So you will not be able to track status

You can use Sys.dm_Exec_requests to get rollback estimation time

select percent_complete,estimated_completion_time,* from 
sys.dm_exec_requests 
where status like '%rollback%'

further on resuming part,you can resume If you are using Index Reorg not Rebuild

some more info on reorg vs rebuild (I read about this on MSDN,but not able to find now)

Reorganize works on page level, so if you happen to stop in the middle, it will roll back that particular page which is 8kb and not the whole thing.

So if you are not using Reorg,only option is to restart index rebuild and it starts from beginning again