加入收藏 | 设为首页 | 会员中心 | 我要投稿 广州站长网 (https://www.020zz.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

mssql 管理器 MSSQL 启用xp_cmdshell

发布时间:2023-01-14 11:31:23 所属栏目:MsSql教程 来源:互联网
导读: 一、何为xp_cmdshell
SQL中运行系统命令行的系统存储过程mssql 管理器,一般在安全级别较高的服务器上,建议关闭或限制访问权限。
二、开启xp_cmdshell需求
当我们使用SQL JOB 方式进行数据

一、何为xp_cmdshell

SQL中运行系统命令行的系统存储过程mssql 管理器,一般在安全级别较高的服务器上,建议关闭或限制访问权限。

二、开启xp_cmdshell需求

当我们使用SQL JOB 方式进行数据库异地备份时,需要启用xp_cmdshell

三、启用方式

可以使用外围应用配置器工具以及通过执行 sp_configure 来启用和禁用 xp_cmdshell

四、使用外围应用配置工具启用 xp_cmdshell

1、打开SQL Server Management Studio,连接进入数据库,右键点击连接后数据库的最上方。选择“方面”

mssql 管理器_煤矿自救器管理台账_mssql是什么

2、 在方面上选择“外围应用配置器”

mssql是什么_mssql 管理器_煤矿自救器管理台账

3、将XPCmdShellEnbled的值改为“True”,确定完成设置。

煤矿自救器管理台账_mssql是什么_mssql 管理器

4、将刚才的配置导出为策略,方便以后的管理。点击“将当前的状态导出为策略”,定义一个名称后确定。

mssql 管理器_煤矿自救器管理台账_mssql是什么

5、在对象资源管理器中,就可以看到刚才导出的策略。

mssql 管理器_煤矿自救器管理台账_mssql是什么

6、右键点击策略,选择属性来进行管理。

煤矿自救器管理台账_mssql 管理器_mssql是什么

7、点击检查条件后面…按钮,我们可以看到策略的内容,可以进行设置与配置了。

mssql是什么_煤矿自救器管理台账_mssql 管理器

mssql是什么_mssql 管理器_煤矿自救器管理台账

mssql 管理器_煤矿自救器管理台账_mssql是什么

五、通过执行 sp_configure 来启用和禁用 xp_cmdshell

1、------启用xp_cmdshell

EXEC sp_configure'show advanced options', 1

GO

-- To update the currently configured value for advanced options.

RECONFIGURE

GO

-- To enable the feature.

EXEC sp_configure'xp_cmdshell', 1

GO

-- To update the currently configured value for this feature.

RECONFIGURE

GO

-- To disallow advanced options to be changed.

EXEC sp_configure'show advanced options', 0

GO

-- To update the currently configured value for advanced options.

mssql是什么_mssql 管理器_煤矿自救器管理台账

RECONFIGURE

GO

2、------禁用xp_cmdshell

EXEC sp_configure'show advanced options', 1

GO

-- To update the currently configured value for advanced options.

RECONFIGURE

GO

-- To enable the feature.

EXEC sp_configure'xp_cmdshell', 0

GO

-- To update the currently configured value for this feature.

RECONFIGURE

GO

-- To disallow advanced options to be changed.

EXEC sp_configure'show advanced options', 0

GO

-- To update the currently configured value for advanced options.

RECONFIGURE

GO

(编辑:广州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!