SQL 如何将数据库从单用户模式更改为多用户模式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25045159/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to change database from Single user mode to multi user
提问by SqlLearner
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?.
我有一个数据库,它处于单用户模式,如果我想访问数据库中的表,我会将属性从单用户更改为多用户。如何使数据库永久多用户?。
回答by Kris Gruttemeyer
ALTER DATABASE [MyDB] SET MULTI_USER
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.
如果它抛出类似 的错误user is already connected to it
,请在下拉列表中选择 'master' db 并以这种方式尝试。
If that doesn't do it, use sp_who
to find what spid is accessing the DB and kill it.
如果没有这样做,请使用sp_who
查找正在访问数据库的 spid 并杀死它。
回答by SQLChao
If you want to do it in SSMS object explorer.
如果您想在 SSMS 对象资源管理器中执行此操作。
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.
右键单击您的数据库。转到属性> 选项。滚动到底部并找到“限制访问”并将其更改为 multi_user。单击确定。
Just an alternative to query window. Both do the same the same.
只是查询窗口的替代方法。两者都做同样的事情。