Tuesday, March 20, 2012
Backup DB to File WITH INIT?
BACKUP DATABASE XXX TO DISK = @.MyFile
-- If @.MyFile exists, i want to overwrite it. The help file says "Use
the INIT clause to overwrite the backup media, and write the backup as
the first file ... ". This sounds like it will clean-up my entire D-
Drive and then do the backup. It should simply overwrite the specific
file @.MyFile if it exists. I just want to be a 100% sure before I run
this command.
Thanks,
Jay
WITH INIT = delete all the backups in your backup device, which is the .BAK
file you specified. This means, everytime you backup, you only have the
backup from the last time the backup command executed.
"Jay" <jay6447@.hotmail.com> wrote in message
news:1183609141.844241.152410@.d30g2000prg.googlegr oups.com...
> I am using:
> BACKUP DATABASE XXX TO DISK = @.MyFile
> -- If @.MyFile exists, i want to overwrite it. The help file says "Use
> the INIT clause to overwrite the backup media, and write the backup as
> the first file ... ". This sounds like it will clean-up my entire D-
> Drive and then do the backup. It should simply overwrite the specific
> file @.MyFile if it exists. I just want to be a 100% sure before I run
> this command.
> Thanks,
> Jay
>
|||Jay
It will NOT clean your entire drive. Think about it, as if you backup
database on C:\ drive BACKUP DATABASE commnad would destroy the OS ?
BOL says
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.
"Jay" <jay6447@.hotmail.com> wrote in message
news:1183609141.844241.152410@.d30g2000prg.googlegr oups.com...
> I am using:
> BACKUP DATABASE XXX TO DISK = @.MyFile
> -- If @.MyFile exists, i want to overwrite it. The help file says "Use
> the INIT clause to overwrite the backup media, and write the backup as
> the first file ... ". This sounds like it will clean-up my entire D-
> Drive and then do the backup. It should simply overwrite the specific
> file @.MyFile if it exists. I just want to be a 100% sure before I run
> this command.
> Thanks,
> Jay
>
|||OK, does this mean that if I have older backup files like
(MYDB_20061231.bak, MYDB_20070101.bak....) they all will be deleted?
On Jul 5, 10:18 am, "Uri Dimant" <u...@.iscar.co.il> wrote:
> Jay
> It will NOT clean your entire drive. Think about it, as if you backup
> database on C:\ drive BACKUP DATABASE commnad would destroy the OS ?
> BOL says
> 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.
> "Jay" <jay6...@.hotmail.com> wrote in message
> news:1183609141.844241.152410@.d30g2000prg.googlegr oups.com...
>
>
>
>
> - Show quoted text -
|||Jay
if MYDB_20061231.bak contains more than one file and you issue BACKUP
DATABASE db to disk='c:\MYDB_20061231.bak' WITH INIT so YES it will be
overwritten
"Jay" <jay6447@.hotmail.com> wrote in message
news:1183614106.316025.235930@.j4g2000prf.googlegro ups.com...
> OK, does this mean that if I have older backup files like
> (MYDB_20061231.bak, MYDB_20070101.bak....) they all will be deleted?
>
> On Jul 5, 10:18 am, "Uri Dimant" <u...@.iscar.co.il> wrote:
>
|||OK - thanks. I got it. I didn't know a backup file can contain more
than one backups.
On Jul 5, 10:58 am, "Uri Dimant" <u...@.iscar.co.il> wrote:
> Jay
> if MYDB_20061231.bak contains more than one file and you issue BACKUP
> DATABASE db to disk='c:\MYDB_20061231.bak' WITH INIT so YES it will be
> overwritten
> "Jay" <jay6...@.hotmail.com> wrote in message
> news:1183614106.316025.235930@.j4g2000prf.googlegro ups.com...
>
>
>
>
>
>
> - Show quoted text -
Backup DB to File WITH INIT?
BACKUP DATABASE XXX TO DISK = @.MyFile
-- If @.MyFile exists, i want to overwrite it. The help file says "Use
the INIT clause to overwrite the backup media, and write the backup as
the first file ... ". This sounds like it will clean-up my entire D-
Drive and then do the backup. It should simply overwrite the specific
file @.MyFile if it exists. I just want to be a 100% sure before I run
this command.
Thanks,
JayWITH INIT = delete all the backups in your backup device, which is the .BAK
file you specified. This means, everytime you backup, you only have the
backup from the last time the backup command executed.
"Jay" <jay6447@.hotmail.com> wrote in message
news:1183609141.844241.152410@.d30g2000prg.googlegroups.com...
> I am using:
> BACKUP DATABASE XXX TO DISK = @.MyFile
> -- If @.MyFile exists, i want to overwrite it. The help file says "Use
> the INIT clause to overwrite the backup media, and write the backup as
> the first file ... ". This sounds like it will clean-up my entire D-
> Drive and then do the backup. It should simply overwrite the specific
> file @.MyFile if it exists. I just want to be a 100% sure before I run
> this command.
> Thanks,
> Jay
>|||Jay
It will NOT clean your entire drive. Think about it, as if you backup
database on C:\ drive BACKUP DATABASE commnad would destroy the OS ?
BOL says
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.
"Jay" <jay6447@.hotmail.com> wrote in message
news:1183609141.844241.152410@.d30g2000prg.googlegroups.com...
> I am using:
> BACKUP DATABASE XXX TO DISK = @.MyFile
> -- If @.MyFile exists, i want to overwrite it. The help file says "Use
> the INIT clause to overwrite the backup media, and write the backup as
> the first file ... ". This sounds like it will clean-up my entire D-
> Drive and then do the backup. It should simply overwrite the specific
> file @.MyFile if it exists. I just want to be a 100% sure before I run
> this command.
> Thanks,
> Jay
>|||OK, does this mean that if I have older backup files like
(MYDB_20061231.bak, MYDB_20070101.bak....) they all will be deleted?
On Jul 5, 10:18 am, "Uri Dimant" <u...@.iscar.co.il> wrote:
> Jay
> It will NOT clean your entire drive. Think about it, as if you backup
> database on C:\ drive BACKUP DATABASE commnad would destroy the OS ?
> BOL says
> 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.
> "Jay" <jay6...@.hotmail.com> wrote in message
> news:1183609141.844241.152410@.d30g2000prg.googlegroups.com...
>
>
> > I am using:
> > BACKUP DATABASE XXX TO DISK = @.MyFile
> > -- If @.MyFile exists, i want to overwrite it. The help file says "Use
> > the INIT clause to overwrite the backup media, and write the backup as
> > the first file ... ". This sounds like it will clean-up my entire D-
> > Drive and then do the backup. It should simply overwrite the specific
> > file @.MyFile if it exists. I just want to be a 100% sure before I run
> > this command.
> > Thanks,
> > Jay- Hide quoted text -
> - Show quoted text -|||Jay
if MYDB_20061231.bak contains more than one file and you issue BACKUP
DATABASE db to disk='c:\MYDB_20061231.bak' WITH INIT so YES it will be
overwritten
"Jay" <jay6447@.hotmail.com> wrote in message
news:1183614106.316025.235930@.j4g2000prf.googlegroups.com...
> OK, does this mean that if I have older backup files like
> (MYDB_20061231.bak, MYDB_20070101.bak....) they all will be deleted?
>
> On Jul 5, 10:18 am, "Uri Dimant" <u...@.iscar.co.il> wrote:
>> Jay
>> It will NOT clean your entire drive. Think about it, as if you backup
>> database on C:\ drive BACKUP DATABASE commnad would destroy the OS ?
>> BOL says
>> 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.
>> "Jay" <jay6...@.hotmail.com> wrote in message
>> news:1183609141.844241.152410@.d30g2000prg.googlegroups.com...
>>
>>
>> > I am using:
>> > BACKUP DATABASE XXX TO DISK = @.MyFile
>> > -- If @.MyFile exists, i want to overwrite it. The help file says "Use
>> > the INIT clause to overwrite the backup media, and write the backup as
>> > the first file ... ". This sounds like it will clean-up my entire D-
>> > Drive and then do the backup. It should simply overwrite the specific
>> > file @.MyFile if it exists. I just want to be a 100% sure before I run
>> > this command.
>> > Thanks,
>> > Jay- Hide quoted text -
>> - Show quoted text -
>|||OK - thanks. I got it. I didn't know a backup file can contain more
than one backups.
On Jul 5, 10:58 am, "Uri Dimant" <u...@.iscar.co.il> wrote:
> Jay
> if MYDB_20061231.bak contains more than one file and you issue BACKUP
> DATABASE db to disk='c:\MYDB_20061231.bak' WITH INIT so YES it will be
> overwritten
> "Jay" <jay6...@.hotmail.com> wrote in message
> news:1183614106.316025.235930@.j4g2000prf.googlegroups.com...
>
> > OK, does this mean that if I have older backup files like
> > (MYDB_20061231.bak, MYDB_20070101.bak....) they all will be deleted?
> > On Jul 5, 10:18 am, "Uri Dimant" <u...@.iscar.co.il> wrote:
> >> Jay
> >> It will NOT clean your entire drive. Think about it, as if you backup
> >> database on C:\ drive BACKUP DATABASE commnad would destroy the OS ?
> >> BOL says
> >> 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.
> >> "Jay" <jay6...@.hotmail.com> wrote in message
> >>news:1183609141.844241.152410@.d30g2000prg.googlegroups.com...
> >> > I am using:
> >> > BACKUP DATABASE XXX TO DISK = @.MyFile
> >> > -- If @.MyFile exists, i want to overwrite it. The help file says "Use
> >> > the INIT clause to overwrite the backup media, and write the backup as
> >> > the first file ... ". This sounds like it will clean-up my entire D-
> >> > Drive and then do the backup. It should simply overwrite the specific
> >> > file @.MyFile if it exists. I just want to be a 100% sure before I run
> >> > this command.
> >> > Thanks,
> >> > Jay- Hide quoted text -
> >> - Show quoted text -- Hide quoted text -
> - Show quoted text -
Backup DB to File WITH INIT?
BACKUP DATABASE XXX TO DISK = @.MyFile
-- If @.MyFile exists, i want to overwrite it. The help file says "Use
the INIT clause to overwrite the backup media, and write the backup as
the first file ... ". This sounds like it will clean-up my entire D-
Drive and then do the backup. It should simply overwrite the specific
file @.MyFile if it exists. I just want to be a 100% sure before I run
this command.
Thanks,
JayWITH INIT = delete all the backups in your backup device, which is the .BAK
file you specified. This means, everytime you backup, you only have the
backup from the last time the backup command executed.
"Jay" <jay6447@.hotmail.com> wrote in message
news:1183609141.844241.152410@.d30g2000prg.googlegroups.com...
> I am using:
> BACKUP DATABASE XXX TO DISK = @.MyFile
> -- If @.MyFile exists, i want to overwrite it. The help file says "Use
> the INIT clause to overwrite the backup media, and write the backup as
> the first file ... ". This sounds like it will clean-up my entire D-
> Drive and then do the backup. It should simply overwrite the specific
> file @.MyFile if it exists. I just want to be a 100% sure before I run
> this command.
> Thanks,
> Jay
>|||Jay
It will NOT clean your entire drive. Think about it, as if you backup
database on C:\ drive BACKUP DATABASE commnad would destroy the OS ?
BOL says
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.
"Jay" <jay6447@.hotmail.com> wrote in message
news:1183609141.844241.152410@.d30g2000prg.googlegroups.com...
> I am using:
> BACKUP DATABASE XXX TO DISK = @.MyFile
> -- If @.MyFile exists, i want to overwrite it. The help file says "Use
> the INIT clause to overwrite the backup media, and write the backup as
> the first file ... ". This sounds like it will clean-up my entire D-
> Drive and then do the backup. It should simply overwrite the specific
> file @.MyFile if it exists. I just want to be a 100% sure before I run
> this command.
> Thanks,
> Jay
>|||OK, does this mean that if I have older backup files like
(MYDB_20061231.bak, MYDB_20070101.bak....) they all will be deleted?
On Jul 5, 10:18 am, "Uri Dimant" <u...@.iscar.co.il> wrote:
> Jay
> It will NOT clean your entire drive. Think about it, as if you backup
> database on C:\ drive BACKUP DATABASE commnad would destroy the OS ?
> BOL says
> 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.
> "Jay" <jay6...@.hotmail.com> wrote in message
> news:1183609141.844241.152410@.d30g2000prg.googlegroups.com...
>
>
>
>
>
>
> - Show quoted text -|||Jay
if MYDB_20061231.bak contains more than one file and you issue BACKUP
DATABASE db to disk='c:\MYDB_20061231.bak' WITH INIT so YES it will be
overwritten
"Jay" <jay6447@.hotmail.com> wrote in message
news:1183614106.316025.235930@.j4g2000prf.googlegroups.com...
> OK, does this mean that if I have older backup files like
> (MYDB_20061231.bak, MYDB_20070101.bak....) they all will be deleted?
>
> On Jul 5, 10:18 am, "Uri Dimant" <u...@.iscar.co.il> wrote:
>|||OK - thanks. I got it. I didn't know a backup file can contain more
than one backups.
On Jul 5, 10:58 am, "Uri Dimant" <u...@.iscar.co.il> wrote:
> Jay
> if MYDB_20061231.bak contains more than one file and you issue BACKUP
> DATABASE db to disk='c:\MYDB_20061231.bak' WITH INIT so YES it will be
> overwritten
> "Jay" <jay6...@.hotmail.com> wrote in message
> news:1183614106.316025.235930@.j4g2000prf.googlegroups.com...
>
>
>
>
>
>
>
>
>
>
> - Show quoted text -sql
Monday, March 19, 2012
Backup database problem
In options for backup I picked overwrite existing file, but for some reasons it still creates new file with the date associated with it
What strange about that is ,it strippes old file from the date and new file has the date in file nameIf you are using the Database Maintenance planner or the xp_sqlmaint procedure, they will use a file naming convention which may be different than the old backup that is on your system, so they won't touch the old file because they don't recognize it.
Also, when overwriting files, Windows applications typically create a new file and then delete the old file and rename the new file when the new file is complete. So you can still run out of disk space if you don't have enough room for two copies of the file.
blindman
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
Thursday, February 16, 2012
Backup - Append vs Overwrite?
If backing up a database to a disk file from within Enterprise Manager, it
seems you still get a choice between "Append" and "Overwrite". I don't
understand how these options work with disk files.
Does it mean that if you supply the exact same file name as an earlier
backup, the backup will be appended to the existing file (the file will
double in size but you'll still only have one file?).
Is it the case that if you supply a FileName that's never been used before,
it makes no difference whether you choose Append or Overwrite at this stage?
I've always used Maintenance plans for backup, and it seems you don't get a
choice about Append and Overwrite.
Thanks for any help.
Gerry Hickman
SSRU SysAdminSee inline.....
>If backing up a database to a disk file from within Enterprise Manager, it
>seems you still get a choice between "Append" and "Overwrite". I don't
>understand how these options work with disk files.
>Does it mean that if you supply the exact same file name as an earlier
>backup, the backup will be appended to the existing file (the file will
>double in size but you'll still only have one file?).
Yes it appends the backup to the file so you have one file
and two different backups in the file.
>Is it the case that if you supply a FileName that's never been used before,
>it makes no difference whether you choose Append or Overwrite at this stage?[/vbcol
]
There is nothing to append to as it will be making a new
backup.
[vbcol=seagreen]
>I've always used Maintenance plans for backup, and it seems you don't get a
>choice about Append and Overwrite.
The sqlmaint utility which the database maintenace plan uses
always does an append. You could always just write your own
backup in T-SQL using the with init or noinit options which
controls the append or overwrite behaviors. See BOL Backup
for more details on the options.
-Sue
Backup - Append vs Overwrite?
If backing up a database to a disk file from within Enterprise Manager, it
seems you still get a choice between "Append" and "Overwrite". I don't
understand how these options work with disk files.
Does it mean that if you supply the exact same file name as an earlier
backup, the backup will be appended to the existing file (the file will
double in size but you'll still only have one file?).
Is it the case that if you supply a FileName that's never been used before,
it makes no difference whether you choose Append or Overwrite at this stage?
I've always used Maintenance plans for backup, and it seems you don't get a
choice about Append and Overwrite.
Thanks for any help.
Gerry Hickman
SSRU SysAdmin
See inline.....
>If backing up a database to a disk file from within Enterprise Manager, it
>seems you still get a choice between "Append" and "Overwrite". I don't
>understand how these options work with disk files.
>Does it mean that if you supply the exact same file name as an earlier
>backup, the backup will be appended to the existing file (the file will
>double in size but you'll still only have one file?).
Yes it appends the backup to the file so you have one file
and two different backups in the file.
>Is it the case that if you supply a FileName that's never been used before,
>it makes no difference whether you choose Append or Overwrite at this stage?
There is nothing to append to as it will be making a new
backup.
>I've always used Maintenance plans for backup, and it seems you don't get a
>choice about Append and Overwrite.
The sqlmaint utility which the database maintenace plan uses
always does an append. You could always just write your own
backup in T-SQL using the with init or noinit options which
controls the append or overwrite behaviors. See BOL Backup
for more details on the options.
-Sue
Backup - Append vs Overwrite?
If backing up a database to a disk file from within Enterprise Manager, it
seems you still get a choice between "Append" and "Overwrite". I don't
understand how these options work with disk files.
Does it mean that if you supply the exact same file name as an earlier
backup, the backup will be appended to the existing file (the file will
double in size but you'll still only have one file?).
Is it the case that if you supply a FileName that's never been used before,
it makes no difference whether you choose Append or Overwrite at this stage?
I've always used Maintenance plans for backup, and it seems you don't get a
choice about Append and Overwrite.
Thanks for any help.
--
Gerry Hickman
SSRU SysAdminSee inline.....
>If backing up a database to a disk file from within Enterprise Manager, it
>seems you still get a choice between "Append" and "Overwrite". I don't
>understand how these options work with disk files.
>Does it mean that if you supply the exact same file name as an earlier
>backup, the backup will be appended to the existing file (the file will
>double in size but you'll still only have one file?).
Yes it appends the backup to the file so you have one file
and two different backups in the file.
>Is it the case that if you supply a FileName that's never been used before,
>it makes no difference whether you choose Append or Overwrite at this stage?
There is nothing to append to as it will be making a new
backup.
>I've always used Maintenance plans for backup, and it seems you don't get a
>choice about Append and Overwrite.
The sqlmaint utility which the database maintenace plan uses
always does an append. You could always just write your own
backup in T-SQL using the with init or noinit options which
controls the append or overwrite behaviors. See BOL Backup
for more details on the options.
-Sue