sql server 2008r2 备份到局势网共享硬盘

首先,如果没有启用xp_cmdshell,请执行以下启用:

EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;
RECONFIGURE;

1.创建映射:

exec master..xp_cmdshell 'net use \\192.168.9.140\Share 123456 /user:192.168.9.140\administrator'

2.备份数据库:

backup database aa to disk='\\192.168.9.140\Share\testDB.bak' with init

3.删除备份:

exec master..xp_cmdshell 'net use \\192.168.9.140\Share /delete'

 

posted @ 2014-10-09 17:02  Rain520  阅读(3115)  评论(1编辑  收藏  举报