【问题标题】:SQL Server 11 can't exit single user mode [duplicate]SQL Server 11 无法退出单用户模式 ​​[重复]
【发布时间】:2014-06-09 10:38:13
【问题描述】:

我的一个数据库处于单用户模式,我似乎无法将其切换为多用户。

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.

我尝试从主数据库查询 SQL Server 以查找到 MyDB (exec sp_who) 的所有活动连接,但是当我这样做时,我收到以下错误

Database 'MyDB' is already open and can only have one user at a time.

我应该怎么做才能退出单用户模式?

【问题讨论】:

    标签: sql-server sql-server-2012


    【解决方案1】:

    使用这个:

    exec sp_dboption 'db_name_here', 'single user', 'FALSE'
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-09-28
    • 1970-01-01
    • 2020-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多