Domanda

I am reading this book from Microsoft - it says: "A log backup cannot be performed unless the database is in full recovery model and an initial full backup has been performed"

Is this correct? I know simple recovery model doesn't support transaction log backup. But think I have read somewhere that full and also bulk recovery model supports transaction log backup.

È stato utile?

Soluzione

No, this is not correct.

See SQL Server Recovery Models

If you are utilising the BULK recovery model, this will function the same as the FULL recovery model apart from specific minimally logged operations (SELECT INTO, BULK INSERT, CREATE INDEX...)

If you do not set up log backups, you risk your log files filling.

Altri suggerimenti

A log backup cannot be performed unless the database is in full recovery model and an initial full backup has been performed

Strictly taking into account what author is taking the statement is correct, what it means that if a database is in full recovery model and NO full backup has been done from the time when database was created or when database recovery model was changed to full recovery, you cannot take log backup it would just fail. This is because there was no full backup taken to start the transaction log chain after full recovery model change or when database was created. Such databases are called to be in "Pseudo Simple Recovery Model". A database in full recovery model actually behaves like simple unless a full backup is taken. Paul Randal from SQLSkills.com has more details In this Blog

It is also worth noting that after switching from the bulk-logged recovery model back to the full recovery model, you can backup the transaction log.

For example Let us create a database in full recovery and take log backup it would fail see the screen

enter image description here

Now let us take full backup, change recovery model to simple and again back to full, and take log backup, it will fail again

enter image description here

I believe this is what the author is talking. If full backup has been taken to initiate chain you can very well take transaction log backup in full and bulk logged recovery model.

Now do the same for bulk logged, create a new database in full recovery mode perform some transaction and change recovery to bulk_logged and then back to full recovery. Now perform the log backup it will fail saying

Msg 4214, Level 16, State 1, Line 9 BACKUP LOG cannot be performed because there is no current database backup. Msg 3013, Level 16, State 1, Line 9 BACKUP LOG is terminating abnormally.


But think I have read somewhere that full and also bulk recovery model supports transaction log backup

Yes correct subject to condition that after changing to full recovery or creating the database atleast one full backup has been taken to start the log chain

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a dba.stackexchange
scroll top