天天看點

SQLSERVER2005:"sys.xp_cmdshell"過程無法調用的解決

在SQL SERVER 2005 調用“sys.xp_cmdshell”過程對過期備份檔案進行删除出現如下出錯提示:

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

SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. 

SQL server 2005的預設安全政策關閉了使用者對“sys.xp_cmdshell”的通路權限,用如下語句開啟:

sp_configure 'show advanced options', 1

GO

RECONFIGURE

sp_configure 'xp_cmdshell', 1

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

另外,當你準備在SQL SERVER 2005中調用作業系統内置的smtp元件發送郵件時,可能也會收到如下錯誤提示:

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

“SQL Server 阻止了對元件 'Ole Automation Procedures' 的 過程'sys.sp_OACreate' 的通路,因為此元件已作為此伺服器安全配置的一部分而被關閉”

同樣道理,用如下語句開啟Ole Automation Procedures的通路權限:

sp_configure 'show advanced options',1

sp_configure 'Ole Automation Procedures'

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