Mimer SQL Documentation TOC PREV NEXT INDEX

Mimer SQL Developer Site


Databank Backups


A databank backup is a copy of the databank file.

A databank backup is the starting point for any restore operation, and should be stored in a safe place separate from the working databank files (copied to a different disk or preferably written to backup media and removed from the machine).

The backup can be taken either by using the Mimer SQL system administration statements for online backup, see Online Backups Using the SQL Statements, or by using the host file system utilities in a system backup, see System Backups Using the Host File System.

After a backup is taken, the updates logged for the databank in question should be cleared from LOGDB. This will be done automatically when the SQL system management statements for online backup are used.

The DBC program, see Databank Check Functionality, should be executed for each databank in the backup operation in order to validate the physical consistency of the databank.

For a system backup, the backup copies of the databanks should always be taken when the system is closed and the databanks are in a logically consistent state. That is, no uncompleted transactions should exist and all databanks should be backed up at the same time to safeguard database consistency.

System vs. Online Backups

The main advantage of online backup is that all databanks, including the system databanks, can be backed up while the system can remain operational. The backup is initiated and executed by use of SQL statements only. The disadvantage can be that there must be enough disk space available to copy the complete database.

If the disk space is limited, a system backup can be preferable. For a system backup, the database server must be stopped. A system backup needs certain SQL statements (such as set online/offline) to be used together with operating system commands for file copying, etc.

SQL Statements for Backing-up Databanks

Refer to the Mimer SQL Reference Manual, SQL Statement Descriptions for a detailed description and syntax definition of the SQL system management functions. A brief description of the purpose of each function appears here.

Online Backup Commands

The SQL system management statements that can be used to take backups are:

Command
Description
 START BACKUP
starts a backup transaction.
 CREATE BACKUP
creates a backup within a backup transaction. By default an online backup is created, but optionally an exclusive backup can be initiated, which will lock the databank from other users.
 COMMIT BACKUP
commits a started backup transaction.
 ROLLBACK BACKUP
aborts a backup transaction and ensures that all log records are preserved.

To use these statements to take a databank backup, the user must either be the creator of the databank, or have BACKUP privilege.

When the SQL statements are used to take a backup of a databank, the entire process of taking a databank backup is handled automatically.

The use of a backup transaction ensures that the backups taken within the transaction are consistent with one another, as each backup is effectively taken at the same point in time. Log records are cleared for successfully backed up databanks when the backup transaction is committed. If LOGDB is included in the backup transaction all log records are cleared.

Online/Offline Commands

The SQL system management statements (typically used when taking databank backups using the host file system) that can be used to set a databank, shadow or the whole database online or offline are:

Command
Description
 SET DATABASE OFFLINE
sets all non-system databanks offline, and makes the database unavailable.
If one of the databanks cannot be set offline (e.g. because it is being used), the command will fail.
 SET DATABASE ONLINE
sets all databanks online, optionally clearing all records from LOGDB and makes the database available.
 SET DATABANK OFFLINE
sets a databank offline and the databank pages are updated with all changes made by committed transactions so far.
The databank file is closed (except SYSDB, which always remains open as long as the database server is running) so the file can be copied, and it becomes unavailable to database users.
 SET DATABANK ONLINE
sets a databank online, making it available, optionally clearing records from LOGDB.
 SET SHADOW OFFLINE
sets a list of shadows offline, making them unavailable.
 SET SHADOW ONLINE
sets a list of shadows online, making them available, optionally clearing records from LOGDB.

A user setting the database online/offline, must have BACKUP privilege and must be the only user accessing the database.

A user setting a databank or a shadow online/offline, must either be the creator of the databank or have BACKUP privilege.

Restore Command

The SQL system management statement used to recover a databank in the event of it being damaged or destroyed is:

Command
Description
 ALTER DATABANK RESTORE
used to restore a databank from a backup copy by using a LOGDB backup and/or the information currently in the LOGDB system databank.

A user using this function to restore a databank must be the creator of the databank or have BACKUP privilege.


Mimer
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40
info@mimer.se
Mimer SQL Documentation TOC PREV NEXT INDEX