One of the most important parts of the recording/playback cycle is ensuring that you have consistent data between the system being recorded and the system that you will be playing back into. For this reason, one requirement of recording for playback on another system is that you take an online backup of the source system. This will then be restored to build the target system (using standard SAP system copy tools). However, different database and backup tools and technologies have different ways of creating a consistent online backup. It is important that you understand how your particular DB and backup tools work, so that the backup can be taken at the appropriate time, and also so that the restore from the backup can be done in a way that makes a consistent dataset for starting the playback. In particular, it is important that you understand whether the point of consistency is the start of the backup, the end of the backup, or must be defined to a point just after the end of the backup.
Online backup data consistency
There are, in general, three different approaches taken by different databases to achieving a consistent online backup (i.e., a backup which can be restored whilst leaving no half-finished database transactions).
Snapshot tools use disk storage technologies to take a virtual snapshot of the database at a particular point in time. Because they are using functionality directly within the storage, they are very fast at taking the backup. When restoring from a snapshot to a target system, once the copying of the backed up data is done, the database will automatically roll back any DB transactions that were open at the time of the snapshot. This means that, for snapshots, the point of consistency is the start of the backup.
Online consistent backups
Some DB backup options (for example Oracle’s Online Consistent Backup option) will change the way the database operates whilst the backup is in progress. During normal operation, the database writes the after images of any updated DB blocks to a set of files (in Oracle, these are the redo logs). The aim of these files is to allow transactions to be rolled forward following a restore from an online backup. During an online consistent backup, however, the DB will write both the before and the after images of the updated blocks to these logs. Once an online consistent backup has been restored, the database can roll back any updates that took place while the backup was in progress. This means that, for online consistent backups, the point of consistency is the start of the backup.
Other online backups
In most other cases, when restoring from an online backup it is also necessary to apply a set of redo logs (using the example of Oracle) once the backup has been restored. By applying all of the logs that were generated whilst the backup was running, you are able to ensure that all database updates which took place during the backup are replicated on the target system and that the database is consistent. This “point in time” recovery means that, for most online backups, the point of consistency is either the end of the backup, or a point just after the end of the backup.
Coordinating the backup with the start of the recording
Depending on the type of online backup you are using and the point of consistency, you need to schedule the backup and the start of the recording at different relative times. The key to ensuring that you have a consistent dataset between the recording and the start of the playback is that the recording must be active at the point of consistency of the backup.
Where the backup’s point of consistency is the start of the backup, then you must switch on the recording first and then start the backup.
Where the backup’s point of consistency is the end of the backup, then you can start the backup first, but you must start the recording before the backup finishes.
If you are using a point-in-time recovery to apply logs to a point after the end of the backup, then the recording must be running at the time to which you are going to roll forward after the restore.