服务器重启可能会导致SQL Server中部分数据库变为single user mode

今天检查公司生产服务器的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之后再重启服务器,这是最安全的做法。

 

原文链接

 

 

 

 

 

 

转载于:https://www.cnblogs.com/OpenCoder/p/9633050.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值