Restarting A Database In A Database Instance Without Restarting Entire Database Instance
Sign in

Restarting a database in a database instance without restarting entire database instance

Project Leader

if taking an individual DB offline and then putting it back online

is equivalent to restarting the SQL service 

(from the DB's standpoint, at least -

it's definitely not for the service), 

but it will "reset" the DB to the extent that it will close all existing connections and rollback any open transactions. 

If that's the effect you're after, then it might be sufficient, and it won't affect any other databases running on that SQL instance.

From SSMS, you can use this SQL:


--'rollback immediate' will disconnect existing users w/out

-- waiting for transactions to finish.

ALTER DATABASE MyDatabase 

SET OFFLINE WITH ROLLBACK IMMEDIATE

go

ALTER DATABASE MyDatabase 

SET ONLINE

go

start_blog_img