I am using SQL Server 2005. I have a Backup Database task which I use
to back up to a single backup device. I want to set a retention time
of 3 days and have old backups overwritten. This seems to be the WITH
INIT, NOSKIP problem. However using the wizard there doesn't seem to
be the possibility of doing this. I find it hard to believe though
that anyone would write a wizard which didn't offer this feature.
Is there any way to backup with NOSKIP or failing that alter the SQL
genereated by the wizard.
For info, here's the first few SQL statements from the wizard!
BACKUP DATABASE [master] TO [All299LocalDatabases] WITH RETAINDAYS = 3, NOFORMAT, INIT, NAME = N'master_backup_20070802123131', SKIP,
REWIND, NOUNLOAD, STATS = 10
GO
BACKUP DATABASE [model] TO [All299LocalDatabases] WITH RETAINDAYS = 3, NOFORMAT, NOINIT, NAME = N'model_backup_20070802123131', SKIP,
REWIND, NOUNLOAD, STATS = 10
GO
BACKUP DATABASE [msdb] TO [All299LocalDatabases] WITH RETAINDAYS = 3, NOFORMAT, NOINIT, NAME = N'msdb_backup_20070802123132', SKIP,
REWIND, NOUNLOAD, STATS = 10
GO
BACKUP DATABASE [ReportServer] TO [All299LocalDatabases] WITH
RETAINDAYS = 3, NOFORMAT, NOINIT, NAME = N'ReportServer_backup_20070802123132', SKIP, REWIND, NOUNLOAD, STATS
= 10
GO
etcThere's no way in SQL Server to backup to a single backup device and overwrite "only the oldest"
backups. Either you overwrite everything, or you append. Period.
Now, I understand that the interaction between INIT/NOINIT and SKIP/NOSKIP can be confusing, and
that it probably why there's a section in Books Online titled "Interaction of SKIP, NOSKIP, INIT,
and NOINIT" (in the BACKUP topic). Bu, as mentioned before, SQL Server either overwrites everything
or not at all. This is how the engine work, so it doesn't relate to the maintenance wizard.
Personally,. I don't use SKIP/NOSKIP at all, as I don't find those options adding anything to
INIT/NOINIT.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<usenet@.tynemarch.co.uk> wrote in message
news:1186054522.882732.218720@.d55g2000hsg.googlegroups.com...
>I am using SQL Server 2005. I have a Backup Database task which I use
> to back up to a single backup device. I want to set a retention time
> of 3 days and have old backups overwritten. This seems to be the WITH
> INIT, NOSKIP problem. However using the wizard there doesn't seem to
> be the possibility of doing this. I find it hard to believe though
> that anyone would write a wizard which didn't offer this feature.
> Is there any way to backup with NOSKIP or failing that alter the SQL
> genereated by the wizard.
> For info, here's the first few SQL statements from the wizard!
> BACKUP DATABASE [master] TO [All299LocalDatabases] WITH RETAINDAYS => 3, NOFORMAT, INIT, NAME = N'master_backup_20070802123131', SKIP,
> REWIND, NOUNLOAD, STATS = 10
> GO
> BACKUP DATABASE [model] TO [All299LocalDatabases] WITH RETAINDAYS => 3, NOFORMAT, NOINIT, NAME = N'model_backup_20070802123131', SKIP,
> REWIND, NOUNLOAD, STATS = 10
> GO
> BACKUP DATABASE [msdb] TO [All299LocalDatabases] WITH RETAINDAYS => 3, NOFORMAT, NOINIT, NAME = N'msdb_backup_20070802123132', SKIP,
> REWIND, NOUNLOAD, STATS = 10
> GO
> BACKUP DATABASE [ReportServer] TO [All299LocalDatabases] WITH
> RETAINDAYS = 3, NOFORMAT, NOINIT, NAME => N'ReportServer_backup_20070802123132', SKIP, REWIND, NOUNLOAD, STATS
> = 10
> GO
> etc
>|||I would happily overwrite everything but there doesn't seem to be that
option either in the Wizard. You only have the option that it either
expires or it doesn't as whatever you do it always puts in SKIP into
the SQL. The only way you seem to be able to backup without having old
backups is to backup to individual files rather than using a backup
device as I am.
Rob
On 2 Aug, 12:58, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> There's no way in SQL Server to backup to a single backup device and overwrite "only the oldest"
> backups. Either you overwrite everything, or you append. Period.
> Now, I understand that the interaction between INIT/NOINIT and SKIP/NOSKIP can be confusing, and
> that it probably why there's a section in Books Online titled "Interaction of SKIP, NOSKIP, INIT,
> and NOINIT" (in the BACKUP topic). Bu, as mentioned before, SQL Server either overwrites everything
> or not at all. This is how the engine work, so it doesn't relate to the maintenance wizard.
> Personally,. I don't use SKIP/NOSKIP at all, as I don't find those options adding anything to
> INIT/NOINIT.
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
> <use...@.tynemarch.co.uk> wrote in message
> news:1186054522.882732.218720@.d55g2000hsg.googlegroups.com...
>
> >I am using SQL Server 2005. I have a Backup Database task which I use
> > to back up to a single backup device. I want to set a retention time
> > of 3 days and have old backups overwritten. This seems to be the WITH
> > INIT, NOSKIP problem. However using the wizard there doesn't seem to
> > be the possibility of doing this. I find it hard to believe though
> > that anyone would write a wizard which didn't offer this feature.
> > Is there any way to backup with NOSKIP or failing that alter the SQL
> > genereated by the wizard.
> > For info, here's the first few SQL statements from the wizard!
> > BACKUP DATABASE [master] TO [All299LocalDatabases] WITH RETAINDAYS => > 3, NOFORMAT, INIT, NAME = N'master_backup_20070802123131', SKIP,
> > REWIND, NOUNLOAD, STATS = 10
> > GO
> > BACKUP DATABASE [model] TO [All299LocalDatabases] WITH RETAINDAYS => > 3, NOFORMAT, NOINIT, NAME = N'model_backup_20070802123131', SKIP,
> > REWIND, NOUNLOAD, STATS = 10
> > GO
> > BACKUP DATABASE [msdb] TO [All299LocalDatabases] WITH RETAINDAYS => > 3, NOFORMAT, NOINIT, NAME = N'msdb_backup_20070802123132', SKIP,
> > REWIND, NOUNLOAD, STATS = 10
> > GO
> > BACKUP DATABASE [ReportServer] TO [All299LocalDatabases] WITH
> > RETAINDAYS = 3, NOFORMAT, NOINIT, NAME => > N'ReportServer_backup_20070802123132', SKIP, REWIND, NOUNLOAD, STATS
> > = 10
> > GO
> > etc- Hide quoted text -
> - Show quoted text -|||So what you want to do is to backup to the same backup device name and always overwrite?
In my wizard (I'm on sp2, there has been improvements here...), I see an option "If backup files
exists:" and I select "Overwrite".
Here are the backup commands executed, as catched by Profiler:
BACKUP DATABASE [master] TO [MyDevice] WITH NOFORMAT, INIT, NAME =N'master_backup_20070802151715', SKIP, REWIND, NOUNLOAD, STATS = 10
BACKUP DATABASE [model] TO [MyDevice] WITH NOFORMAT, NOINIT, NAME =N'model_backup_20070802151715', SKIP, REWIND, NOUNLOAD, STATS = 10
As you see, it does INIT for the first backup and NOINIT for the following backups. Is above what
you want, ir are you saying that there's some problem with the TSQL above?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
<usenet@.tynemarch.co.uk> wrote in message
news:1186057933.490529.68270@.l70g2000hse.googlegroups.com...
>I would happily overwrite everything but there doesn't seem to be that
> option either in the Wizard. You only have the option that it either
> expires or it doesn't as whatever you do it always puts in SKIP into
> the SQL. The only way you seem to be able to backup without having old
> backups is to backup to individual files rather than using a backup
> device as I am.
> Rob
> On 2 Aug, 12:58, "Tibor Karaszi"
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
>> There's no way in SQL Server to backup to a single backup device and overwrite "only the oldest"
>> backups. Either you overwrite everything, or you append. Period.
>> Now, I understand that the interaction between INIT/NOINIT and SKIP/NOSKIP can be confusing, and
>> that it probably why there's a section in Books Online titled "Interaction of SKIP, NOSKIP, INIT,
>> and NOINIT" (in the BACKUP topic). Bu, as mentioned before, SQL Server either overwrites
>> everything
>> or not at all. This is how the engine work, so it doesn't relate to the maintenance wizard.
>> Personally,. I don't use SKIP/NOSKIP at all, as I don't find those options adding anything to
>> INIT/NOINIT.
>> --
>> Tibor Karaszi, SQL Server
>> MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
>> <use...@.tynemarch.co.uk> wrote in message
>> news:1186054522.882732.218720@.d55g2000hsg.googlegroups.com...
>>
>> >I am using SQL Server 2005. I have a Backup Database task which I use
>> > to back up to a single backup device. I want to set a retention time
>> > of 3 days and have old backups overwritten. This seems to be the WITH
>> > INIT, NOSKIP problem. However using the wizard there doesn't seem to
>> > be the possibility of doing this. I find it hard to believe though
>> > that anyone would write a wizard which didn't offer this feature.
>> > Is there any way to backup with NOSKIP or failing that alter the SQL
>> > genereated by the wizard.
>> > For info, here's the first few SQL statements from the wizard!
>> > BACKUP DATABASE [master] TO [All299LocalDatabases] WITH RETAINDAYS =>> > 3, NOFORMAT, INIT, NAME = N'master_backup_20070802123131', SKIP,
>> > REWIND, NOUNLOAD, STATS = 10
>> > GO
>> > BACKUP DATABASE [model] TO [All299LocalDatabases] WITH RETAINDAYS =>> > 3, NOFORMAT, NOINIT, NAME = N'model_backup_20070802123131', SKIP,
>> > REWIND, NOUNLOAD, STATS = 10
>> > GO
>> > BACKUP DATABASE [msdb] TO [All299LocalDatabases] WITH RETAINDAYS =>> > 3, NOFORMAT, NOINIT, NAME = N'msdb_backup_20070802123132', SKIP,
>> > REWIND, NOUNLOAD, STATS = 10
>> > GO
>> > BACKUP DATABASE [ReportServer] TO [All299LocalDatabases] WITH
>> > RETAINDAYS = 3, NOFORMAT, NOINIT, NAME =>> > N'ReportServer_backup_20070802123132', SKIP, REWIND, NOUNLOAD, STATS
>> > = 10
>> > GO
>> > etc- Hide quoted text -
>> - Show quoted text -
>|||I could not get the wizard to generate any SQL with SKIP in it.
However, the answer to my problems was to use a one-off backup file
rather than have a pre-allocated backup device. I could then move to
the file to somewhere else and start afresh with a new file the next
day. Thanks for the help anyway.
On 2 Aug, 14:19, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> So what you want to do is to backup to the same backup device name and always overwrite?
> In my wizard (I'm on sp2, there has been improvements here...), I see an option "If backup files
> exists:" and I select "Overwrite".
> Here are the backup commands executed, as catched by Profiler:
> BACKUP DATABASE [master] TO [MyDevice] WITH NOFORMAT, INIT, NAME => N'master_backup_20070802151715', SKIP, REWIND, NOUNLOAD, STATS = 10
> BACKUP DATABASE [model] TO [MyDevice] WITH NOFORMAT, NOINIT, NAME => N'model_backup_20070802151715', SKIP, REWIND, NOUNLOAD, STATS = 10
> As you see, it does INIT for the first backup and NOINIT for the following backups. Is above what
> you want, ir are you saying that there's some problem with the TSQL above?
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
> <use...@.tynemarch.co.uk> wrote in message
> news:1186057933.490529.68270@.l70g2000hse.googlegroups.com...
>
> >I would happily overwrite everything but there doesn't seem to be that
> > option either in the Wizard. You only have the option that it either
> > expires or it doesn't as whatever you do it always puts in SKIP into
> > the SQL. The only way you seem to be able to backup without having old
> > backups is to backup to individual files rather than using a backup
> > device as I am.
> > Rob
> > On 2 Aug, 12:58, "Tibor Karaszi"
> > <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> >> There's no way in SQL Server to backup to a single backup device and overwrite "only the oldest"
> >> backups. Either you overwrite everything, or you append. Period.
> >> Now, I understand that the interaction between INIT/NOINIT and SKIP/NOSKIP can be confusing, and
> >> that it probably why there's a section in Books Online titled "Interaction of SKIP, NOSKIP, INIT,
> >> and NOINIT" (in the BACKUP topic). Bu, as mentioned before, SQL Server either overwrites
> >> everything
> >> or not at all. This is how the engine work, so it doesn't relate to the maintenance wizard.
> >> Personally,. I don't use SKIP/NOSKIP at all, as I don't find those options adding anything to
> >> INIT/NOINIT.
> >> --
> >> Tibor Karaszi, SQL Server
> >> MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/...
> >> <use...@.tynemarch.co.uk> wrote in message
> >>news:1186054522.882732.218720@.d55g2000hsg.googlegroups.com...
> >> >I am using SQL Server 2005. I have a Backup Database task which I use
> >> > to back up to a single backup device. I want to set a retention time
> >> > of 3 days and have old backups overwritten. This seems to be the WITH
> >> > INIT, NOSKIP problem. However using the wizard there doesn't seem to
> >> > be the possibility of doing this. I find it hard to believe though
> >> > that anyone would write a wizard which didn't offer this feature.
> >> > Is there any way to backup with NOSKIP or failing that alter the SQL
> >> > genereated by the wizard.
> >> > For info, here's the first few SQL statements from the wizard!
> >> > BACKUP DATABASE [master] TO [All299LocalDatabases] WITH RETAINDAYS => >> > 3, NOFORMAT, INIT, NAME = N'master_backup_20070802123131', SKIP,
> >> > REWIND, NOUNLOAD, STATS = 10
> >> > GO
> >> > BACKUP DATABASE [model] TO [All299LocalDatabases] WITH RETAINDAYS => >> > 3, NOFORMAT, NOINIT, NAME = N'model_backup_20070802123131', SKIP,
> >> > REWIND, NOUNLOAD, STATS = 10
> >> > GO
> >> > BACKUP DATABASE [msdb] TO [All299LocalDatabases] WITH RETAINDAYS => >> > 3, NOFORMAT, NOINIT, NAME = N'msdb_backup_20070802123132', SKIP,
> >> > REWIND, NOUNLOAD, STATS = 10
> >> > GO
> >> > BACKUP DATABASE [ReportServer] TO [All299LocalDatabases] WITH
> >> > RETAINDAYS = 3, NOFORMAT, NOINIT, NAME => >> > N'ReportServer_backup_20070802123132', SKIP, REWIND, NOUNLOAD, STATS
> >> > = 10
> >> > GO
> >> > etc- Hide quoted text -
> >> - Show quoted text -- Hide quoted text -
> - Show quoted text -
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment