DelphiFAQ Home Search:
General :: Databases :: InterBase
Help with InterBase, Borland's open source database.


This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

How can I improve our production InterBase database server?


Our company's production database is running on InterBase on Windows XP. I worry what happens if that Windows machine goes down (disk crash, Windows crash).
How can I improve availability of our production InterBase database server?


Despite its bad reputation, Windows - and in particular Windows XP - can be a solid server operating system if you are talking about a dedicated machine, locked in a server room.
Such a machine would not be subject to random installations to try out "some new software".

However, any machine can fail - a hard disk can crash, you can have an electric outage and your USV may not work.

Normally you would make daily backups (depending on frequency of updates in your situation) and in case of a hardware failure, restore from yesterday's backup.

Your downtime would be maybe an hour, including the time to get a second machine ready.

A great way to increase availability is to create a shadow of the database. Shadows are exact duplicates of the database. The purpose of shadows is to protect you from hardware failure. First you have to set up one or more shadows on sepaate diskss or better still, a separate machine. Then, when your primary disk or primary server breaks down, the users can reconnect to the shadow after you enable it.

Your downtime could be only a few minutes - much less than restoring from a backup.

Shadows can also be composed of multiple files just like normal databases.

The major drawback to shadows is that they increase the number of writes the database server does. If you have only one shadow then every write is duplicated. Two shadows and every write is tripled. This can cause performance problems. It gets slower if the shadow is on a remote machine - which on the other hand would help you if a major catastrophy like an earthquake hits your facility.

Here quickly how to create a shadow (see your InterBase manual):

Shadowing begins with the creation of a shadow, using the CREATE SHADOW statement. This statement has the following syntax:

CREATE SHADOW shadow_number [AUTO | MANUAL] [CONDITIONAL] shadow_filename

The shadow number identifies a shadow set that collects the primary shadow file and any secondary files together. The most important function of the shadow number is to identify the shadow if you decide to drop it (please refer to Deleting a Shadow).

This can be performed without affecting users at all, as it does not require exclusive access. Before creating the shadow, the following should be considered:
  1. Shadow location: a shadow should be created on a different disk from the main database, as shadowing is intended as a recovery mechanism in case of disk failure. Therefore storing the main database and the shadow on the same disk defeats the whole purpose of shadowing!
  2. Distributing the shadow: a shadow can be created as a single-file (shadow file) or as multiple files (shadow set). To improve space allocation and disk I/O, each file in a shadow set may be placed on a different disk.
  3. User access: if a shadow becomes unavailable, user access to the database can be denied until shadowing is resumed, or access can be allowed (i.e. work can continue as normal) although any changes made during this period will obviously not be shadowed. Please refer to auto mode and manual mode for further information.
  4. Automatic shadow creation: To ensure that a new shadow is automatically created, create a conditional shadow. Please refer to conditional shadows for further information.

Generated 12:00:25 on Oct 27, 2020