If you accidentally bring your SQL database offline and cannot connect to the SQL Server, here's how to bring it back online.
- Open 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 up a New Query window and paste the following T-SQL code into it:
click on GO
ALTER DATABASE [DB_123_database] SET ONLINE
Click on GO
Replace DB_123_database 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 from the server and connect again. This time, you can connect to your default database instead of master.