启用xp_cmdshell命令:
EXEC sp_configure 'show advanced option', '1';reconfigure;
exec sp_configure 'xp_cmdshell',1;reconfigure;
获取网络访问权限:
xp_cmdshell 'net use 路径 密码 /user:用户名'
例:xp_cmdshell 'net use \sshisbak 1 /user:administrator'
备份
backup database 备份数据库 to disk='路径带备份文件名'
例backup database db to disk='\sshisbakdb0822.bak'
sql sever2012在维护计划可以执行,2005和2008R2测试失败