In SQL Server, some times the database is put into the Single User Mode for different reasons and it will appear like:
YourDatabaseName (Single User)
In order to get it into multi user mode, we can use the following command:
Use Master
Alter database set Multi_user
In case we get an error of "Database currently in use". Then we can use the following command to kill the connections and run the above command again.
exec sp_who
We need to find the spid of the database for which we want the multiuser mode. Use the following command to kill that process:
kill
After the above command, we can run the command:
Alter database set Multi_user
The database will be in the multiuser state. Just refresh the whole SQL Server Browser Tree.
Update:
Even after trying out the steps given above, if the database is not restored, use the following commands:
a. Put the database in offline mode.
alter database set offline with rollback immediate
b. Now restore the database from your backup and use the REPLACE_CONTENTS.
The database will be restored and automatically comes in the Online Mode.
YourDatabaseName (Single User)
In order to get it into multi user mode, we can use the following command:
Use Master
Alter database set Multi_user
In case we get an error of "Database currently in use". Then we can use the following command to kill the connections and run the above command again.
exec sp_who
We need to find the spid of the database for which we want the multiuser mode. Use the following command to kill that process:
kill
After the above command, we can run the command:
Alter database set Multi_user
The database will be in the multiuser state. Just refresh the whole SQL Server Browser Tree.
Update:
Even after trying out the steps given above, if the database is not restored, use the following commands:
a. Put the database in offline mode.
alter database
b. Now restore the database from your backup and use the REPLACE_CONTENTS.
The database will be restored and automatically comes in the Online Mode.
Comments