Reputation: 5044
I wanted to restore a database, so I tried to take current database offline, but it was taking too long to get offline, hence I stopped the process. But now when I try to access the database, it says database inaccessible.
Does that means it's lost forever now? I even tried to kill active connection, it shows command successful however I'm still not able to restore database.
Can anyone help with getting it back?
Upvotes: 1
Views: 18966
Reputation: 1
It could be the suspect mode. Check the error log once and move forward based on that.
You try with following commands
Alter database [Name of DB] set offline with rollback immediate.
After using this above commons if u want to come to online again follow the below commond
Alter database [Name of DB] set online
Upvotes: 0
Reputation: 1267
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 / online.
Upvotes: 3