0

Using SQL Server Express. To get automatic daily backups I have set up this stored procedure from Microsoft instructions here.

Going into Microsoft SQL Server Management studio I see that the backups that are created are available in the Restore feature as a timeline. That's nice.

My question is how to manage the backups? Each time I back up I will end up with about 75Mb of data. This will stack up real quick at 1 backup a day.

Is there a good solution to keep the last 7 backups and then weekly on every Friday or some schedule like that? I'd rather not do that manually.

1 Answer 1

1

If you also created a batch file as Microsoft suggested in the "step B" at the end of the link you shared, you could add another line to the file to purge old backup files. I did it by using a Windows CMD to go through my sub-folders and remove files older than X number of days.

:: -------------------------------------------------------------------------------------------------------------- :: << Auxiliary variables >> :: -------------------------------------------------------------------------------------------------------------- set bkpdirectory=E:\MSSQL\Backup\FULL set cleanup=7 :: -------------------------------------------------------------------------------------------------------------- :: << Clean up all backup files older than 7 days >> :: -------------------------------------------------------------------------------------------------------------- Forfiles -p "%bkpdirectory%" -s -m *.bak /D -%cleanup% /C "cmd /c del @path" 

Hope it helps.

1
  • Yes, saw this. Somewhat helpful. I'd like to manage them more. Keep last 7 days and then one a week for a month. Commented Jan 24, 2018 at 0:09

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.