Why did my SQL Server database just go offline?

Note: This post contains a video clip where I show quirky behaviour of the scripted offline task. Personally I rarely use SQL Server Management Studio GUI to do day-to-day tasks, I rather just load a window and start typing stuff (I learn better that way). Recently I became lazy and just loaded up the tool and found something quite quirky, let me explain.

We all understand how handy it is to “script” something from the tool that is if you want to see the code behind the action. For example a detach database operation.

This is found under database > tasks>

detach.JPG

Then I like to “script action to new query window”, this will show you the code but it will not carry out the action, see below.

TheCode

As long as you do not click OK it will not do anything hence leaving you with the code in the window to read and run manually.

However, the same cannot be said for the offline operation. Take a look at the following video clip (with commentary) you can see that I hit the script button to offline the database where I get no action to be scripted and I cancel out of it BUT it still goes offline?

It really shouldn’t because I did not actually click OK to take it offline or even have the option to execute the code because no code was given as output!

I am not seeing things; the error log confirms it too.

ItsGone

If you want to see other SQL Server “quick” video clips keep an eye out on https://blobeater.blog/sqlserver-video-library/  where I will be updating this page over my lifetime of blogging.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s