How to bring your SQL 2008 (and later) database back online

If you accidentally brought your SQL 2008 (or later) database offline and cannot connect to the SQL Server anymore, here's how to bring it back online.
 
  • Open SQL Server Management Studio and in the "Connect to Server" dialog box enter your connection parameters
  • Click the "Options >>" button and navigate to the "Connections Properties" page
  • In the "Connect to database" dialog box type the word master.
  • Open a New Query window and paste the following T-SQL code into it:
USE [master] 
GO 

ALTER DATABASE [Database Name] SET ONLINE 
GO
  • Replace [Database Name] with your actual database (the one you are trying to bring online)
  • Execute the code
  • If the code executed successfully, but you do not see the change in your database status, disconnect and reconnect from the server. Then you should be able to connect to your default database instead of master.
Our Cloud Backup service can automate your database backups. You have full control over backup retention and schedule. DiscountASP.NET Cloud Backup - Everleap Cloud Backup