Link to home
Start Free TrialLog in
Avatar of naqayya
naqayya

asked on

Backups to overwrite, not append

I have SQL Server 2000 running on a Win2K Server platform.

I use the SQL Server Agent > Jobs to schedule daily backups of my databases.
The backups are done to a hard drive on the network.
I have 7 backups, one for each day of the week, so that I can keep the last whole weeks data. Each days backup is done to a different file.

This is the T-SQL I use to run Mondays backup:

backup database myDB
to myDB_mon_backup
with
retaindays = 6


The problem I am having is that when the next Mondays backup runs it APPENDS the backup to the old file, so my backup file gets bigger and bigger every week.

Can you show me the T-SQL that will OVERWRITE the old backup?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of arbert
arbert

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of naqayya
naqayya

ASKER

Is this the correct syntax:

backup database myDB
to myDB_mon_backup
with
retaindays = 6,
INIT
If you right click on your database and choose "All Tasks", "Maintenance Plan" a wizard will help you set up a plan that will automatically give individual names to the backup files based on the database name and the date of backup.   They are not appended (I think that is the only way it works, i.e. append isn't an option). It's really easy to do and the best way I have found to set up my backups.
Avatar of naqayya

ASKER

Thanks for your help FatalErr. I would rather stick to the backups that I have already setup for the time being, so arbert's solution is good for me.

Thanks again.