The intent of this article is not to repeat the OpenEdge Documentation on the subject or to provide a thorough guide, but instead to provide a basic overview of After Imaging.
There are various other techniques and options available for use when configuring, using and managing after-imaging. For more information, please review the Progress documentation and article links described in the Notes section.What is after-imaging (AI):
The after-imaging feature lets you recover a database that was damaged when a failure caused the loss of the database or primary recovery (before image / BI) area. When you enable after-imaging, the database engine writes notes containing a description of all database changes to the after-image (AI) files. You can use the AI files with the roll-forward recovery process to restore the database to the condition it was in before you lost the database, without losing completed transactions that occurred since the last backup.
Below is a very basic example of using After Imaging with an OpenEdge sports2000 database. Example for enabling after-imaging:
1. Create a sports2000 database in the current working directory:prodb sports2000 sports2000
2. Truncate the database before-image (BI) extent:
proutil sports2000 -C truncate bi
3. Create a database structure file containing the after-image (AI) extents that you wish to add to the database. It is good practice to have a minimum of four AI extents and all extents should be defined exactly the same (either all variable length, or all with the same fixed size). It is also good practice to place the AI extents onto a different volume and set of physical disks to the database and BI files (if a different volume and set of physical disks are available). The definition below will allow four variable length AI extents to be added in the current directory. Name this text file "addai.st".
Instead of adding AI extents to the current working directory, addai.st file can define the location of AI extent files, for example in Unix or Linux addai.st file may look like this:
or in Windows, addai.st file may look like this:
4. Add those AI extents to the database:
prostrct add sports2000 addai.st
5. To see that AI extents were added, list the database structure file:
prostrct list sports2000
6. Backup the database. This backup will be used as the starting point of any recovery, until the next successful backup is taken:
probkup sports2000 /archive/s2k.bk1 -com
7. Enable after-imaging:
rfutil sports2000 -C aimage begin
After-imaging is now enabled and transaction data will be recorded within the after-image extents.
As time goes on, after-image extents will be switched to the next empty extent either intentionally via scripts that switch at set time intervals or automatically when the extent becomes full. Some tasks such as running a Progress backup (probkup) or enabling a quiet-point will also cause the AI extent to switch automatically. After-image extent phases:Empty
means the extent is available for use.Busy
means the extent is currently in use.Full
means the extent has filled up and is ready to be archived and emptied.Locked
means that OpenEdge Replication is enabled for the database and the AI file contents have not been transmitted to the target database(s) yet. When all of the contents have been transmitted to the target database the extent will be marked Full.
To view the AI extents and their status, use RFUTIL with the AIMAGE EXTENT LIST qualifier:rfutil sports2000 -C aimage extent list Managing after-imaging:
After-image extents need to managed so that there is continual availability of empty AI extents. Also, naming conventions used for the backup and archived AI files are important to quickly and easily identify relevant files and their sequence, and backups should be bundled with relevant AI files to make recovery simpler.
Managing of after-imaging involves:
a) Managing your backups and ensuring that you are able to distinguish the date when the backup was made and that the backup is stored externally to the machine.
b) Using the following command to generate a new structure file and backing up a copy of the database structure (.st) file. The structure file would be used when re-creating the database during recovery:prostrct list sports2000
c) As AI extents become FULL, copy those FULL extents to a backup location, preferably external to the disk storage that contains the database data or bi files. The backed-up AI extent file names should use a naming convention combining date, time and sequence number (seqno could be used from the parsing of rfutil dbname -C aimage extent list
). During recovery the AI extents must be rolled sequentially in the order they were generated which is why the naming convention is important.
d) Archived AI extents should be bundled with the immediate prior successful backup, the backup to which they would be applied during recovery. Note that when a probkup is performed, probkup will first perform an automatic AI extent switch causing the current BUSY extent to become FULL. That FULL extent must be bundled with the immediate prior backup not the new backup.
e) Empty any backed-up FULL extents so that they can be re-used:
To get the file name of the oldest FULL database AI extent, if one exists:rfutil sports2000 -C aimage full
To empty the oldest FULL after-image extent:rfutil sports2000 -C aimage extent empty
Note that in OpenEdge 10.1A onward, a new tool AI File Management (AIMGT / AI Archiver) was introduced. This tool provides the management of After Image files without the need to script 'rfutil' utilities. Once the OpenEdge database has been enabled for archiving, the AIMGT daemon creates a copy of all FULL AI extents to the current archive directory before marking these as EMPTY for re-use, according to the archive interval specified. Roll-forward recovery using after-imaging:
The database should not be accessed until all after-image files have been rolled onto (applied) to the database, otherwise it will not be possible to continue rolling AI files.
The roll-forward mechanism can either roll forward all transactions up to the end of the last available AI file, to a specified point in time or to a specific transaction number provided the last good backup and all required after image files are available.
Rolling forward to a point in time or to a specific transaction number can be useful if needing to recover to a state prior to an undesirable event, such as a programming error that adversely affected the database.
When preparing the files to use with Roll Forward, you will need:
a) The last good backup.
b) All FULL archived after image extents generated since the last good backup.
c) All FULL AI extents from the damaged database that have not yet been archived, if available.
d) The current BUSY AI extent from the damaged database, if available.
Below is a very basic example of the required steps when using an OpenEdge sports2000 database, if two FULL after-image extents and one BUSY after-image extent is available:
1. Create a new database using your backed up structure file. Be careful to check the structure file and make changes if the restored database is to be placed into a different directory structure to the original. If the structure file is not available or you cannot recall the database blocksize that was used, please review article titled “How to find the database Storage Areas and extent sizes needed for a PROREST?” listed in the Notes section.prostrct create sports2000 sports2000.st -blocksize 1024
2. Restore the last good backup:prorest sports2000 /archive/s2k.bk1
3. Roll forward each of the available AI extents sequentially in the order that they had been generated. Run the following command for as many AI files that you wish to roll, substituting the after-image filename with that of the file that you wish to roll:rfutil sports2000 -C roll forward -a /archive/aifile1.a1
4. After completing the roll forward process, when the database is accessed it will go through crash recovery and the database will become available for use.
When rolling an after-image file, if the roll forward process is interrupted or canceled you must use the roll forward retry
option to re-attempt the roll-forward of the same after image file. The roll forward retry option should not be used unless the prior attempt was cancelled. Following is an example of using roll forward retry:rfutil sports2000 -C roll forward retry -a /archive/aifile1.a1 Disabling after-imaging:
To disable after-imaging, the following command can be used:rfutil sports2000 -C aimage end