Creating a Multifile Shadow

From InterBase
Jump to: navigation, search

Go Up to Creating a Shadow


If your database is large, you can shadow it to a multifile shadow, spreading the shadow files over several disks. To create a multifile shadow, specify the name and size of each file in the shadow set. As with multifile databases, you have the option of specifying the size of secondary files in either of two ways: specify the page on which each secondary file starts, or specify the length in database pages of each file. When you specify the size using the LENGTH keyword, do not specify the length of the final file. InterBase sizes the final file dynamically, as needed.

For example, the following example creates a shadow set consisting of three files. The primary file, employee.shd, is 10,000 database pages in length. The second file is 20,000 database pages long, and the final file grows as needed.

SQL> CREATE SHADOW 1 'employee.shd' LENGTH 10000
CON> FILE 'emp2.shd' LENGTH 20000
CON> FILE 'emp3.shd';

Instead of specifying the page length of secondary files, you can specify their starting page. The following example creates the same shadows as the previous example:

SQL> CREATE SHADOW 1 'employee.shd'
CON> FILE 'emp1.shd' STARTING AT 10000
CON> FILE 'emp2.shd' STARTING AT 30000;

In either case, you can use SHOW DATABASE to verify the file names, page lengths, and starting pages for the shadow just created:

SQL> SHOW DATABASE;
Database: employee.ib
Shadow 1: '/usr/InterBase/examples/employee.shd' auto length 10000
file /usr/InterBase/examples/emp1.shd length 2000 starting 10000
file /usr/InterBase/examples/emp2.shd length 2000 starting 30000
PAGE_SIZE 4096
Number of DB pages allocated = 392
Sweep interval = 20000

The page length you allocate for secondary shadow files need not correspond to the page length of the secondary files of the database. As the database grows and its first shadow file becomes full, updates to the database automatically overflow into the next shadow file.

See Also