Click here to Skip to main content
Licence CPOL
First Posted 20 Aug 2010
Views 7,164
Bookmarked 5 times

How to make database offline or online

By | 20 Aug 2010 | Technical Blog
Database is made offline to move its physical files. There can be many ways to make a database offline. But there are three main methods which are used frequently to make the database offline. These methods are given below:-1)With the help of Alter database Command:-We can make the database offline
A Technical Blog article. View original blog here.[^]

Database is made offline to move its physical files. There can be many ways to make a database offline. But there are three main methods which are used frequently to make the database offline. These methods are given below:-

1)With the help of Alter database Command

We can make the database offline or online with the help of the Alter database command. The Alter Database command to make the database offline is:

    ALTER DATABASE database name SET Offline

If we want to make the database online we can use the following Alter Database command:

  ALTER DATABASE database name SET Online

2)With the help of the Db_options

We can also use the db_options command to make a database offline or online.To make a database offline we can use the following command:

sp_dboption databasename ,'offline',true

To make the database online we can use the following command:

sp_dboption databasename ,'offline',false

3)With the help of Sql server management studio

We can also use the Sql server management studio to make a database offline as shown in the given figure. To make database offline we have to follow steps show in fig 1 and to bring back the database online we needs to follows the step shown in fig 2:

Fig1

Fig2

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Vivek Johari

Software Developer (Senior)
Magic Software Pvt Ltd
India India

Member

Follow on Twitter Follow on Twitter
I am currently working as a Analyst and have around 6 yeras of experience in database.Currently, I am working in Magic Software Pvt.Ltd. in Noida.
 
Degree:-
Master Degree in Computer(MCA)
 
Work experience:-
Designing of the database.
Database Optimization.
Writing Complex Stored Procedures,Functions,Triggers etc.
Designing and developing SSIS & DTS packages.
Designing SQL Reports using SSRS.
Database Server Maintenance.
 
Certification:-
Microsoft certified Sql DBA in Sql server 2008 (MCTS).
Microsoft certified BI professional in Sql server 2008 (MCTS).
Oracle certified profession DBA in ORACLE 10g (OCP)
certified profession DBA in ORACLE 9i (OCP)
 
My other publication
Technical Blog:- Technologies with Vivek Johari
 
Moderator and Blogger at BeyondRelational.com
 
Guest Author and Blogger at sqlservercentral.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120515.1 | Last Updated 20 Aug 2010
Article Copyright 2010 by Vivek Johari
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid