Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Is there anyway to restart one database in SQL Server instead of restarting the entire server? I have a task in perpetual rollback on one of my databases. I'd like to restart it without turning off / on the other DBs

share|improve this question

migrated from stackoverflow.com Sep 5 '12 at 13:34

This question came from our site for professional and enthusiast programmers.

1  
What do you mean 'restart' a database? –  Arran Sep 5 '12 at 13:34
add comment

2 Answers 2

You can try taking it offline, and then online again:

use master
go

alter database YourDatabase
set offline
with rollback immediate
go

alter database YourDatabase
set online
go

As per BOL:

OFFLINE : The database is closed, shut down cleanly, and marked offline. The database cannot be modified while it is offline.

share|improve this answer
1  
+1 but not sure if this can fix perpetual rollbacks –  Andomar Sep 5 '12 at 13:41
    
@Andomar To be honest, neither am I. I'd have to run a test to verify. But that'd be my next step. –  Thomas Stringer Sep 5 '12 at 13:55
add comment
up vote 0 down vote accepted

I tried to take the DB offline, but because of the perpetual rollback wasn't able to do so. Had to eventually restart the server

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.