Sunday, February 19, 2012

Hot backup in SIMPLE mode

We have a SQL Server 7.0 database running with trunc. log on chkpt and
select into/bulkcopy checked and need to develop a backup strategy.

One of our DBAs insists that since the transaction log is being
truncated, we can't do a hot backup (a FULL backup in multiuser mode)
because if a transaction comes through during the backup it will leave
the backup in an inconsistent state. I'm skeptical, but I don't know
how SQL Server 7 avoids this problem.

If SQL 7 is not truncating the transaction log, it uses the
transaction log to roll forward changes that occurred during the
backup. Obviously if it's truncating the log it must have some way to
apply these transactions anyway (such as not doing a checkpoint during
the backup, backing up the log at each checkpoint, etc.).

Can anyone confirm that a hot backup will be valid when trunc. log on
chkpt is checked? Does anyone know how SQL 7 accomplishes this?

Thanks!
Jamesbrundege@.ohsu.edu (JB) wrote in message news:<53dd16fb.0307171332.2c9aa97a@.posting.google.com>...
> We have a SQL Server 7.0 database running with trunc. log on chkpt and
> select into/bulkcopy checked and need to develop a backup strategy.
> One of our DBAs insists that since the transaction log is being
> truncated, we can't do a hot backup (a FULL backup in multiuser mode)
> because if a transaction comes through during the backup it will leave
> the backup in an inconsistent state. I'm skeptical, but I don't know
> how SQL Server 7 avoids this problem.

This is not correct - a full backup (BACKUP DATABASE ...) is always
consistent, and database settings will not affect that.

> If SQL 7 is not truncating the transaction log, it uses the
> transaction log to roll forward changes that occurred during the
> backup. Obviously if it's truncating the log it must have some way to
> apply these transactions anyway (such as not doing a checkpoint during
> the backup, backing up the log at each checkpoint, etc.).

SQL Server records the log sequence number (LSN) when the backup
starts, then again when it ends, and uses the LSNs to include part of
the log in the backup set. That part of the log can then be applied
when the backup is restored, to ensure the data is consistent.

> Can anyone confirm that a hot backup will be valid when trunc. log on
> chkpt is checked? Does anyone know how SQL 7 accomplishes this?
> Thanks!
> James

All backups in SQL Server are 'hot', in the sense that you never need
to take the database offline, stop the MSSQL service etc.

Simon|||<snip
I don't have SQL7 BOL, but according to SQL2000 BOL "The exception is that
the log is not truncated if the checkpoint occurs when a BACKUP statement is
still active." This is in the section called "Truncating the Transaction
Log". I would guess if you check the equivalent section in SQL7 BOL you'll
find the same statement.

Simon|||Perfect! The relevant section, as shown below, suggests that the database will come out of log truncation mode for the duration of the backup:

From SQL Server 7.0 Books Online:
http://download.microsoft.com/downl...n-US/SQLBOL.exe

"The trunc. log on chkpt. database option must be set to TRUE for a database to be eligible for log truncate mode. Whether the database is actually in log truncate mode also depends on the state of the database:

- The database comes out of log truncate mode when a BACKUP DATABASE statement is executed. This is because a BACKUP DATABASE statement is the starting point of a log backup sequence.

..."

Thanks Simon!
James

>>> Simon Hayes<sql@.hayes.ch> 07/18/03 09:19AM >>>
<snip
I don't have SQL7 BOL, but according to SQL2000 BOL "The exception is that
the log is not truncated if the checkpoint occurs when a BACKUP statement is
still active." This is in the section called "Truncating the Transaction
Log". I would guess if you check the equivalent section in SQL7 BOL you'll
find the same statement.

Simon

No comments:

Post a Comment