Showing posts with label failure. Show all posts
Showing posts with label failure. Show all posts

Friday, March 23, 2012

Restore Database FROM MDF/LDF, then apply Transaction Log From POint of Failure? Is it pOs

If I have a database backup from sunday, and a failure occurs monday... Can the backup .mdf and .ldf files be attached, and the backup log after the point of failure be applied to them?

The problem I am having is it looks like you can only restore from a .bak file, and then apply the log at the point of failure. IT doesn't look like you can restore the .ldf/.mdf files, and then apply the backup log from the point of failure.

Can someone please help? I'm in desparate need of fixing this !

Thanks,
dp


You can restore from backup and apply your log files to recover up to failure unless it is a transactional database you can restore almost everything but you are also supposed to keep a DR(disaster recovery) copy of your database. Try the link below. Hope this helps.

http://www.sql-server-performance.com/log_explorer_spotlight.asp

sql

Friday, March 9, 2012

Restore at the point of failure

I m doing a test restore from my live to test db( to test restore at the
point of failure)
Below is my script :
-- Back up the currently active transaction log of Live DB
BACKUP LOG LIVEDB
TO disk = 'C:\Log2.TRN'
WITH NO_TRUNCATE
GO
-- Restore the database full backup from Live DB to Test DB
RESTORE DATABASE TESTDB
FROM DISK='C:\8A.M'
WITH NORECOVERY
GO
-- Restore the first transaction log backup of LIVEDB TO TESTDB
RESTORE LOG TESTDB
FROM DISK ='C:\LOG1.TRN'
WITH NORECOVERY
GO
-- Restore the final transaction log backup.(the last transaction log backup
)
RESTORE LOG TESTDB
FROM DISK ='C:\Log2.TRN'
WITH RECOVERY
GO
Somehow, I got the error as below:
Processed 1954 pages for database 'IMS', file 'Production60_Log' on file 1.
BACKUP LOG successfully processed 1954 pages in 0.432 seconds (37.037 MB/sec
).
Processed 88984 pages for database 'IERP60', file 'Production60_Data' on
file 1.
Processed 1 pages for database 'IERP60', file 'Production60_Log' on file 1.
RESTORE DATABASE successfully processed 88985 pages in 57.809 seconds
(12.609 MB/sec).
Server: Msg 4326, Level 16, State 1, Line 3
The log in this backup set terminates at LSN 42947000000004100001, which is
too early to apply to the database. A more recent log backup that includes
LSN 42947000000146100001 can be restored.
Server: Msg 3013, Level 16, State 1, Line 3
RESTORE LOG is terminating abnormally.
Processed 1954 pages for database 'IERP60', file 'Production60_Log' on file
1.
RESTORE LOG successfully processed 1954 pages in 2.127 seconds (7.522 MB/sec
).
I checked the transaction log that I applied is actually the first
transaction log backup of the day itself.Please note that my transaction log
backup date is 7 a.m and the full backup is 8a.m
Please advise
ThanksHi
If you use RESTORE HEADERONLY you will see the LSNs and therefore use the
correct file. You may find this discussion useful:
http://tinyurl.com/4kqkf
John
"sql fren" wrote:

> I m doing a test restore from my live to test db( to test restore at the
> point of failure)
> Below is my script :
> -- Back up the currently active transaction log of Live DB
> BACKUP LOG LIVEDB
> TO disk = 'C:\Log2.TRN'
> WITH NO_TRUNCATE
> GO
> -- Restore the database full backup from Live DB to Test DB
> RESTORE DATABASE TESTDB
> FROM DISK='C:\8A.M'
> WITH NORECOVERY
> GO
> -- Restore the first transaction log backup of LIVEDB TO TESTDB
> RESTORE LOG TESTDB
> FROM DISK ='C:\LOG1.TRN'
> WITH NORECOVERY
> GO
> -- Restore the final transaction log backup.(the last transaction log back
up)
> RESTORE LOG TESTDB
> FROM DISK ='C:\Log2.TRN'
> WITH RECOVERY
> GO
> Somehow, I got the error as below:
> Processed 1954 pages for database 'IMS', file 'Production60_Log' on file 1
.
> BACKUP LOG successfully processed 1954 pages in 0.432 seconds (37.037 MB/s
ec).
> Processed 88984 pages for database 'IERP60', file 'Production60_Data' on
> file 1.
> Processed 1 pages for database 'IERP60', file 'Production60_Log' on file 1
.
> RESTORE DATABASE successfully processed 88985 pages in 57.809 seconds
> (12.609 MB/sec).
> Server: Msg 4326, Level 16, State 1, Line 3
> The log in this backup set terminates at LSN 42947000000004100001, which i
s
> too early to apply to the database. A more recent log backup that includes
> LSN 42947000000146100001 can be restored.
> Server: Msg 3013, Level 16, State 1, Line 3
> RESTORE LOG is terminating abnormally.
> Processed 1954 pages for database 'IERP60', file 'Production60_Log' on fil
e 1.
> RESTORE LOG successfully processed 1954 pages in 2.127 seconds (7.522 MB/s
ec).
>
> I checked the transaction log that I applied is actually the first
> transaction log backup of the day itself.Please note that my transaction l
og
> backup date is 7 a.m and the full backup is 8a.m
> Please advise
> Thanks
>|||Sorry, how to determine from the LSNs which db backup is the latest?
"John Bell" wrote:
> Hi
> If you use RESTORE HEADERONLY you will see the LSNs and therefore use the
> correct file. You may find this discussion useful:
> http://tinyurl.com/4kqkf
> John
>
> "sql fren" wrote:
>|||Hi
RESTORE HEADERONLY returns the first and last LSN. In your case you
want the backup where
FirstLSN <= 42947000000146100001 <= LastLSN.
John
sql fren wrote:
> Sorry, how to determine from the LSNs which db backup is the latest?
>
> "John Bell" wrote:
>
use the
at the
log backup)
on file 1.
(37.037 MB/sec).
'Production60_Data' on
on file 1.
seconds
42947000000004100001, which is
includes
'Production60_Log' on file 1.
(7.522 MB/sec).
first
transaction log|||It seems that you are trying to apply log backup that made before the full
backup .
C:\LOG1.TRN contain log backup that made before the full backup .(NOT OK)
C:\LOG2.TRN contain log backup that made after the full backup . (OK)
You can see all backup operation in msdb..backupset table.
select *
from msdb..backupset
where datbaseName = 'db_name'
order by backup_set_id
TLV
"sql fren" <sqlfren@.discussions.microsoft.com> wrote in message
news:7A7D973A-2FEB-4824-B557-07172AD86A39@.microsoft.com...
> Sorry, how to determine from the LSNs which db backup is the latest?
>
> "John Bell" wrote:
>