Suppose there is a scenario.
CREATE DATABASE [DBMaint2008];
GO
USE [DBMaint2008];
GO
CREATE TABLE [TestTable] ([C1] INT IDENTITY, [C2] CHAR (100));
GO
-- Take a full backup
BACKUP DATABASE [DBMaint2008] TO DISK = N'D:\SQLskills\DemoBackups\DBMaint_Full.bck' WITH INIT;
GO
-- Insert some rows
INSERT INTO [TestTable] VALUES ('Transaction 1');
INSERT INTO [TestTable] VALUES ('Transaction 2');
GO
-- Take a log backup
BACKUP LOG [DBMaint2008] TO DISK = N'D:\SQLskills\DemoBackups\DBMaint_Log1.bck' WITH INIT;
GO
-- Support we insert 10000 records here
INSERT INTO [TestTable] VALUES ('Transaction 3');
INSERT INTO [TestTable] VALUES ('Transaction 4');
...........
GO
Now here we make the database offline.
We damaged the transaction log file, suppose which also would caused failed to backup the tail of the transaction log, and caused the database in the "pending recovery " when we try to make the database online.
For the such situation we should use the restore from the backup or repair the database with "REPAIR_ALLOW_DATA_LOSS"?
If we choose the restore from the backup ,the last 10000 records would be lost, if we choose "REPAIR_ALLOW_DATA_LOSS" we could save some records, but the records is inconsistent.
So which one should I choose?
Please click the Mark as Answer button if a post solves your problem!