patternsqlModerate
Restarting One Database Not Entire Server
Viewed 0 times
entiredatabaseoneserverrestartingnot
Problem
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
Solution
You can try taking it offline, and then online again:
As per BOL:
OFFLINE : The database is closed, shut down cleanly, and marked offline. The database cannot be modified while it is offline.
use master
go
alter database YourDatabase
set offline
with rollback immediate
go
alter database YourDatabase
set online
goAs per BOL:
OFFLINE : The database is closed, shut down cleanly, and marked offline. The database cannot be modified while it is offline.
Code Snippets
use master
go
alter database YourDatabase
set offline
with rollback immediate
go
alter database YourDatabase
set online
goContext
StackExchange Database Administrators Q#23714, answer score: 12
Revisions (0)
No revisions yet.