天天看點

SQL SERVER 2008更新到SP4後,服務無法啟動

  為了提高SQL性能和安全性,2号給客戶更新SQL 2008 SP4更新檔,更新過程中一切順利。但重新開機伺服器後,發現SQL服務無法啟動,事件日志引出此錯誤:

由于更新步驟'sqlagent100_msdb_upgrade.sql'遇到錯誤598(狀态1,嚴重性25),是以資料庫'master'的腳本級别更新失敗。

<a href="http://s1.51cto.com/wyfs02/M00/82/B6/wKioL1dfZETQcRTcAAHRd2uYqZE056.png-wh_500x0-wm_3-wmp_4-s_989664925.png" target="_blank"></a>

嘗試恢複模闆MASTER資料庫,修複安裝,更新修複都無法解決,後在網上找方案,發現在SQL啟動參數中加 ;-T902參數可以啟動SQL,并且能成功登入SMSS,步驟如下:

Enable trace flag 902 on the instance of SQL Server 2008 R2. To do this, follow these steps:

Open SQL Server Configuration Manager.

In SQL Server Configuration Manager, click SQL Server Services.

Double-click the SQL Serverservice.

In the SQL Server Properties dialog box, click the Advanced tab.

On click the Advanced tab, locate the Startup Parameters item.

Add ;-T902 to the end of the existing string value, and then click OK.

Right-click the SQL Serverservice, and then click Start.

If the SQL Server Agent service is running, right-click the SQL Server Agent service, and then click Stop.

Open SQL Server Management Studio, and then connect to the instance of SQL Server 2008 R2.

Run the following statements:

EXEC sp_configure 'show advanced', 1; 

RECONFIGURE with override  ; 

EXEC sp_configure 'allow updates', 0; 

EXEC sp_configure 'Agent XPs', 1; 

GO

In SQL Server Configuration Manager, right-click the SQL Serverservice, and then click Stop.

Remove trace flag 902 on the instance of SQL Server 2008 R2. To do this, delete ;-T902 from the string value that you updated in step 1f.

Right-click the SQL Server Agent service, and then click Start.

In SQL Server Management Studio, reconnect to the instance of SQL Server 2008 R2.

In Object Explorer, expand Management, right-click Data Collection, and then click Enable Data Collection.

Note If data collection is already enabled, the Enable Data Collection item is unavailable.

做完以上步驟後,再啟動SQL服務,發現服務仍然異常,嘗試再加 ;-T902參數并手工運作報錯的sqlagent100_msdb_upgrade.sql腳本,發現運作結果有此報錯:

對檔案 "D:\SQLDATA\temp_MS_AgentSigningCertificate_database.mdf" 的目錄查找失敗,出現作業系統錯誤 2(系統找不到指定的檔案。)。

發現D:\SQLDATA目錄并不存在,于是手工建立SQLDATA目錄,再運作腳本,成功完成。再在啟動參數中删除;-T902 ,再重新啟動服務即可。

<a href="http://s4.51cto.com/wyfs02/M01/82/B7/wKioL1dfaK7SahxUAABm9Ss2mnU554.png-wh_500x0-wm_3-wmp_4-s_3674659017.png" target="_blank"></a>

也有人的問題略有不同,他操作後,引出了其它錯誤資訊。

從事件裡可以看到一個錯誤資訊:

Could not allocate space for object 'dbo.#bulkpackage' in database 'tempdb'

這是由于 tempdb太小造成執行語句失敗。

先用;-T902重新開機 SQL Server之後,把 tempdb檔案改大。再删除 ;-T902。重新開機 SQL Server就行了。

------------------------------------

下面方法好像更簡單:

啟動 SQL Server 服務啟跟蹤标志902

一般使用指令: Net Start MSSQL$InstanceName /T902  如果是預設執行個體 Net Start MSSQLSERVER /T902

C:\Windows\system32&gt;net start MSSQLSERVER /T902

The SQL Server (MSSQLSERVER) service is starting.

The SQL Server (MSSQLSERVER) service was started successfully.

轉自:

<a href="http://www.cnblogs.com/kerrycode/p/4877910.html" target="_blank">http://www.cnblogs.com/kerrycode/p/4877910.html</a>

本文轉自 sfih 51CTO部落格,原文連結:http://blog.51cto.com/dayday/1789021