/*MSsql2005 如何启用xp_cmdshell
默认情况下,sql server2005安装完后,xp_cmdshell是禁用的(可能是安全考虑),如果要使用它,可按以下步骤
*/
-- 允许配置高级选项
EXEC sp_configure 'show advanced options', 1
GO
-- 重新配置
RECONFIGURE
GO
-- 启用xp_cmdshell
EXEC sp_configure 'xp_cmdshell', 1
GO
--重新配置
RECONFIGURE
GO
EXEC master..xp_cmdshell 'bcp his.dbo.logasset_2017_06 in d:\logasset_2017_06.bcp -c -T'
EXEC master..xp_cmdshell 'bcp his.dbo.logmateno_2017_06 in d:\logmateno_2017_06.bcp -c -T'
--执行想要的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
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。