Sql Server免域,异地备份

--先决条件 开启xp_cmdshell
EXEC sp_configure 'show advanced options', 1;RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;


declare @sql varchar(500)
select @sql='\172.17.108.67基础服务数据库的名字_'+convert(varchar(10),getdate(),112) +'.bak'
select @sql

exec master..xp_cmdshell 'net use \172.17.108.67基础服务 远程机器账号密码 /user:远程机器账号'

Backup Database [数据库的名字] to Disk = @sql

原文地址:https://www.cnblogs.com/a121984376/p/10365279.html