Bringing Database Online In SQL Server

In the previous article, I’ve explained the methods to take a database offline and to attach and detach databases in SQL Server. In this article, I’ll go through the steps and scripts used to bring back the database online. Below are the simple methods for bringing database online from offline state.

Bringing Database Online Using T-SQL

In management studio (SSMS), open a new query window and execute the below Transact-SQL statement. This SQL statement is a simple ALTER DATABASE with the database name and keywords SET ONLINE to bring back the database online.


Bringing Database Online Using SSMS

  1. Login to SQL Server Management Studio.
  2. In the Object Explorer, right-click the offline database.
  3. In the right-click menu select Tasks >> Bring Online.
    SQL Server Bringing Database Online 01
  4. On selecting Bring Online, a popup window will open and display the status of the action. If the database is brought back online, the popup window displays a tick mark in green button and the status will be success.
    SQL Server Bringing Database Online 02
  5. Now, if you refresh database folder in object explorer, you will see the database is online without the red tick mark.

Note: Follow the steps in this article to take the database offline.


Leave your thoughts...

This site uses Akismet to reduce spam. Learn how your comment data is processed.