SQLServer 2008 启用 xp_cmdshell
(创建时间:2012年02月19日 19:54:00)
Jangogo :

两种方式启用xp_cmdshell
1.打开外围应用配置器—>
功能的外围应用配置器—>
实例名Database Enginexp_cmdshell—>
启用
2.sp_configure
1.打开外围应用配置器—>
功能的外围应用配置器—>
实例名Database Enginexp_cmdshell—>
启用
2.sp_configure
Sql
- -- 允许配置高级选项
- EXEC sp_configure 'show advanced options', 1
- GO
- -- 重新配置
- RECONFIGURE
- GO
- -- 启用xp_cmdshell
- EXEC sp_configure 'xp_cmdshell', 1
- GO
- --重新配置
- RECONFIGURE
- GO
- --执行想要的xp_cmdshell语句
- Exec xp_cmdshell 'query user'
- GO
- --用完后,要记得将xp_cmdshell禁用(从安全角度安全考虑)
- -- 允许配置高级选项
- EXEC sp_configure 'show advanced options', 1
- GO
- -- 重新配置
- RECONFIGURE
- GO
- -- 禁用xp_cmdshell
- EXEC sp_configure 'xp_cmdshell', 0
- GO
- --重新配置
- RECONFIGURE
- GO
文档中心