新聞速報

        

2014年2月26日 星期三

SQL xp_cmdshell 功能 開啟/關閉

問題描述
 
使用 xp_cmdshell 出現如下錯誤訊息,該如何處理?
 
訊息 15281,層級 16,狀態 1,程序 xp_cmdshell,行 1
SQL Server 已封鎖元件 "xp_cmdshell" 的 程序 "sys.xp_cmdshell" 之存取,因為此元件已經由此伺服器的安全性組態關閉。系統管理員可以使用 sp_configure 來啟用 "xp_cmdshell" 的使用。如需有關啟用 "xp_cmdshell" 的詳細資訊,請參閱《SQL Server 線上叢書》中的<介面區組態>(Surface Area Configuration)。


-- 開啟 xp_cmdshell
EXEC sp_configure "show advanced options", 1;
RECONFIGURE;
EXEC sp_configure "xp_cmdshell", 1;
RECONFIGURE;

-- 關閉 xp_cmdshell
EXEC sp_configure "show advanced options", 1;
RECONFIGURE;
EXEC sp_configure "xp_cmdshell", 0;
RECONFIGURE;

沒有留言:

張貼留言