posts - 16, comments - 0, trackbacks - 0, articles - 0

在SQL Server 2005中启用xp_cmdshell

Posted on 2008-11-29 10:32 dengbo 阅读(346) 评论(0)  编辑 收藏 引用

在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'


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理