gpt4 book ai didi

sql-server - 启用 xp_cmdshell 不起作用

转载 作者:行者123 更新时间:2023-12-03 08:19:54 27 4
gpt4 key购买 nike

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

EXEC master.dbo.sp_configure 'show advanced options', 1
RECONFIGURE
EXEC master.dbo.sp_configure 'xp_cmdshell', 1
RECONFIGURE

返回的消息说:

Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install.

Configuration option 'xp_cmdshell' changed from 0 to 1. Run the RECONFIGURE statement to install.



构面属性显示“XPCmdShellEnabled”

但是,当我执行
EXEC master..xp_cmdshell 'dir c:'

我收到错误信息

Msg 15281, Level 16, State 1, Procedure xp_cmdshell, Line 1
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. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell', see "Surface Area Configuration" in SQL Server Books Online.



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

最佳答案

让我们试试这个:禁用它,然后重新启用它。

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

关于sql-server - 启用 xp_cmdshell 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26049589/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com