最近用pcanywhere ,由于经常无故掉线,导致pcanywhere连接时提示:host is busy ,最简单的办法,打电话给机房网管,自己在sql 2005中也可以解决,如下:
--在sql 2005查询分析器中执行
-- 允许配置高级选项
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 'net stop awhost32' --执行之,将pcanywhere先停止
GO
--执行想要的xp_cmdshell语句
Exec xp_cmdshell 'net start awhost32' --再次执行,这样pcanywhere就重新启动了
Go
--用完后,要记得将xp_cmdshell禁用(出于安全考虑)
-- 允许配置高级选项
EXEC sp_configure 'show advanced options', 1
GO
-- 重新配置
RECONFIGURE
GO
-- 禁用xp_cmdshell
EXEC sp_configure 'xp_cmdshell', 0
GO
--重新配置
RECONFIGURE
GO