gdb";
For more information about file naming conventions, see the Operations Guide.
DATA DEFINITION GUIDE
41
CHAPTER 3 CREATING DATABASES
SPECIFYING FILE SIZE FOR A SINGLE-FILE DATABASE
You can optionally specify a file length, in pages, for the primary file. For example, the
following statement creates a database that is stored in one 10,000-page- long file:
CREATE DATABASE "employee.gdb" LENGTH 10000;
If the database grows larger than the specified file length, InterBase extends the primary
file beyond the LENGTH limit until the disk space runs out. To avoid this, you can store a
database in more than one file, called a secondary file.
Note Use LENGTH for the primary file only if defining a secondary file in the same
statement.
4 Creating a multi-file database
A multi-file database consists of a primary file and one or more secondary files. You can create one or more secondary files to be used for overflow purposes only; you cannot
specify what information goes into each file because InterBase handles this automatically.
Each secondary file is typically assigned to a different disk than that of the main database.
When the primary file fills up, InterBase allocates one of the secondary files that was
created. When that secondary file fills up, another secondary file is allocated, and so on,
until all of the secondary file allocations run out.
IMPORTANT
Whenever possible, the database should be created locally; create the database on the
same machine where you are running isql. If the database is created locally, secondary file names can include a full file specification, including both host or node names, and a
directory path to the location of the database file. If the database is created on a remote
server, secondary file specifications cannot include a node name, as all secondary files
must reside on the same node.
SPECIFYING FILE SIZE OF A SECONDARY FILE
Unlike primary files, when you define a secondary file, you must declare either a file length in pages, or a starting page number. The LENGTH parameter specifies a database
file size in pages.
If you choose to describe page ranges in terms of length, list the files in the order in which they should be filled. The following example creates a database that is stored in four
10,000-page files, Starting with page 10,001, the files are filled in the order employee.gdb, employee.gd1, employee.gd2, and employee.gd3.
CREATE DATABASE "employee.gdb"
FILE "employee.gd1" STARTING AT PAGE 10001
LENGTH 10000 PAGES
FILE "employee.gd2"
LENGTH 10000 PAGES
42
INTERBASE 5
CREATING A DATABASE
FILE "employee.gd3";
LENGTH 10000 PAGES
Note Because file-naming conventions are platform-specific, for the sake of simplicity, none of the examples provided include the device and path name portions of the file
specification.
When the last secondary file fills up, InterBase automatically extends the file beyond the
LENGTH limit until its disk space runs out. You can either specify secondary files when the
database is defined, or add them later, as they become necessary, using ALTER DATABASE.
Defining secondary files when a database is created immediately reserves disk space for
the database.
SPECIFYING THE STARTING PAGE NUMBER OF A SECONDARY FILE
If you do not declare a length for a secondary file, then you must specify a starting page
number. STARTING AT PAGE specifies the beginning page number for a secondary file.
The primary file specification in a multi-file database does not need to include a length,
but secondary file specifications must then include a starting page number. You can
specify a combination of length and starting page numbers for secondary files.
InterBase overrides a secondary file length that is inconsistent with the starting page
number. In the next example, the primary file is 10,000 pages long, but the first secondary
file starts at page 5,000:
CREATE DATABASE "employee.gdb" LENGTH 10000
FILE "employee.gd1" STARTING AT PAGE 5000
LENGTH 10000 PAGES
FILE "employee.gd2"
LENGTH 10000 PAGES
FILE "employee.gd3";
InterBase generates a primary file that is 10,000 pages long, starting the first secondary
file at page 10,001.
4 Specifying user name and password
If provided, the user name and password are checked against valid user name and
password combinations in the security database on the server where the database will
reside. Passwords are restricted to 8 characters in length.
IMPORTANT
Windows client applications must create their databases on a remote server. For these
remote connections, the user name and password are not optional. Windows clients
must provide the USER and PASSWORD options with CREATE DATABASE before connecting
to a remote server.
DATA DEFINITION GUIDE
43
|