今天检查公司生产服务器的SQL Server数据库,惊讶的发现有三个生产数据库变为了single user mode。奇怪的是没有任何人和程序执行过SQL语句将这三个数据库设置为single user mode,是自动变的。后来在网上查了查原来发现,重启windows server原来有可能导致SQL Server数据库意外变为single user mode。原文如下:

问题:

Why did SQL Server go into single user mode?

I've had an application that's been running great for several months. Thankfully I use try/catch blocks in my database calls because this morning I get an email alert from my catch block that said:

Message: Login failed for user 'NT AUTHORITY\NETWORK SERVICE'. Reason: Server is in single user mode. Only one administrator can connect at this time.
Source: .Net SqlClient Data Provider
Data: System.Collections.ListDictionaryInternal

So I go and try to access the application, and yep, verified that it doesn't work.

I was able to remote desktop over to the server and log into SQL Server which suddenly "fixed" the issue, but I don't know why this happened. ("Fixed" as in now the application does it's normal CRUD operations.)

Does anyone know why this might have spontaneously happened?

Also, if I go to database -> properties -> options -> State, I verified that Restrict Access is in "MULTI_USER".

The app is powered by the mighty SQL Server 2005 express. Is that the problem?

回答:

Did you check your Windows Event Logs to see if anything happened to the server? Did it reboot after installing any updates?

Got a crazy system admin that didn't let me know that was going on. Just checked the event viewer and saw that's exactly what was going on. Thanks for helping me verify what was going on! – Anjisan Mar 31 '09 at 14:18

@Sung Meister: According to the Event Viewer (system) on the server, he was applying updates which included stopping/starting SQL Server. Would have been nice to know ahead of time. Had no idea he was doing that. Good thing I used try/catch and error logging. – Anjisan Mar 31 '09
 
This also happened to me when Windows Update was installing a service pack. – Jorrit Schippers Mar 30 '12 at 12:18

所以我们看到有些windows server的安全补丁安装后,要求重启服务器。这有可能导致SQL Server的某些数据库变为single user mode。所以在重启服务器前要小心,最好将所有SQL Server的数据库offline之后再重启服务器,这是最安全的做法。

原文链接

 

服务器重启可能会导致SQL Server中部分数据库变为single user mode的更多相关文章

  1. SQL Server中查询数据库及表的信息语句

    /* -- 本文件主要是汇总了 Microsoft SQL Server 中有关数据库与表的相关信息查询语句. -- 下面的查询语句中一般给出两种查询方法, -- A方法访问系统表,适应于SQL 20 ...

  2. SQL Server中通用数据库角色权限处理

    SQL Server中通用数据库角色权限处理   最近和同事在做数据库权限清理的事情,主要是删除一些账号:取消一些账号的较大的权限等,例如,有一些有db_owner权限,我们取消账号的数据库角色db_ ...

  3. SQL Server中通用数据库角色权限的处理详解

    SQL Server中通用数据库角色权限的处理详解 前言 安全性是所有数据库管理系统的一个重要特征.理解安全性问题是理解数据库管理系统安全性机制的前提. 最近和同事在做数据库权限清理的事情,主要是删除 ...

  4. 《SQL Server企业级平台管理实践》读书笔记——SQL Server中收缩数据库不好用的原因

    数据库管理员有时候需要控制文件的大小,可能选择收缩文件,或者把某些数据文件情况以便从数据库里删除. 这时候我们就要使用到DBCC SHRINKFILE命令,此命令的脚本为: DBCC SHRINKFI ...

  5. SQL Server 中创建数据库、更改主文件组示例

    以下示例在 SQL Server 实例上创建了一个数据库.该数据库包括一个主数据文件.一个用户定义文件组和一个日志文件.主数据文件在主文件组中,而用户定义文件组包含两个次要数据文件.ALTER DAT ...

  6. SQL Server中使用数据库快照的方式来完成测试环境中数据库的轻量级备份还原操作

    在开发或者测试环境的数据库中,经常会发现有开发或者测试人员误删除表或者数据的情况,对于开发或者测试库,一般都没有安排定时的备份任务去备份数据库,一方面是由于存储资源有限,不太可能给开发或者测试环境准备 ...

  7. sql server 中查询数据库下有多少张表以及同义词等信息

    --查询数据库有多少张表SELECT count(0) from sysobjects where xtype = 'u' 复制代码 解释:sysobjects系统对象表. 保存当前数据库的对象.如约 ...

  8. SQL Server中的GUID

    GUID(Global unique identifier)全局唯一标识符,它是由网卡上的标识数字(每个网卡都有唯一的标识号)以及 CPU 时钟的唯一数字生成的的一个 16 字节的二进制值. GUID ...

  9. sql server中的系统数据库

    1.master数据库 master是SQL Server中最重要的数据库,是整个数据库服务器的核心.用户不能直接修改该数据库,如果损坏了master数据库,整个SQL Server服务器将不能工作. ...

随机推荐

  1. wamp配置虚拟路径(路径别名)

    wamp默认的路径是安装目录下的 www 目录, 如果你想运行php代码,就需要将代码放在 www 目录下, 但这样很不方便,能否通过配置的方式,来实现 在别的目录下的 php 代码,也能正常运行和访 ...

  2. @Async的使用

    从Spring3.x 开始,加入@Async这个注解,用户异步线程处理,使用起来很方便. 使用配置如下:spring-task.xml <task:executor id="execu ...

  3. ELK常用命令

    1.查询当前所有的索引 #curl 'localhost:9200/_cat/indices?v' 2.查看集群健康状态 #curl 'localhost:9200/_cat/health?v' 绿色 ...

  4. C/C++编程GUI库比较

    转自:http://blog.csdn.net/lostown/article/details/658654 最强的GUI库当属Qt,毕竟是商业化的东西,功能最完整,什么都好,包括类似java代码风格 ...

  5. 人工智能日常应用举例-nlp+视觉(听说看)

  6. HashMap底层原理分析(put、get方法)

    1.HashMap底层原理分析(put.get方法) HashMap底层是通过数组加链表的结构来实现的.HashMap通过计算key的hashCode来计算hash值,只要hashCode一样,那ha ...

  7. 百度前端学院task33源码及总结——听指令的小方块

    任务描述 如图,实现一个类似棋盘的格子空间,每个格子用两个数字可以定位,一个红正方形的DOM在这个空间内,正方形中的蓝色边表示这是他的正面,有一个input输入框 在输入框中允许输入如下指令,按下按钮 ...

  8. deque双端队列(常用方法总结)

    /*关于C++ STL中deque的学习*/ #include<cstdio> #include<iostream> #include<deque> using n ...

  9. 分布式理论(六)—— Raft 算法

    前言 我们之前讲述了 Paxos 一致性算法,虽然楼主尝试用最简单的算法来阐述,但仍然还是有点绕.楼主最初怀疑自己太笨,后来才直到,该算法的晦涩难懂不是只有我一个人这么认为,而是国际公认! 所以 Pa ...

  10. MFC函数—CSingleDocTemplate

    前提:在InitInstance() 函数的初始化过程中,我们可以看到代码CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDoc ...