加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sql – 将数据库更改为“online”并将db设置为“multi-user”

发布时间:2020-12-12 06:40:54 所属栏目:MsSql教程 来源:网络整理
导读:我有一个离线的2008 sql数据库,我想在线并设置为多用户.使用sql server management studio – 新的查询窗口 – 当我执行以下命令时: ALTER DATABASE mydb SET ONLINE; ALTER DATABASE mydb SET MULTI_USER; 我收到此错误消息: Msg 5064,Level 16,State 1,Li
我有一个离线的2008 sql数据库,我想在线并设置为多用户.使用sql server management studio – 新的查询窗口 – 当我执行以下命令时:
ALTER DATABASE mydb SET ONLINE;

    ALTER DATABASE mydb SET MULTI_USER;

我收到此错误消息:

Msg 5064,Level 16,State 1,Line 1
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.
Msg 5069,
State 1,Line 1 ALTER DATABASE
statement failed. Msg 5064,Line 3 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. Msg 5069,
Level 16,Line 3 ALTER
DATABASE statement failed.

如何在线和多用户模式下获取数据库?

解决方法

确保您不在该数据库中.关闭所有连接到它的查询窗口,关闭对象资源管理器详细信息,关闭SSMS并重新打开它,而不将对象资源管理器连接到该服务器,等等.运行:
USE [master];
GO

ALTER DATABASE mydb SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
GO

这应该允许您将其联机,然后您将运行您列出的命令.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读