Bringing Your SQL Server 2008 Database Back Online

Discussion in 'Tutorials' started by dmitri, Feb 15, 2010.

  1. dmitri

    dmitri DiscountASP.NET Staff

    If you accidentally took your SQL 2008 database offline, don't panic. You will still be able to connect to your master database as well as to all other additional database on your account that are online. You should be able to bring the database back online by yourself if you follow the instructions below:

    • 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:

    [COLOR="Blue"]USE [/COLOR][master] 
    [COLOR="Blue"]GO [/COLOR]
    [COLOR="Blue"]ALTER DATABASE[/COLOR] [SQL2008_xxxxxx_yyyyyy] [COLOR="Blue"]SET ONLINE[/COLOR] 
    • Replace SQL2008_xxxxxx_yyyyyy 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.
  2. Bruce

    Bruce DiscountASP.NET Staff

    Good post.. dmitri

Share This Page