SQL Server - Tail-log backup not happening

Asked By Amit
20-Nov-09 01:53 AM
Hi,

I have a production database where tail log backup is not happening. In
order to understand the tail log backup concept better, I
reproduced/simulated the situation as mentioned below, but still tail log
backup was not working. I think I might be missing something in this small
example:

-- I created a test database (database is in full recovery mode)
CREATE DATABASE Test
GO

USE Test
GO

-- I created a test table called employee

CREATE TABLE dbo.Employee(
EmpID int Primary Key NOT NULL,
EmpName nvarchar(100) NOT NULL,
EmpEmail nvarchar(100) NOT NULL)


-- I inserted a record
INSERT INTO dbo.Employee
values (1, N'Amit1', N'test@email.com')
GO

-- add a backup device

EXEC sp_addumpdevice 'disk', 'mydiskdump', 'C:\TestBackup.bak'

-- took a full back up

BACKUP DATABASE test to mydiskdump

-- added another record

INSERT INTO dbo.Employee
values (2, N'Amit2', N'test@email.com')
GO


-- took a differential backup

BACKUP DATABASE test to mydiskdump
with differential


-- added another record

INSERT INTO dbo.Employee
values (3, N'Amit3', N'test@email.com')
GO

-- took a transaction log backup

BACKUP LOG Test TO mydiskdump

-- add another record

INSERT INTO dbo.Employee
values (4, N'Amit4', N'test@email.com')
GO


--- now I shut down sql server
--- then I simulated a crash (simply corrupted the mdf file using a hex
editor), so my log file is undamaged.
-- started sql server again.
-- the database is in suspect mode now

---------------------
-- took tail log backup
----------------------

BACKUP LOG Test TO mydiskdump
WITH NO_TRUNCATE

-- I m using with no_truncate beucase the mdf file is damaged. I hope this
is the right step. without No_truncate, I get error.


-- now when I try to restore the database from the backup using sql server
management studio, my back up device shows me 1 full backup, 1 differential
backup, & 1 transaction log backup. it is not showing the tail-log backup.
when I restore all of it, I get all the records, except the last record (the
4th record).

if I am missing something here, please assist. Thanks.

Regards
Amit
SQL Server
(1)
CREATE DATABASE
(1)
CREATE TABLE
(1)
NOT NULL
(1)
Nvarchar
(1)
Backup
(1)
Disk
(1)
Database
(1)
  Amit replied to Amit
20-Nov-09 03:23 AM
Hi Friends,

My issue seems to be getting resolved. Thanks.

Regards
Amit
  Tibor Karaszi replied to Amit
20-Nov-09 04:54 AM
The tool does not show you the backups done using NO_TRUNCATE (which was the
right option). So you understood the concept, but was confused by a somewhat

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
  Amit replied to Tibor Karaszi
25-Nov-09 11:45 PM
Hi Tibor,

Thanks for the information. Your are right. The restore works with the
script. Thanks for your help here.

Regards
Amit
Create New Account
help
server SQL Server Do I have to set up a sql server database on a sql server? Or can I do this on any server SQL Server Setup Discussions SQL Server (1) CREATE DATABASE (1) Databases (1) Database (1) Create
Attach SQL Server 2008 database to SQL Server 2000 Server SQL Server Hi, I have created a database in SQL Server 2008, with compatibility level of SQL Server 2000. Now when I detach the DB
Linked server SQL Server HI its possible create a local sql server as a linked server In sql server 2000 and Sql server 2005 I thought sql server 2005 its not possible thanks
MSDE on Windows 2003 R2 box, new DL385G6 - Install Fails during SQL Services SQL Server I have been finding that I am having trouble with the Crystal Reports Server XI installation failing when it is dealing with SQL. So, as a thought and in case there was something wrong with my SQL portion of the isntall. I thought ok, I will try installing the actual MSDE application direct from Microsoft. So, I downloaded the MSDE for SQL 2000 (which is msde2000a.exe), set my switches and off to the races. It quit seconds left to the installation and bombed with the same errors as the Crystal Reports Server install. The error is the same whether I try to install MSDE by itself or
Backup on Sql server A and restore to Sql server B SQL Server Hi! I have two SQL Server 2008 Std (Sql Server A and Sql Server B) on Windows Server 2008 R2. SQL