patternsqlModerate
Restarting database server or just the database
Viewed 0 times
thejustdatabaseserverrestarting
Problem
I am an application programmer. We have a SQL Server 2012 instance that hosts many related databases (around 12 databases). The vendors did some changes to one of the database and the application and they want us to reboot the database server. I did some research and found out that rebooting a db server is always not a great option unless changes have been made in the server configuration. Is there a way to restart just that database? Would that help?
Solution
You can cycle the database by doing:
And then to bring the database back online you can do:
This is a way to "restart" the database itself directly within SQL Server, without bouncing either the SQL Server service(s) or the server operating system itself.
As for the question of "would that help?", there is no way for us to answer that. You should be asking the vendor why do I need to restart the database server? Oftentimes people that don't know what they are particularly doing will cycle an entire environment after a migration/upgrade/change. Why? "Just in case".
If the vendor made a change directly to the database (DDL/DML, whatever) then that change takes effect immediately. So you really need to follow up with the vendor to find out why they want the database server restarted.
alter database YourDatabase
set offline
with rollback immediate; -- this line will rollback ongoing transactions
goAnd then to bring the database back online you can do:
alter database YourDatabase
set online;
goThis is a way to "restart" the database itself directly within SQL Server, without bouncing either the SQL Server service(s) or the server operating system itself.
As for the question of "would that help?", there is no way for us to answer that. You should be asking the vendor why do I need to restart the database server? Oftentimes people that don't know what they are particularly doing will cycle an entire environment after a migration/upgrade/change. Why? "Just in case".
If the vendor made a change directly to the database (DDL/DML, whatever) then that change takes effect immediately. So you really need to follow up with the vendor to find out why they want the database server restarted.
Code Snippets
alter database YourDatabase
set offline
with rollback immediate; -- this line will rollback ongoing transactions
goalter database YourDatabase
set online;
goContext
StackExchange Database Administrators Q#84198, answer score: 11
Revisions (0)
No revisions yet.