启用xp_cmdshell不起作用

Sha*_*awn 4 sql-server xp-cmdshell sql-server-2008-r2

我尝试xp_cmdshell在SQL Server中启用.所以我跑了:

EXEC master.dbo.sp_configure 'show advanced options', 1
RECONFIGURE
EXEC master.dbo.sp_configure 'xp_cmdshell', 1
RECONFIGURE 
Run Code Online (Sandbox Code Playgroud)

返回的消息说:

配置选项'show advanced options'从1更改为1.运行RECONFIGURE语句进行安装.

配置选项'xp_cmdshell'从0更改为1.运行RECONFIGURE语句进行安装.

构面属性显示"XPCmdShellEnabled"

但是,当我执行时

EXEC master..xp_cmdshell 'dir c:'
Run Code Online (Sandbox Code Playgroud)

我收到了错误消息

消息15281,级别16,状态1,过程xp_cmdshell,第1行
SQL Server阻止访问组件'xp_cmdshell'的过程'sys.xp_cmdshell',因为此组件作为此服务器的安全配置的一部分被关闭.系统管理员可以使用sp_configure启用"xp_cmdshell".有关启用"xp_cmdshell"的详细信息,请参阅SQL Server联机丛书中的"表面区域配置".

我所做的是来自Microsoft文档.为什么不起作用?

Cha*_*arr 10

让我们试试这个:禁用它,然后重新设置它.

--Disable
Use Master

GO
EXEC master.dbo.sp_configure 'xp_cmdshell', 0
RECONFIGURE WITH OVERRIDE

GO

EXEC master.dbo.sp_configure 'show advanced options', 0
RECONFIGURE WITH OVERRIDE
GO

-- Enable
Use Master
GO
EXEC master.dbo.sp_configure 'show advanced options', 1
RECONFIGURE WITH OVERRIDE
GO

EXEC master.dbo.sp_configure 'xp_cmdshell', 1
RECONFIGURE WITH OVERRIDE
GO
Run Code Online (Sandbox Code Playgroud)