0

I am using a custom made application that is using MSDE 2000 transact SQL. Thing is that I've made a simple batch file in order to save databases automatically every day but it seems I made a mistake... I never expected the server to save in the same file if the file already exists (thought it will overwrites it) in the destination folder and now I have a single file with multiple backups in it. Is there a way to separate backups within this file and to extract only the last backup? Restoring this backup file recreates the database with no error but it actually restores the first backup (the oldest).
The line used to save database is something like this:

osql -Usa -P -n -Q "BACKUP DATABASE ciel1 TO DISK = 'e:\BackUp2\Ciel1_1.bak'"

Thanks in advance for any help.....:)...

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by SorinX
0

I am using a custom made application that is using MSDE 2000 transact SQL. Thing is that I've made a simple batch file in order to save databases automatically every day but it seems I made a mistake... I never expected the server to save in the same file if the file already exists (thought it will overwrites it) in the destination folder and now I have a single file with multiple backups in it. Is there a way to separate backups within this file and to extract only the last backup? Restoring this backup file recreates the database with no error but it actually restores the first backup (the oldest).
The line used to save database is something like this:

osql -Usa -P -n -Q "BACKUP DATABASE ciel1 TO DISK = 'e:\BackUp2\Ciel1_1.bak'"

Thanks in advance for any help.....:)...

I'm not sure if you can separate it in the same file but you could simply rename the file with a datetime stamp after the file is created. Put something along these lines in the .bat file to rename it.
It's not exactly what you were looking for but may be an easy work around.
To Rename Any File With Date And Time Padded
set dd = %date% %Time%
Ren File_To_Rename.txt NewFileName__%dd:~0,2%_%dd:~3,2%_%dd:~6,4%___%dd:~11,2%_%dd:~14,2%.txt
Output
--------
NewFileName__22_05_2009__6_20.txt

0

Thanks for the idea Dean but I have already resolved that issue for the future backups. I have created an automated task that puts all backups into an archive and adds the date to the name since it both saves space and avoid future problems. Once the archive is created then all files are deleted. The problem remains though with those files already created.....:(....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.