Eloquence  Eloquence B.07.00 Release Notes

Eloquence B.07.00 - Database

Eloquence Database Backup

[ Main document | Back ]

Contents:

There are two supported procedures to perform a backup of the Eloquence database environment.

Off-line backup
The database server process is shut down in order to make a backup. Applications can no longer use the database until the backup is finished.

On-line backup
The backup is made while the database is active. Applications can access and modify the database. The Eloquence database supports on-line backup, allowing the database to be available during backup (at reduced performance).

Other backup procedures (besides the ones mentioned above) are likely to cause a corrupted backup or no backup at all (e.g. fbackup on HP-UX refuses to backup modified files).

In addition, there is a procedure to backup or restore a single database.

dbstore / dbrestore
The dbstore / dbrestore functionality allows transfer of a single database from a database environment to a file or tape device. This makes it easy to save a snapshot of a database or move a single database to another system.



Off-line backup

How to use off-line backup

An off-line backup takes place when the eloqdb6 is not active. You need to shut down the eloqdb6 process by either executing
  • dbctl -u dba shutdown
  • or /sbin/init.d/eloq6 stop on HP-UX or Linux
  • or net stop eloqdb6 on Windows NT.

After the eloqdb6 server has been shut down you should consider to execute dblogreset before performing the backup. This resets the log volume to its minimum size and makes sure all transactions are applied.

If the database was not shutdown cleanly, the log volumes contain important data needed to recover the data base environment. Without the log information your databases may be lost. The dblogreset utility makes sure that the log information is applied to your data volume(s).

The backup should cover all data and log volumes which are part of the database environment. While it is possible to re-create a missing log volume if the server was shutdown cleanly (or dblogreset was executed) we do not recommend this.

Please note: The log volume(s) might contain important information (your data) and you should handle them with the same care as your data. Otherwise your database environment may become unusable.

Example backup script:

 /sbin/init.d/eloq6 stop
 /opt/eloquence6/bin/dblogreset
 tar -cf /dev/rmt/0m /data/db
 /sbin/init.d/eloq6 start
This example performs a backup of the default database server environment. The eloqdb6 process is shut down, the log volumes are reset to initial state (optional), the volume files are backed up and the server process is restarted. This example assumes the volume files reside in the directory /data/db

Warning: Using fbackup on HP-UX to backup a database environment while the server is active will most likely not work and you may end up with no usable backup. Fbackup on HP-UX verifies that a file is not changed during backup and will take multiple attempts to backup the file. It will ultimately fail and the volume file is not backed up. Unless in on-line backup mode the eloqdb6 may change the volume files at any time, even if no users are active.

How to recover from an off-line backup

To recover from an off-line backup, make sure the database server process is not active and restore all data and log volumes which are part of the database environment.

When recovering to a temporary location you may need to create a server configuration file (eloqdb6.cfg) or modify an existing one. Please make sure the volume files in the configuration file refer to the recovered files.

If the log volumes are lost and your database was shut down cleanly, you can re-create any missing log volume with the dbvolextend command (see below).

Please note: If your database was not shut down cleanly and your log volume is lost your database may be damaged.

How to re-create your log volume(s)

If your log volumes are lost (e.g. due to a disk failure) and your database was shut down cleanly, you can re-create any missing log volume with the dbvolextend command. Execute dbvolextend -t log /path/to/logvol for each missing log volume file. The log volume file name(s) must match already existing entries in the server configuration file.

Assumed your database environment was configured to use two log volumes named /db/log/log01.vol and /db/log/log02.vol the following commands can be used to re-create the log volumes:

 dbvolextend -t log /db/log/log01.vol
 dbvolextend -t log /db/log/log02.vol
Since any previous log volume properties (like min. or max. size) are lost you may need to specify additional options to dbvolextend or use dbvolchange to modify the volume properties. You can use dbvoldump to display the volume information.

After the log volume(s) are re-created, you can start the eloqdb6 server process.



On-line backup

An on-line backup takes place when the eloqdb6 is active. The on-line backup is initiated with the dbctl backup start command which causes the eloqdb6 process to enter on-line backup mode.

When entering on-line backup mode, eloqdb6 creates a transaction consistent snapshot of the data volume(s) and makes sure the data volume(s) do not change during the backup. All changes to the data volume(s) are temporarily redirected to the log volume(s). The data volume(s) can then be backed up by an arbitrary backup tool (e.g. fbackup, tar, cp, etc.).

Once the backup is complete, the on-line backup mode is terminated by the dbctl backup stop command. This causes the eloqdb6 server process to update all pending data which was temporarily redirected to the log volume(s).

Please note: The eloqdb6 performance is reduced in on-line backup mode and the log volume(s) must provide sufficient space for all modifications during backup.

Log volumes do not need to be backed up in an on-line backup. They are changing constantly and are not used for recovery.

Please note: When using fbackup on HP-UX it is recommended to exclude the log volume(s) from the backup. Fbackup issues a warning note if a file is changed during backup. It may take multiple attempts to backup the log volume.

In case the eloqdb6 server is shut down during on-line backup mode (or a failure occurs) the data volume(s) are updated automatically when the server is restarted.

How to use on-line backup

Suppose you have data volume(s) located in the directory /db/data and log volume(s) located in the directory /db/log. Use the following commands to backup your data volume(s):
 dbctl -u dba backup start
 tar -cf /dev/rmt/0m /db/data
 dbctl -u dba backup stop
Please note: You should consider to not backup your log volume(s) in on-line backup mode - they are not used to recover the database. They only take space on your backup media.

Please Note: If multiple eloqdb6 instances are active on one system, on-line backup must be activated for each database server environment separately.

How to recover from an on-line backup

To recover the database to the state when the on-line backup was started, please make sure the database server process is not active and recover the data volume(s) from the backup media. If your log volumes are still present, you are ready to start the eloqdb6 server. The contents of the log volume(s) are ignored.

If your log volume(s) are lost (e.g. due to a disk failure) you can use dbvolextend to re-create your log volume(s). Execute dbvolextend -t log /path/to/logvol for each missing log volume file. The log volume file name(s) must match already existing entries the server configuration file.

Assumed your database environment was configured to use two log volumes named /db/log/log01.vol and /db/log/log02.vol the following commands can be used to re-create the log volumes:

 dbvolextend -t log /db/log/log01.vol
 dbvolextend -t log /db/log/log02.vol
Since any previous log volume properties (like min. or max. size) are lost you may need to specify additional options to dbvolextend or use dbvolchange to modify the volume properties. You can use dbvoldump to display the volume information.

After the log volume(s) are re-created, you can start the eloqdb6 server process.

On-line backup and database utilities

Database utilities which modify the data volume can not be used immediately if the eloqdb6 server was shut down or crashed while in on-line backup mode. The log data (all committed transactions since entering on-line backup mode) has been temporarily stored in the log volume and must be recovered before database utilities are allowed to modify the data volume. Otherwise all transactions pending since starting the on-line backup would be lost.

The following message is output by the affected utilities:

 NOTE: Database environment has been shutdown during 
       on-line backup. Please restart the database server 
       once in order to recover from on-line backup mode, 
       then reapply this command.
To recover the information from the log volume, please either run dblogreset or start the eloqdb6 server. Afterwards you can use the utility program as planned.

Affected tools are:

  • dbvolextend
  • dbvolchange
  • dbfsck (in write mode)

On-line backup and forward-logging

When on-line backup mode is activated and forward logging is active, a new log segment is started. In case the database server is configured to manage the forward log files, a new forward log file is created. This new forward log file covers all changes since the on-line backup has started. After the on-line backup has finished successfully, all previous forward log files (which existed before the on-line backup mode was started) can be removed as they are covered by the backup.



dbstore / dbrestore

The dbstore / dbrestore functionality allows transfer of a single database from a database environment to a file or tape device. This makes it convenient to save a snapshot of a database or move a single database to another system.

Please note: This is not a recommended strategy to backup your database environment. The on-line backup and off-line backup methods presented above provide a consistent backup of your complete database environment which includes all your databases and additional configuration (users, passwords, database permission groups and user assignments). Dbstore only backs-up a single database.

How to use dbstore and dbrestore

The dbstore and dbrestore operation is executed by the database server and the archive files are written by the server process. The dbctl utility is only used to initiate the process.

Backup files are written to and read from pre-configured paths (called "server devices") to avoid unauthorized access to the server system. A "server device" could either be a single file, a directory or a device. When no server devices are configured, dbstore and dbrestore operation is refused by the server.

The example below defines two "server devices". The device "tape" points to a tape device file, the device "backup" points to a directory which is intended to hold the backup files.

 [devices]
 Tape = /dev/rmt/c1t0d0BEST
 Backup = /data/backup
The dbctl utility is used to initiate a store or restore operation.
 dbctl dbstore database target
 dbctl dbrestore [/info] source [new_database_name]
The dbctl dbstore command transfers a single database to the target "device" which must be defined in the server configuration file. In order to store a database, database admin (dadmin) or server admin (dba) capabilities are required. Exclusive access to the database is required.

The target specification is either the name of a configured server device or the name of a server device and a filename separated by a slash.

The dbctl dbrestore command restores a single database from a source device which must be defined in the server configuration file. The database may not already exist. Server administration (dba) capabilities are required in order to restore a database.

The source specification is either the name of a configured server device or the name of a server device and a filename separated by a slash. If the optional /info argument is present, information on the archive is returned and the archive is not restored.

If the optional new_database_name argument is present, the database is restored to the specified name instead of the original database name.

Limitations

Since dbstore copies the database to a binary archive, the archive occupies the same disk space as the database. The archive can only be restored to a system with the same byte order. For example, you cannot create an archive on Linux and restore it on a HP-UX system. You need to use dbexport/dbimport to move a database to a different architecture.

When a database is restored, the association between database permission groups and server users ("sysmember") is deleted for all but the default "dba" and "public" users. Since the database could be restored on a different server this could otherwise lead to inconsistencies or unauthorized access to your data.

Backup files created by dbctl dbstore are limited to 2 GB on the HP-UX and Linux platforms when writing to the file system. A dbctl dbstore will fail when the backup file exceeds 2 GB. The solution is to compress the backup on the fly which might also improve performance as the disk I/O is reduced significantly. See below for more information.

Saving a database with dbstore

Assumed you defined a server device "tape" in your server configuration file the command below dumps the database payrol to the tape device:
 dbctl -u dba dbstore payrol tape
Assumed you defined a server device "backup" in your server configuration which refers to a directory the command below dumps the database payrol to the file payrol.bkup in the specified directory:
 dbctl -u dba dbstore payrol backup/payrol.bkup

Recovering a database with dbrestore

To restore the database from the tape (after it has been purged) the command below could be used:
 dbctl -u dba dbrestore tape
The command below can be used to recover the database from the archive file payrol.bkup in the directory the "backup" device refers to:
 dbpurge -u dba payrol
 dbctl -u dba dbrestore backup/payrol.bkup
The command below displays the backup header instead of restoring the database:
 dbctl -u dba dbrestore /info tape

The command below restores a previous backup to a new database:

 dbctl -u dba dbrestore backup/payrol.bkup payrol-new

Compressed backups

The backup files can be compressed during dbstore and uncompressed during dbrestore. Add the following to the [Devices] section of your eloqdb6.cfg file:
 [devices]
 zip = |gzip -c >/backup
 unzip = |gzip -dc /backup
Please note: On HP-UX you may need to specify the path to gzip (/usr/contrib/bin/gzip) if the global path does not include the location of the gzip command.

When performing an backup to the "zip" destination this will cause the backup file to be compressed. A dbrestore from the "unzip" source is used to restore the compressed data.

 dbctl -u dba dbstore payrol zip/payrol.bkup.gz
 dbctl -u dba dbrestore unzip/payrol.bkup


© Copyright 2002-2003 Marxmeier Software AG. All rights reserved.
Revision: 2003-03-19 / 2010-02-24