Loosely translated, here's the question:
If I have a transaction that takes 2 hours to complete and during this execution, there has been 5 log switches (there is only 2 log groups, and 5 minutes before the end of the transaction the power shuts off. How much redo and undo will be read from both the rollforward and the rollback, and where are they taken from, and under what assumptions regarding "enough space".
It took me some time to figure this out, but here's my answer: (it might not be a 100 % correct in a complete technical view, but it is only to catch the main picture)
I have acouple of assumptions to the question:
1)The transactiondoesn't have commits
2)the database is in Archivelog mode
First and foremost, the rollforward action that the automatic instance recovery will do, is only using online redo logs, thus, it will only read the undo blocks back to the undo segment which has a higher SCN than the last checkpoint.
A log switch forces a checkpoint, thus, all the uncommitted data would have been written to the datafiles. This means that at the checkpoint time undo is written to the datafiles, and the changes are also written to the datafile the object belongs to, though with the information in the blockheader that these changes are not committed.
When rollforward has replayed the "lost" undo segments, the database can be opened and SMON will start to rollback the blocks that needs to be rolled back.
The transaction has been declared dead and all undo made by the transaction need to be rolled back. It is not necessarily only SMON that does this a "user process" could reach the block first and it will then do the rollback needed to get the correct version of the block
The space issue shouldn't be a problem since before the crash there was no problems handling the undo in the tablespace, otherwise an error would have appeared.
The Archived logs with the uncommitted data can be used to recreate the undo segments if a datfile should crash before the next backup is taken. Though, one might think that it would be a good idea to take a backup after the instance recovery has synchronized the datafiles?
I've have received an answer that my picture of this is according to the person asking the question. Since this person is an OCM I take that for a good omen!!!
Ingen kommentarer:
Send en kommentar