我的一个数据库处于单用户模式,我似乎无法将其切换为多用户。
USE master
GO
ALTER DATABASE MyDB
SET MULTI_USER WITH ROLLBACK IMMEDIATE
GO
当我运行上述查询时,我得到以下结果
Changes to the state or options of database 'MyDB' cannot be made at this time. The database is in single-user mode, and a user is currently connected to it.
我尝试从master数据库查询SQL Server以查找到MyDB的所有活动连接(exec sp_who
),但是当我这样做时,我收到以下错误
Database 'MyDB' is already open and can only have one user at a time.
退出单用户模式应该怎么做?
答案 0 :(得分:-1)
使用此:
exec sp_dboption 'db_name_here', 'single user', 'FALSE'