This section describes how to create and delete shadow files.
Used forCreating a shadow for the current database
Available inDSQL, ESQL
Syntax
Table 5.2.1.1 CREATE SHADOW
Statement Parameters
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 database it is shadowing.
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.
5.2.1.1 AUTO | MANUAL
Modes
When a shadow is converted to a database, it becomes unavailable. A shadow might alternatively become unavailable because someone accidentally deletes its file, or the disk space where the shadow files are stored is exhausted or is itself damaged.
If the AUTO mode is selected (the default value), shadowing ceases automatically, all references to it are deleted from the database header, and the database continues functioning normally.
If the
CONDITIONAL
option was set, the system will attempt to create a new shadow to replace the lost one. It does not always succeed, however, and a new one may need to be created manually.
5.2.1.2 Options for CREATE SHADOW
LENGTH
Specifies the maximum size of the primary or secondary shadow file in pages. The LENGTH
value does not affect the size of the only shadow file, nor the last if it is a set. The last (or only) file will keep automatically growing as long as it is necessary.
STARTING AT
Specifies the shadow page number at which the next shadow file should start. The system will start adding new data to the next shadow file when the previous file is filled with data up to the specified page number.
Tip
You can verify the sizes, names and location of the shadow files by connecting to the database using isql and running the command
5.2.1.3 Who Can Create a Shadow
The CREATE SHADOW
statement can be executed by:
5.2.1.4 Examples Using CREATE SHADOW
Creating a shadow for the current database as shadow number 1:
Creating a multi-file shadow for the current database as shadow number 2:
See alsoSection 5.1.1, CREATE DATABASE,
5.2.2 DROP SHADOW
Used forDeleting a shadow from the current database
Available inDSQL, ESQL
Syntax
Table 5.2.2.1 DROP SHADOW
Statement Parameter
Parameter | Description |
---|---|
sh_num | Shadow number — a positive number identifying the shadow set |
The DROP SHADOW
statement deletes the specified shadow for the current database. When a shadow is dropped, all files related to it are deleted and shadowing to the specified sh_num ceases. The optional DELETE FILE
clause makes this behaviour explicit. On the contrary, the PRESERVE FILE
clause will remove the shadow from the database, but the file itself will not be deleted.
5.2.2.1 Who Can Drop a Shadow
The DROP SHADOW
statement can be executed by:
Users with the privilege
5.2.2.2 Example of DROP SHADOW
Deleting shadow number 1.
See also