sp_configure錯誤:不支持對系統目錄進行即席更新。

sp_configure錯誤:不支持對系統目錄進行即席更新。


    今天在一臺數據庫服務器上(Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64)     Standard Edition (64-bit))使用sp_configure更改當前服務器的全局配置設置時,遇到錯誤提示爲“消息 5808,級別 16,狀態 1,第 1 行 Ad hoc update to system catalogs is not supported”,一般對應的中文錯誤提示爲:“消息 5808,級別 16,狀態 1,第 1 行  不支持對系統目錄進行即席更新”。

Code Snippet

  1. EXEC sp_configure'show advanced options', 1;

  2.  

  3. GO

  4.  

  5. RECONFIGURE;

  6.  

  7. GO

  8.  

  9. Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install.

  10.  

  11. 消息 5808,級別 16,狀態 1,第 1 行 

  12. Ad hoc update to system catalogs is not supported.

但是如果我將RECONFIGURE 改爲RECONFIGURE WITH OVERRIDE 則OK,不會有上面錯誤。

Code Snippet

  1. EXEC sp_configure'show advanced options', 1;

  2.  

  3. GO

  4.  

  5. RECONFIGURE WITH OVERRIDE;

  6.  

  7. GO

  8.  

  9. Configuration option 'show advanced options' changed from 0 to 1. Run the RECONFIGURE statement to install.

MSDN關於 RECONFIGURE 和 RECONFIGURE WITH OVERRIDE的解釋

 

  • RECONFIGURE

  • 指定如果配置設置不需要服務器停止並重新啓動,則更新當前運行的值。RECONFIGURE 還會檢查新的配置值中是否有無效值(例如,在 syscharsets 中不存在的排序順序值)或非建議值。對於那些不需要服務器停止並重新啓動的配置選項,其當前運行的值和當前配置的值在指定 RECONFIGURE 之後應當相同。

     

  • WITH OVERRIDE

  • 禁用對 recoveryinterval 高級配置選項的配置值檢查(以查找無效值或非建議值)。

    任何配置選項都可以通過使用 WITH OVERRIDE 選項來重新配置。另外,RECONFIGURE WITH OVERRIDE 使用指定值強制重新配置。例如,可使用大於maxservermemory 配置選項中指定的值來配置minservermemory 配置選項。但是,這將被認爲是錯誤。因此,指定 RECONFIGURE WITH OVERRIDE 將不禁用配置值檢查。

一般造成上面錯誤的原因是因爲allow_updates被設置爲1,關於allow updates選項的MSDN解釋

allow updates Option 
This option is still present in the sp_configure stored procedure, although its functionality is unavailable in SQL Server. The setting has no effect. Starting with SQL Server 2005, direct updates to the system tables are not supported. 
Important: 
This feature will be removed in a future version of Microsoft SQL Server. Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible. 
Changing the allow updates option will cause the RECONFIGURE statement to fail. Changes to the allow updates option should be removed from all scripts.

此選項仍然存在於 sp_configure 存儲過程中,但是其功能在 SQL Server 中不可用。其設置不起作用。從 SQL Server 2005 開始,不支持直接更新系統表

更改 allow updates 選項將導致 RECONFIGURE 語句失敗。 應當從所有腳本中刪除對 allow updates 選項的更改。

我檢查了一下數據庫關於'allow_updates' 選項的config_value和 run_value,果然發現其值爲1,使用sp_configure將其置爲0後,使用RECONFIGURE時,不會出現上面錯誤

Code Snippet

  1. EXEC sp_configure 'allow_updates'

  2.  

  3.      name         minimum     maximum   config_value run_value

  4.  

  5. ------------- ----------- ----------- ------------ -----------

  6.  

  7.  allow updates      0           1           1            1

  8.  

  9. EXEC sp_configure 'allow_updates',0;

  10.  

  11. GO

  12.  

  13. RECONFIGURE WITH OVERRIDE;


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章