Unix Technical Forum

Restore LDF file after restoring backups in SQL Server 2005?

This is a discussion on Restore LDF file after restoring backups in SQL Server 2005? within the SQL Server forums, part of the Microsoft SQL Server category; --> I'm working on a restore procedure for the case where all MDF files are missing, but the LDF files ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 03:40 PM
l0b0
 
Posts: n/a
Default Restore LDF file after restoring backups in SQL Server 2005?

I'm working on a restore procedure for the case where all MDF files
are missing, but the LDF files are all intact. A full backup is done
every 24 hours, and a log backup is done every 3 hours. After
restoring the last full + log backups, is it at all possible to use
the LDF files to recover data from that point up to a newer point in
time?

I've found a post which explains how to do this on SQL Server 2000
<http://groups.google.com/group/comp.....ms-sqlserver/
browse_thread/thread/3ef5c7cbc0a83334/f3b0c70811d35ed7>, but step 4
fails with the following error message:
BACKUP LOG cannot be performed because there is no current database
backup.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-01-2008, 03:40 PM
Erland Sommarskog
 
Posts: n/a
Default Re: Restore LDF file after restoring backups in SQL Server 2005?

l0b0 (victor.engmark@gmail.com) writes:
> I'm working on a restore procedure for the case where all MDF files
> are missing, but the LDF files are all intact. A full backup is done
> every 24 hours, and a log backup is done every 3 hours. After
> restoring the last full + log backups, is it at all possible to use
> the LDF files to recover data from that point up to a newer point in
> time?


At that point it may be a little late. Say that disaster strikes and
your MDF file is dead. At this point you can perform BACKUP LOG WITH
NO_TRUNCATE to back up the log. Then you restore and apply all logs
including this one.

> I've found a post which explains how to do this on SQL Server 2000
><http://groups.google.com/group/comp.....ms-sqlserver/
> browse_thread/thread/3ef5c7cbc0a83334/f3b0c70811d35ed7>, but step 4
> fails with the following error message:
> BACKUP LOG cannot be performed because there is no current database
> backup.


It seems that Dan left out one point his post. And which point is fairly
obvious: you need to take a full backup of the newly created dummy database.
Since Dan read this group regularly, I hope is able to step in and clarify.



--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-01-2008, 03:40 PM
l0b0
 
Posts: n/a
Default Re: Restore LDF file after restoring backups in SQL Server 2005?

On Aug 22, 12:38 pm, Erland Sommarskog <esq...@sommarskog.se> wrote:
> l0b0 (victor.engm...@gmail.com) writes:
> > I'm working on a restore procedure for the case where all MDF files
> > are missing, but the LDF files are all intact. A full backup is done
> > every 24 hours, and a log backup is done every 3 hours. After
> > restoring the last full + log backups, is it at all possible to use
> > the LDF files to recover data from that point up to a newer point in
> > time?

>
> At that point it may be a little late. Say that disaster strikes and
> your MDF file is dead. At this point you can perform BACKUP LOG WITH
> NO_TRUNCATE to back up the log. Then you restore and apply all logs
> including this one.


Thanks! I ended up doing the following:
1. BACKUP LOG database TO DISK = 'C:\database.bak' WITH NO_TRUNCATE;
2. Restore full + log backups without recovery
3. RESTORE LOG database FROM DISK='C:\database.bak' WITH MOVE
'database_log' TO 'L:\database_log.LDF', RECOVERY;

It works fine.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:54 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com