SqlServer2005自动完成异地备份

在外围管理器中配置cmdshell;

 

alter PROCEDURE dbo.backupDB as
 

--自动完成异地备份
go
--1、共享本地文件夹 D:\temp 共享名为 test
--net share test = "D:\temp"

--2、执行SQL在数据库服务器上创建映射 z: \\ IP\temp'

exec master..xp_cmdshell 'net use z: \\   IP\temp'                               --3、执行备份
backup database QI_ADMIN to disk = 'z:\\QI_ADMIN1121111.bak'

--4、删除数据库服务器上的映射 z:
exec master..xp_cmdshell 'net use z: /delete'

--5、取消本机共享文件夹 test
--net share temp /delete

posted on 2009-11-16 14:39  Yang-S  阅读(349)  评论(0)    收藏  举报