首页 > 代码库 > sql server 2008r2 备份到局势网共享硬盘

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

 

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