yinl_li 发表于 2016-11-8 11:50:07

今天解决的 局域网之内远程备份数据库 sql server

  --允许配置高级选项
EXEC sp_configure 'show advanced options', 1
--重新配置
RECONFIGURE
--启用xp_cmdshell
EXEC sp_configure 'xp_cmdshell', 0
--重新配置
RECONFIGURE
--启用xp_cmdshell
EXEC sp_configure 'show advanced options', 1;RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;
--磁盘映射
exec master..xp_cmdshell 'net use z: //10.68.69.203/e$ yfyf /user:administrator'
--备份数据库
backup database cpudatadan to disk='c:/cpudatadan.bak' with init
--数据库传输
exec master..xp_cmdshell 'copy c:/cpudatadan.bak z:'
--删除备份的文件
exec master..xp_cmdshell 'del c:/cpudatadan.bak '
--删除到本地的映射
exec master..xp_cmdshell 'net use z: /delete'
页: [1]
查看完整版本: 今天解决的 局域网之内远程备份数据库 sql server