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;
  14.  
  15. GO
  16.  
  17. EXEC sp_configure 'show advanced options', 1;
  18.  
  19. GO
  20.  
  21. RECONFIGURE;
  22.  
  23. GO
  24.  
  25. Configuration option 'show advanced options' changed from 0 to 1. Run the RECONFIGURE statement to install.
  26.  
  27. EXEC sp_configure'show advanced options', 1;
  28.  
  29. GO
  30.  
  31. RECONFIGURE;
  32.  
  33. GO
  34. 配置選項 'show advanced options' 已從 1 更改為 1。請運行 RECONFIGURE 語句進行安裝


免責聲明!

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



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