FirebirdSQL logo

A shadow is an exact, page-by-page copy of a database.Once a shadow is created, all changes made in the database are immediately reflected in the shadow.If the primary database file becomes unavailable for some reason, the DBMS will switch to the shadow.

This section describes how to create and delete shadow files.

CREATE SHADOW

Creates a shadow file for the current database

Available in

DSQL, ESQL

Syntax
CREATE SHADOW <sh_num> [{AUTO | MANUAL}] [CONDITIONAL]
  'filepath' [LENGTH [=] num [PAGE[S]]]
  [<secondary_file> ...]

<secondary_file> ::=
  FILE 'filepath'
  [STARTING [AT [PAGE]] pagenum]
  [LENGTH [=] num [PAGE[S]]]
Table 1. CREATE SHADOW Statement Parameters
Parameter Description

sh_num

Shadow number — a positive number identifying the shadow set

filepath

The name of the shadow file and the path to it, in accord with the rules of the operating system

num

Maximum shadow size, in pages

secondary_file

Secondary file specification

page_num

The number of the page at which the secondary shadow file should start

The CREATE SHADOW statement creates a new shadow.The shadow starts duplicating the database right at the moment it is created.It is not possible for a user to connect to a shadow.

Like a database, a shadow may be multi-file.The number and size of a shadow’s files are not related to the number and size of the files of the shadowed database.

The page size for shadow files is set to be equal to the database page size and cannot be changed.

If a calamity occurs involving the original database, the system converts the shadow to a copy of the database and switches to it.The shadow is then unavailable.What happens next depends on the MODE option.