sp_OACreate 与 xp_cmdshell 都是比较危险的存储过程,一般情况下应该禁用。
------------------ 关闭 Ole Automation Procedures -----------------------------
sp_configure 'show advanced options', 1;
GO
RECONFIGURE WITH OVERRIDE;
GO
EXEC sp_configure 'Ole Automation Procedures', 0;--开启1,关闭0
GO
RECONFIGURE WITH OVERRIDE;
GO
EXEC sp_configure 'Ole Automation Procedures';
GO
--测试是否已关闭
EXEC sp_OACreate
------------------ 关闭 xp_cmdshell -----------------------------
EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE WITH OVERRIDE;
GO
EXEC sp_configure 'xp_cmdshell', 0 --开启1,关闭0
GO
RECONFIGURE WITH OVERRIDE
GO
--测试是否已关闭
EXEC xp_cmdshell 'dir c:\*.*'