Sunday, March 11, 2012

Backup Database

HI

i have created job which executes following Store Procedure, my Qs is after 1-day has passed shldnt it overwrite , i mean i have 1-GB Database my job runs for 3-times a day so end of day i have 3-GB so wen time goes past 12.00 am shldnt it becomes 1-GB again

Alter Procedure sp_DBBackup as
BACKUP DATABASE [XYZ] TO
DISK = N'D:\Office Purpose\Database\Backups\XYZ\Backup-Method (Append-Expiry)\XYZ_Complete_Append.Bak'
WITH NOINIT ,
NOUNLOAD ,
RETAINDAYS = 1,
NAME = N'XYZ backup',
NOSKIP ,
STATS = 10,
NOFORMAT

No....you are using NOINIT so you are appending backups to the device. You would use RETAINDAYS to throw up an error message if you try to do an INIT and you do a NOSKIP meaning that it will check to see if you have any backups that aren't yet expired. If there are backups not yet expired, you get an error. That's about all RETAINDAYS does - it won't maintain your history for you - it just keeps you from overwriting.

-Sue

No comments:

Post a Comment