HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlModerate

Restarting One Database Not Entire Server

Submitted by: @import:stackexchange-dba··
0
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:

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.

Code Snippets

use master
go

alter database YourDatabase
set offline
with rollback immediate
go

alter database YourDatabase
set online
go

Context

StackExchange Database Administrators Q#23714, answer score: 12

Revisions (0)

No revisions yet.