在SQL Server 2005中,xp_cmdshell默认是被禁止使用的,使用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.
如果你是管理员,可以用以下语句启用xp_cmdshell
首先用SQL Server Management Studio Express连接到数据库服务器,然后运行下面的SQL语句:
sp_configure 'show advanced options',1
reconfigure
go
sp_configure 'xp_cmdshell',1
reconfigure
go
然后你就可以使用xp_cmdshell了。
如果服务器上的xp_cmdshell存储过程被删除掉了,还可以在master数据中运行下面的SQL语句加回来
sp_addextendedproc xp_cmdshell,@dllname='xplog70.dll'
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/634491/viewspace-265305/
,如需转载,请注明出处,否则将追究法律责任。