|   | ![]() |
|
How can I overwrite expired
backups on a disk device to save on space and still keep a rolling <x> days there? You can't. Without searching the entire file SQL has no way of knowing how much space each backup takes. To delete one part it would have to read the current backup file and write out all the un-expired dumps to a new file and then delete/rename. And only then could it write the new one to the end. All this would take far too long and too much disk space. The expiry date is JUST there to prevent accidental overwrites and nothing else. If you want to keep a rolling number of dumps then write them out with different names each day using the DISK= option of the dump command. Then have a regular task check these dumps and delete old ones. |
All content on this site, except where noted, represents an original work of Michael R. Hotek and is protected by applicable copyright laws. The SQL Server FAQ is the sole work of Neil Pike. No page, portion of a page, or download may be used for commercial purposes in whole or in part without the express, written permission of the applicable author.