Tuesday, March 27, 2012

Difference between NORECOVERY and NO_TRUNCATE

Hi
Can some body explain me the difference between NORECOVERY and NO_TRUNCATE
with options for BACKUP LOG statement.
NO_TRUNCATE
Specifies that the log not be truncated and causes the Database Engine to
attempt the backup regardless of the state of the database. Consequently, a
backup taken with NO_TRUNCATE might have incomplete metadata. This option
allows backing up the log in situations where the database is damaged.
NORECOVERY
Backs up the tail of the log and leaves the database in the RESTORING state.
NORECOVERY is useful when failing over to a secondary database or when
saving the tail of the log before a RESTORE operation.
For more info about BACKUP command go to the following link:
http://msdn2.microsoft.com/en-us/library/ms186865.aspx
Ekrem ?nsoy
"Balaji" <Balaji@.discussions.microsoft.com> wrote in message
news:58439EBF-9080-484F-A5DD-B9856BD0913E@.microsoft.com...
> Hi
> Can some body explain me the difference between NORECOVERY and NO_TRUNCATE
> with options for BACKUP LOG statement.
>
|||Hi Ekrem,
Can you please explain the difference with an example.
"Ekrem ?nsoy" wrote:

> NO_TRUNCATE
> Specifies that the log not be truncated and causes the Database Engine to
> attempt the backup regardless of the state of the database. Consequently, a
> backup taken with NO_TRUNCATE might have incomplete metadata. This option
> allows backing up the log in situations where the database is damaged.
> NORECOVERY
> Backs up the tail of the log and leaves the database in the RESTORING state.
> NORECOVERY is useful when failing over to a secondary database or when
> saving the tail of the log before a RESTORE operation.
> For more info about BACKUP command go to the following link:
> http://msdn2.microsoft.com/en-us/library/ms186865.aspx
> --
> Ekrem ?nsoy
>
> "Balaji" <Balaji@.discussions.microsoft.com> wrote in message
> news:58439EBF-9080-484F-A5DD-B9856BD0913E@.microsoft.com...
>
|||There are three ways of Recovery State:
1-RECOVERY
2-NORECOVERY
3-STANDBY
If you restore your database in recovery, then your database will be online
and your users will be able to perform any operation against it.
If you restore your database in NORECOVERY then your users will not be able
to query your database.
If you restore your database in STANDBY then your users will be able to use
only SELECT against it.
Every recovery state has a purpose. You should read about this from BOL for
more information.
For example NORECOVERY and STANDBY states are being used in Log Shipping. If
you use NORECOVERY for your Log Shipping solution then your users will not
be able to query against the database on your secondary server. If you
restore your secondary database then your users will be able to query (only
SELECT) against it however your users will be disconnected each time for the
new transactions to be applied to the secondary database.
Example for no_truncate:
BACKUP LOG AdventureWorks TO DISK = N'C:\test\tiesto.bak' WITH NO_TRUNCATE
This hint is used for inaccessible database. Tibor has an article about
this, you can read it for more info:
http://www.karaszi.com/SQLServer/info_restore_no_truncate.asp
Ekrem ?nsoy
"Balaji" <Balaji@.discussions.microsoft.com> wrote in message
news:AFC8BD66-6474-4837-A80A-B9D3FF0068E3@.microsoft.com...[vbcol=seagreen]
> Hi Ekrem,
> Can you please explain the difference with an example.
> "Ekrem ?nsoy" wrote:

No comments:

Post a Comment