Recovery backup prior the last and all following log until last minute
The scenario is the following:
I must recover the db from a full backup prior the last full backup. The last backup was damaged. In order to recover until the last second I must restore the prior backup and the log between this backup and the last, and all log following the last bakup. The restore is without initialization, so the log area is also restored into the database. During the procedure I don't find this procedure. I'm able to recovert until last second only with initialization, or restore previous full backup and following log until the next full backup.
Backup full A Log1 Log2 Backup full B Log2 Log3
|__________|____|__________|__________|___| Log Area: 30% not saved
Backup full A + Log1 + Log2 + Log3 + Log4 + Log Area 30% ---> System Consistent
How can I implement this scenario? I try but I have no success.
Please help me.
Thaks in advance.
Lars Breddemann replied
nope - you did not get it right yet, sorry.
> The log area hasn't yet the information on log3 and log4
How do you know that?`
Show us the output from "db_restartinfo" and your backup history.
> Case restore without initialization, also the log area is recovered on database.
As I've written: we never restore the log area. We just don't do it.
To recover we need log entries. These log entries are either read from the log area or from log backups.
But we never put log entries from a log backup to the log area - it's simply not necessary.
> - Select Recovery - Recovery... - Restore a specified backup from history - Select the previous backup from history list.
> - It is important to specify also the Restore database until a specific time option. Specify the date and time at whitch point to recover the database: in our case the actual date and time.
If you want to recover to the latest state of the database, then you don't need to specify a 'restart until' timestamp. This is only necessary when you want to stop the recovery to perform a point-in-time recovery.
> - Note that in the window that display the steps required to perform a recovery we can see only the database medium and not all the logs mediums to recover until the point in time option specified.
If you've specified "Restore a specified backup from history" then you'll see all necessary log backups in the preview list.
If you don't get this, something must be wrong.
Again the backup history should provide some insight here.
> - Start the restoration. At the end the system ask to start the database instance. Is during this operation that the database takes into account the point in time option and check the existance of logs to recover the database. If so the recovery is performed, but we don't see whitch log were restored. For me this is a lack. Also the log area is restored in this case.
Wrong again - one of the thing the recovery wizard does before doing the actual recovery is to check, what needs to be recovered at all.
It uses the 'db_restart' command for this and figures out:
1. what is the first logpage available in the log area
2. what is the current/highes log page number available in the log area.
Now all it takes to determine what backups need to be recovered is to check what log page was current, when the data backup, that should be used for the recovery, was created.
If this log page is >= the first log page on the log area, we'll find all log entries in the log area, so no log backup needs to be recovered.
> If I perform the same steps with the initialization option and the database recovery display me the database medium we select and all the logs that must be restored until the point in time option specified.
Sure - if you delete all log entries before the recovery, we need to read all of them from backups.
> This difference is not justified for me, if the restore include also the recovery of logs, those logs must be shown in both cases.
No, again. As explained, we read as much log information from the log area as possible.
If we find all necessary data in the log area, we don't need to read the log backups.
Maybe one mental obsticle for you is, that the log data is still present in the log area after you performed log backups, although you see the "log filling bar" getting smaller in DBMGUI when you perform a log backup.
The reason for that is simple: the 'log filling bar' does not show the filling of the log volume, but the amount of not-backed up log data with respect to the whole log area.
When we write log data, we mark it as "not backed up". This means: don't overwrite it!
When we perform a log backup we mark the saved log data as "backed up". This means: if you need this space, you can overwrite it.
It does however not mean that we overwrite or delete this data.
Hope this helps a bit.