SQL Server 2005的cmd_shell组件的开启方法(cmd运行sql语句)越早知道越好

随心笔谈2年前发布 admin
170 0 0

文章摘要

这篇文章介绍了SQL Server中的`cmd_shell`组件,强调其强大的功能几乎能实现Windows系统的所有操作,因此成为最大安全隐患。SQL Server 2000中该组件默认开启,而2005年被默认关闭。文章提供了开启和关闭`cmd_shell`的相关语句,建议在使用后关闭该组件以保障安全。文章提醒用户在操作过程中需谨慎,避免因误用导致数据安全问题。



SQL Server中的cmd_shell组件功能强大,几乎可通过该组建实现Windows系统的所有功能,正因此,这个组件也是SQL Server的最大安全隐患。SQL Server 2000中这个组件是默认开启的,而SQL Server 2005中这个组件默认作为此服务器安全配置的一部分而被关闭。有时我们需要用到该组件,开启此组件的相关语句如下:

复制代码 代码如下:
–To allow advanced options to be changed.

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 allow advanced options to be changed.

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

© 版权声明

相关文章