Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 12963

How to copy backup files to shared drive daily with sql server 2012

$
0
0

Hello Friends,

I have created backup database jobs in sql server 2012, step 1 takes backup for databases which is running fine.

For example:

BACKUP DATABASE [master] TO  DISK = N'E:\Backups\master-backup.bak' WITH  INIT ,  NOUNLOAD ,  NAME = N'master',  NOSKIP ,  STATS = 10,  NOFORMAT, CHECKSUM

BACKUP DATABASE [msdb] TO  DISK = N'E:\Backups\msdb-backup.bak' WITH  INIT ,  NOUNLOAD ,  NAME = N'msdb',  NOSKIP ,  STATS = 10,  NOFORMAT, CHECKSUM

In job step 2, I wrote code to copy backup to share drive as below:

copy E:\Backups\master-backup.bak """\\ABC\Database_Backups\Data\master-backup.bak""" /Y

copy E:\Backups\msdb-backup.bak """\\ABC\Database_Backups\Data\msdb-backup.bak""" /Y

The problem is job getting run successfully but in step 2, only copying the 1 file which listed 1st in step 2 and it is not copying all the files.

In step 2 I want to copy all backup files which was in step 1. Is there a way to make this is working without creating more steps?

please advise.

Thank you in advance.


Viewing all articles
Browse latest Browse all 12963

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>