SQL Server ->> 无法将数据库从SINGLE_USER模式切换回MULTI_USER模式(Error 5064)
2016-04-08 13:30
393 查看
报错信息如下:
Msg 5064, Level 16, State 1, Line 1
Changes to the state or options of database 'test' 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, State 1, Line 1
ALTER DATABASE statement failed.
有人还连着数据库,从下面步骤检查:
1)通过sys.sysprocesses或者sys.dm_exec_sessions,或者存储过程sp_who,然后用KILL命令把会话切断
2)如果上面还是行不通,再检查sys.dm_tran_locks,然后用KILL命令把会话切断
Msg 5064, Level 16, State 1, Line 1
Changes to the state or options of database 'test' 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, State 1, Line 1
ALTER DATABASE statement failed.
有人还连着数据库,从下面步骤检查:
1)通过sys.sysprocesses或者sys.dm_exec_sessions,或者存储过程sp_who,然后用KILL命令把会话切断
select * from sys.sysprocesses where spid > 50 And dbid=DB_ID ('MyDB')
SELECT * FROM sys.dm_exec_sessions WHERE database_id = DB_ID ('MyDB')
2)如果上面还是行不通,再检查sys.dm_tran_locks,然后用KILL命令把会话切断
select * from sys.dm_tran_locks where resource_database_id= DB_ID ('MyDB')
相关文章推荐
- 解决sqlite3_key的问题
- 数据库小结2
- oracle数据库删除数据的两种方式
- 常用SQL查询语句
- 经典SQL语句大全、50个常用的sql语句
- mysql锁等待分析
- Redis命令-有序集合-zincrby
- sql各种查询技巧
- SQL 基础--> 子查询
- DBeaver数据库管理工具使用体验
- mysql 行转列的实现
- oracle 中常见日期查询语句
- mongodb群集
- MongoDB安装,打开及增,删,改,查
- oracle 体系架构
- 利用expdp/impdp数据泵对oracle进行数据迁移
- Mysql常用函数
- 破解MYSQL密码方法大全
- sql编程篇 (五) 事务
- scrapy一些非常实用资料整理,与其他mongdb、django、redis、solr、tor结合使用以及用Python脚本调用等等方法