I have a Database,Which is in Single user mode ,If i want to access a tables in the database i will be changing in the properties from single to multiuser.How can i make the Database multi user permenantly?.
How to change database from Single user mode to multi user
Asked Answered
ALTER DATABASE [MyDB] SET MULTI_USER
If it throws an error like user is already connected to it
, select 'master' db in the dropdown and try it that way.
If that doesn't do it, use sp_who
to find what spid is accessing the DB and kill it.
If you want to do it in SSMS object explorer.
Right click on your database. Go to properties > options. Scroll to the bottom and find "Restrict Access" and change it to multi_user. Click ok.
Just an alternative to query window. Both do the same the same.
But every day morning it is going back to single User mode.Is there any way i can do it permenantly. –
Baiss
@Baiss Is the database being restored daily? Maybe there is a job that alters the database? Something is changing it back to single. I've had an instance where database properties appeared to change on their own and it ended up being a 3rd party script. –
Rene
Other solution.
I have the same error as you, I have tried all the ways but it doesn't work. Manually below I have restored to the original state of the database.
Step 1: Stop Sql Server Services
Step 2: Cut Data and Log file to other folder.
Step 3: Start Sql Server Services again.
Step 4: In SQL Studio Management -> Delete error database.
Step 5: Stop Sql Server Services and Copy Data to old folder.
Step 6: Attach again and auto change from single user to multi user
This solution test on Sql Server 2017 by me.
© 2022 - 2024 — McMap. All rights reserved.