Click here to Skip to main content
15,118,865 members
Articles
Technical Blog
Posted 20 Aug 2010

Tagged as

(untagged)

Stats

135.4K views
5 bookmarked

How to Make Database Offline or Online

Rate me:
Please Sign up or sign in to vote.
5.00/5 (11 votes)
20 Aug 2010CPOL
This post will show you how to make database offline or online.

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:

SQL
ALTER DATABASE database name SET Offline

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

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

SQL
sp_dboption databasename ,'offline',true

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

SQL
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 the step shown in figure 1 and to bring back the database online, we needed to follow the step shown in figure 2:

Figure 1

Figure 2

License

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

Share

About the Author

Vivek Johari
Database Administrator
India India
I am currently working as a Senior DBA and have around 11 years of experience in database.

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

Comments and Discussions

 
Questionwith powershell Pin
Alexey Rumin25-Apr-17 22:25
MemberAlexey Rumin25-Apr-17 22:25 
QuestionPermission needed to bring online Pin
Member 1209876029-Oct-15 11:52
MemberMember 1209876029-Oct-15 11:52 
QuestionDatabase is made offline to move its physical files. Pin
Member 103755181-Nov-13 18:48
MemberMember 103755181-Nov-13 18:48 
QuestionA question Pin
Amol_B13-Aug-13 21:16
professionalAmol_B13-Aug-13 21:16 
GeneralMy vote of 1 Pin
Srithar Msc20-Mar-13 20:53
MemberSrithar Msc20-Mar-13 20:53 
GeneralRe: My vote of 1 Pin
Vivek Johari20-Mar-13 22:13
MemberVivek Johari20-Mar-13 22:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.