sql server 備份映射到遠程機器

--如果xp_cmdshell沒有啓用,請先啓用
sp_configure 'show advanced options',1
reconfigure
go
sp_configure 'xp_cmdshell',1
reconfigure
go

--1.先創建映射
exec master..xp_cmdshell 'net use  \\192.168.20.10\backup 密碼 /user:192.168.1.251\administrator'
--2.利用映射備份數據庫
backup database TXDB to disk='\\192.168.20.10\backup\TXDB.bak'
--3.刪除映射
exec master..xp_cmdshell 'net use \\192.168.20.10\backup /delete'


--xp_cmdshell關閉
sp_configure 'show advanced options',1
reconfigure
go
sp_configure 'xp_cmdshell',0
reconfigure
go

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章