Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Backups Question

Status
Not open for further replies.

qsac

Programmer
Jan 22, 2002
242
US
Is there a way to edit the backup job to delete the old backups before it backs up the current days stuff?

I tried playing with the TSQL statement with no luck.

Thank You,
Steve
 
use INIT which will overwrite the previous

INIT
Specifies that all backup sets should be overwritten, but preserves the media header. If INIT is specified, any existing backup set data on that device is overwritten

TSQL would like this:
BACKUP DATABASE [DBNAME]
TO [BACKUPDEVICE]
WITH INIT ,
NOUNLOAD ,
NAME = N' RentRoll',
NOSKIP ,
STATS = 10,
NOFORMAT

hope this helps
 
I am sorry, i will be more specific with my question.

I need to keep 2 days of backups on the server. So now, the server backs up the DBs, which make 3 days of back ups. Than after the backups, it deletes the oldest days of backups.

I just want to delete the oldest day first, and than run the backup.

Any Ideas?
 
Try creating Backup Jobs with BackupDevices for the days
Then on the job that you want to overwrite include the INIT.

Let me know if it makes sense or not.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top