Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Urgent help! Expand / Collapse
Author
Message
Posted Monday, April 22, 2013 8:41 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, July 1, 2014 3:34 AM
Points: 378, Visits: 886
Hi
I ran a xp_cmdshell 'copy con.....' command on my live server to create a file. It didn't work for some reason and I killed the SPID that issued this command. Now I see that if I run:
select * from sys.dm_exec_requests
where database_id=77, I see that SPID in KILLED/ROllback status. It simple is not going since last 6-7 hours. And I believe it will stay there indefinitely.
Now I have to bring my database in SINGLE USER Mode but this UnKilled SPID blocks me and I am stuck. I don't see anything in task manager either.
Is there a way to get out of it without recycling the server?

Thanks


-----Table Proc Index Performance TSQL &&%$#@*(#@$%.......------------
Deep Into SQL Jungle
Post #1445014
Posted Monday, April 22, 2013 8:54 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, April 1, 2014 11:15 AM
Points: 177, Visits: 246
that rollback transaction has to complete. If you reboot, it will depend on your recovery settings what will happen.

--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
Post #1445024
Posted Monday, April 22, 2013 8:58 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, July 1, 2014 3:34 AM
Points: 378, Visits: 886
But the transaction that xp_cmdshell did was quite small: just creating a test file. it should have taken less than a second to roll it back.
Will killing the explorer.exe from task manager help here?


-----Table Proc Index Performance TSQL &&%$#@*(#@$%.......------------
Deep Into SQL Jungle
Post #1445027
Posted Monday, April 22, 2013 9:54 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 1:55 PM
Points: 36,749, Visits: 31,197
S_Kumar_S (4/22/2013)
But the transaction that xp_cmdshell did was quite small: just creating a test file. it should have taken less than a second to roll it back.
Will killing the explorer.exe from task manager help here?


This is a known issue with killing any spid. If it has 0% to go but stays there, check to see if it's using CPU time. If it's not, just ignore it and the next service bounce will take care of it. It it is using CPU time, try to find the spid the actual xp_CmdShell command used (tougher than it sounds) and kill that. Doing so will resolve the other 0% rollback spid.

Otherwise, like I said, it's a known problem and it's going to take restarting the service to take care of the problem.

And, no... don't ever kill explorer.exe from Task Manager.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1445048
Posted Monday, April 22, 2013 10:00 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, April 1, 2014 11:15 AM
Points: 177, Visits: 246
Thanks Jeff.

--------------------------------------------------------------------------
When you realize you've dug yourself into a hole....Step 1...stop digging.
Post #1445050
Posted Tuesday, April 23, 2013 3:01 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, July 1, 2014 3:34 AM
Points: 378, Visits: 886
Thanks Jeff. I also figured from different articles that it can be solved by service bounce. But problem is the bounce is scheduled for weekend and I have to move the log file of this DB to another drive by taking it offline. Can I safely take it offline and move file with the Killed/Rollback still there? It's not taking any CPU and estimated time is 0.

-----Table Proc Index Performance TSQL &&%$#@*(#@$%.......------------
Deep Into SQL Jungle
Post #1445320
Posted Tuesday, April 23, 2013 3:40 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 2:18 PM
Points: 42,449, Visits: 35,504
You won't be able to take the database offline with a session still rolling back. Restart the SQL instance, that will remove that SPID, then you'll have no trouble taking the DB offline to move it.

DO NOT try to kill OS threads, you could crash SQL.
http://sqlblog.com/blogs/linchi_shea/archive/2010/02/04/killing-a-sql-server-thread-don-t.aspx



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1445330
Posted Tuesday, April 23, 2013 5:30 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, July 1, 2014 3:34 AM
Points: 378, Visits: 886
And what about detach?

-----Table Proc Index Performance TSQL &&%$#@*(#@$%.......------------
Deep Into SQL Jungle
Post #1445365
Posted Tuesday, April 23, 2013 5:50 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, July 17, 2014 6:47 AM
Points: 223, Visits: 1,718
Same as taking the db to offline. The only way, restart service.
Post #1445371
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse