服務器重啟可能會導致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之后再重啟服務器,這是最安全的做法。

 

原文鏈接

 

 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM