From: xo on
Hi,

I restored a full db backup, then applied point in time TX log restore
(I picked a time that is earlier than the accumulated log backup file
ends) and leave the db at standby/read-only stage. And when I tried to
apply add'l TX, I got this error.

Restore failed
Additional information:
System.Data.SqlClient.SqlError: The log in this backup set terminates
at LSN 3056460000000004100001, which is too early to apply to the
database. A more recent log backup that includes LSN
305653000000032400001 can be restored.

Am I supposed to use a different TX Log backup file? All TX are
accumulative/appended on top of each other. What is the appropriate
steps to restore TX log and applied add'l logs with the same log
backup file?

Thanks in advance.
From: Erland Sommarskog on
xo (xo5555ox(a)gmail.com) writes:
> I restored a full db backup, then applied point in time TX log restore
> (I picked a time that is earlier than the accumulated log backup file
> ends) and leave the db at standby/read-only stage. And when I tried to
> apply add'l TX, I got this error.

So you have a backup that was completed at 17:20, and now you want to
make a restore to the state at 17:05? That is not going to work out.
You will need to restore an earlier full backup and then apply log
backups to that one.





--
Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

From: xo on
On Jul 15, 1:23 am, Erland Sommarskog <esq...(a)sommarskog.se> wrote:
> xo (xo555...(a)gmail.com) writes:
> > I restored a full db backup, then applied point in time TX log restore
> > (I picked a time that is earlier than the accumulated log backup file
> > ends) and leave the db at standby/read-only stage. And when I tried to
> > apply add'l TX, I got this error.
>
> So you have a backup that was completed at 17:20, and now you want to
> make a restore to the state at 17:05? That is not going to work out.
> You will need to restore an earlier full backup and then apply log
> backups to that one.
>
> --
> Erland Sommarskog, SQL Server MVP, esq...(a)sommarskog.se
>
> Links for SQL Server Books Online:
> SQL 2008:http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
> SQL 2005:http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
> SQL 2000:http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx


I got a full db backup file and one log backup which contains about 8
hrs worth of tx (tx backup once per hr between 6:30AM - 2:30PM) .
First I restored the full backup and then I restored the tx log up to
11:30AM and tried to leave the db as standby as well as non-
operational so I can restore more tx from the same log backup, but I
couldn't. I got the above messages.

From: Erland Sommarskog on
xo (xo5555ox(a)gmail.com) writes:
> I got a full db backup file and one log backup which contains about 8
> hrs worth of tx (tx backup once per hr between 6:30AM - 2:30PM) .
> First I restored the full backup and then I restored the tx log up to
> 11:30AM and tried to leave the db as standby as well as non-
> operational so I can restore more tx from the same log backup, but I
> couldn't. I got the above messages.

So you say that you first did:

RESTORE DATABASE db FROM DISK = 'somefile.bak' WITH NORECOVERY, REPLACE

Then you did:

RESTOTE LOG db FROM DISK = 'trnfile.bak' WITH NORECOVERY,
STOPAT = '20100714 11:30'

And this succeeded successfully?

Next you tried:

RESTOTE LOG db FROM DISK = 'trnfile.bak' WITH NORECOVERY

Using the same file as before, and this failed?

I tried to emulate this situation, and it worked. That is, I was able to
apply the same transaction log twice, with different values for STOPAT.

I think you need to verify that you use the correct file, and also that
you used the correct file number. (The WITH FILE option.)


--
Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx