After image roll-forward recovery

Here are the steps to perform after image roll forward (to point in time) recovery using your last full backup, incremental backups, archived after image extents, and unarchived after image extents.

1. Do you have your most recent full database backup on your server?  How about your incremental backup files created since that full backup? And the archived AI files?  If not, copy them back from your off-server, off-site backup storage.

2. If this was not a total server loss, you should still have your unarchived AI files. Copy them to your ai archive (or other) directory before restoring the full database backup. To see which AI files are not empty, run:  rfutil <db> -C aimage list. This will also let you know the order in which the unarchived AI files will have to be rolled forward. 

3. [optionial] Copy/move the damaged database files (lg bi ai data extents etc.) out of the way for later analysis. With any luck, you have space on the existing db file system, so you can simply rename the db directory without copying all the files to a different file system. If not, and if possible, copy away, assuming you have the convenience of time and space. Otherwise, we will restore on top of the existing structure, saving the time it would take to allocate file system blocks to the database. 

4. Restore your full backup:

prorest <db> <full backup file> -verbose

5. Restore your incremental backups (pseudo code):

for each incremental-backup-file:

prorest <db> <incremental-backup-file>

end

6. Restore your archived AI files (pseudo code):

for aiArcFile in $(ls $AI_ARC_DIR)
do
rfutil <db> -C roll forward oplock [ endtime <time> | endtrans <trid> ] -a $aiArcFile

# <time> is in the format: yyyy:mm:dd:hh:mm:ss. 
# <trid> is the transaction id number
# see this article for more information on endtime and endtrans
# oplock - prevents unexpected opening of the database during recovery

done

7. Roll forward any unarchived AI files, assuming you have yet to reach your endtime/endtrans above. Depending on how your AI files are named, they may have been applied above. Otherwise, you will need the aimage list from step 2 to know the order in which to apply your unarchived AI file(s):

rfutil <db> -C roll forward [ endtime <time> | endtrans <trid> ] -a aiFile

8. When roll forward is complete, disable the oplock:

rfutil <db> -C roll opunlock

9. Start the database in single-user mode to force crash recovery and verify access to the database.

10. Start the database as usual.