17. Backing Up and Restoring the Database : Backup and Restore Scenario Using Checkpoints and Journals
Share this page                  
Backup and Restore Scenario Using Checkpoints and Journals
The ckpdb and rollforwarddb commands are used for backing up and restoring a database, respectively. These operations can also be performed using Actian Director.
Full database backup and recovery operations using the ckpdb and rollforwarddb commands apply to both traditional Ingres tables (if present) and Vector tables.
The process for backing up a database is as follows:
1. Create a database:
createdb dbname
Note:  The database is not journaled.
2. Load data into the database.
3. Take a checkpoint of the entire database offline (when no one is using the database) and turn on journaling:
ckpdb +j dbname
This offline checkpoint needs to be done only once.
Subsequently, users update the database (both DML and DDL). The logging facility writes to the transaction log, and Vector writes to the Write-Ahead Log and various data files.
The archiver process regularly wakes and writes to a journal file the changes since the last trigger or full checkpoint.
4. Periodically (for example, nightly) take an online checkpoint:
ckpdb dbname
The commands for restoring a database are as follows. Use the appropriate command for your situation:
Note:  The restore operation must be done offline (when no one is using the database).
Restore last full checkpoint and then restore the journals in one operation:
rollforwarddb dbname
rollforwarddb +c +j dbname
Restore the last full checkpoint, but not the journals:
rollforwarddb +c -j dbname
Restore the journals after the last full checkpoint has just been restored:
rollforwarddb -c +j dbname