gizmoadria
asked on
Robocopy to backup SQL DB
I want to use robocopy.exe for the backup of two db files. Currently the sql server keeps about 5 backups for each.
The directory layout looks like this:
dbfile
dbfile_db_200410292000.bak
dbfile_db_200410302000.bak
dbfile_db_200411012000.bak
so I want to copy the newest file over each night to our backup server.
thanks in advance!
ASKER
It copied everything.
here is my syntax:
del S:\*.* /Q
xcopy D:\SQL\MSSQL\BACKUP\*.* S:\ /m
here is my syntax:
del S:\*.* /Q
xcopy D:\SQL\MSSQL\BACKUP\*.* S:\ /m
Two things - did you check if the archive attribute was set on everything first? A simply copy does not turn it off. If it copied everything, then it has now set all the files in that folder so the attribute is off. Any NEW file added to it since you ran XCOPY should be copied the next time you run the command.
If you run a dir /aa it will show all files with the archive attribute. You can all attributes for all files by running typing attrib in the directory. Any with the "A" listed should be copied the next time the xcopy command I gave is run. At that time, it will also remove the A from those files.
If you run a dir /aa it will show all files with the archive attribute. You can all attributes for all files by running typing attrib in the directory. Any with the "A" listed should be copied the next time the xcopy command I gave is run. At that time, it will also remove the A from those files.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
XCOPY /m *.* destination
The /m copies files with the archive attribute on, then turns it off. only new files will have it on, so only new files will be copied.