CREATE DB
Creates
a new database.
SYNTAX

| database_name |
Name
of the new database you want to create. |
DESCRIPTION
The CREATE
DB command creates a new database. To execute the CREATE DB command, DBMaker
must have write permission from the operating system on the directory
you want to create the database in. Any user can execute the CREATE DB
command.
DBMaker
stores all configuration information for each database in the dmconfig.ini
configuration file. This file contains a database configuration section
for each database you can connect to from your computer. The dmconfig.ini
configuration file is an ASCII text file, and can be edited with any text
editor.
Each database
configuration section is comprised of a section header followed by one
or more keyword lines. The section header is the name of the database
enclosed in square brackets. The keyword lines consist of a keyword and
a corresponding value (or values). If a keyword requires or supports multiple
values, you can delimit individual values with either spaces or commas.
Depending on their purpose, keywords may be used either at start time
or connect time.
Key words
in the dmconfig.ini configuration file are not case-sensitive. Keyword
values may or may not be case-sensitive, depending on the keyword and
the operating system the database is running on. The dmconfig.ini configuration
file is an ASCII text file, and can be edited with any text editor.
When you
create a database, DBMaker will examine the dmconfig.ini configuration
file for a database configuration section. If a database configuration
section with the same name as your database exists, DBMaker will use the
values specified in this section when it creates the database. If a database
configuration section with the same name as your database does not exist,
DBMaker will use default values when it creates the database and will
add a new configuration section.
You should
choose a database name that is unique among all computers that will connect
to the database. Since DBMaker stores configuration information for all
local and remote databases in the dmconfig.ini configuration file, using
the same name for two databases will cause a conflict. You cannot change
the database name once it has been created, unless you unload all data
and recreate the database with a new name. Database names have a maximum
length of eight characters, and may contain letters, numbers, and the
underscore character. Database names are not case-sensitive.
In the DBMaker
physical storage model, files are physical units of storage that contain
the data inserted into the database. Files themselves are managed by the
operating system, while data in the files is managed by the DBMS. DBMaker
uses three types of files: data files, BLOB files, and journal files.
Data files
and BLOB files are used to store user and system data. Although they have
similar characteristics, DBMaker manages these two file types in different
ways to improve performance. Data files store table and index data, while
BLOB files store only binary large objects.
Journal
files are special files that provide a real-time, historical record of
all changes made to a database and the status of each change. This allows
the database to undo changes made by a transaction that fails, or redo
changes made successfully but not written to disk after a database crashes.
Journal files are used only by the database management system, and are
not used to store user data.
In the DBMaker
logical storage model, tablespaces are the logical storage structures
used to partition information in a database into manageable areas. Each
tablespace may contain several tables and indexes. Data in the tablespace
is managed by the DBMS, but is physically stored in files. There are three
types of tablespaces: regular, autoextend, and system.
Regular
tablespaces are tablespaces that have a fixed size and contain one or
more data or BLOB files. They may be extended manually by enlarging existing
files in the tablespace or adding new files to the tablespace. A regular
tablespace may contain a maximum of 32767 files, with a maximum cumulative
file size of 2 GB. On Unix platforms, regular tablespaces may be placed
on raw devices. (For more information on raw devices, see your Unix system
documentation.)
Autoextend
tablespaces are tablespaces that automatically increase in size (to a
maximum of 2 GB) to hold additional data when required. They must contain
one data file, and may optionally contain one BLOB file. You cannot add
new files to an autoextend tablespace unless you first convert it to a
regular tablespace, with one exception: if an autoextend tablespace is
created with only one data file and no BLOB file, you may add a single
BLOB file at a later time. An autoextend tablespace may only contain one
data file and one BLOB file, with a maximum cumulative size of 2 GB. Autoextend
tablespaces cannot be used with raw devices.
System tablespaces
are tablespaces generated by DBMaker when you create a database. Each
database has one system tablespace, which contains the system catalog
tables used to store schema, security, and status information about the
entire database. The system tablespace is created as an autoextend tablespace,
unless you create your database on a Unix raw device. System tablespaces
may be converted to regular tablespaces. System tablespaces are created
with an initial data file size of 600 KB, and an initial blob file size
20 KB.
DBMaker
will always create one system data file and one system BLOB file in the
system tablespace, and will also create one user data file and one user
BLOB file in the default user tablespace. In addition to these files,
DBMaker also creates at least one system journal file to log database
transactions.
The default
names for the system files are: DATABASE.SDB, DATABASE.SBB, and DATABASE.JNL,
where DATABASE is the name of your database. To change the default names,
you can use the DB_DBFIL, DB_BBFIL, and DB_JNFIL keywords in the dmconfig.ini
configuration file. Use DB_DBFIL to specify the name of the system data
file, DB_BBFIL to specify the name of the system BLOB file, and DB_JNFIL
to specify the name of the system journal file. If you do not want to
use the default name for any of the system files, you must specify a new
name before you create your database; you cannot change the name of a
system file after you have created your database.
The default names for the default user files are: DATABASE.DB and DATABASE.BB,
where DATABASE is the name of your database. To change the default names,
you can use the DB_USRDB and DB_USRBB keywords in the dmconfig.ini configuration
file. Use DB_USRDB to specify the name and size of the default user data
file, and DB_USRBB to specify the name and size of the default user BLOB
file. When using these two keywords to specify new names for the default
user files, you must also include the size of the file (in data pages
or BLOB frames), separated from the filename by a space or comma. If you
do not want to use the default name for either of the default user files,
you must specify a new name before you create your database; you cannot
change the name of a default user file after you have created your database.
DBMaker
can use up to eight journal files to log database transactions. To create
multiple journal files, add additional filenames after the DB_JNFIL keyword,
separated by spaces or commas. DBMaker will automatically create these
journal files when it creates the database. It is possible to add additional
journal files to a database after you create it by adding additional journal
filenames and restarting the database in new journal mode.
If you want
to include a path with a filename, you must include the drive and full
path on Windows 95 or Windows NT systems. On Unix systems, you may include
either a full or relative path. If you do not specify a path, the file
will be created in the directory specified by the DB_DBDIR keyword in
the dmconfig.ini configuration file, or the application directory if the
DB_DIR keyword is not present. DBMaker system files may have filenames
with a maximum length (including drive and path names) of 79 characters,
and may contain any characters and symbols permitted by the operating
system, except spaces.
The default
sizes for the system files are: 600 KB for the system data file, 20 KB
for the system BLOB file, and 4000 KB for the journal file. To change
the default file sizes, you can use the DB_BFRSZ and DB_JNLSZ keywords
in the dmconfig.ini configuration file.
The DB_BFRSZ keyword specifies the size of frames in the system BLOB file,
which also changes the size of the system BLOB file. You must provide
a value for DB_BFRSZ when you create your database if you do not want
to use the default , and it cannot be changed after you create your database.
The DB_JNLSZ
keyword specifies the size of the system journal file in journal blocks,
which are the primary unit of storage in a journal file. Journal blocks
store a record of every transaction performed on the database. The size
of each journal block is fixed at 4 KB. Each journal block can store information
on as many transactions as will fit into a block. To specify a size for
a system journal file, set the DB_JNLSZ keyword to a value between 23
- 524287 blocks. To calculate the actual size of the file in kilobytes,
multiply this value by 4 KB. If your database has multiple journal files,
DBMaker creates each journal file with the size specified by DB_JNLSZ.
The default value for DB_JNLSZ is 250. You may change the DB_JNLSZ keyword
at any time, but it will not take effect until the next time you start
your database in new journal mode.
The default
sizes for the default user files are: 600 KB for the default user data
file, and 20 KB for the default user BLOB file. To change the default
file sizes, you can use the DB_USRDB and DB_USRBB keywords in the dmconfig.ini
configuration file.
The DB_USRDB
keyword specifies the size of the default user data file in data pages,
which are the primary unit of storage in a data file. Data pages store
table records, index keys, and any BLOB data small enough to fit onto
the data page. Each data page can store as many table rows or index keys
as will fit onto a page. The size of each data page is fixed at 4 KB.
To specify a size for the default user data file, set the size parameter
of the DB_USRDB keyword to a value between 2-524287 pages. To calculate
the actual size of the file in kilobytes, multiply this value by 4 KB.
The default value of DB_USRDB is 150.
The DB_USRBB
keyword specifies the size of the default user BLOB file in BLOB frames,
which are the primary unit of storage in a BLOB file. BLOB frames store
large binary data objects such as graphics, audio and video, or large
text which will not fit onto a data page. Each BLOB frame can only store
a single BLOB. The size of each BLOB frame is specified by the DB_BFRSZ
keyword, which can range from 8 KB to 256 KB. To specify a size for the
default user BLOB file, set the size parameter of the DB_USRBB keyword
to a value between 2-524287 frames. To calculate the actual size of the
file in kilobytes, multiply this value by the value of DB_BFRSZ. The default
value for DB_USRBB is 2.
Security
mode determines whether DBMaker will use security privileges to control
access to the database. There are four levels of security privileges:
CONNECT, RESOURCE, DBA, and SYSADM.
CONNECT
security privilege allows you to connect to the database, view the system
tables, and access any database objects you have explicitly granted privileges
on by the object owner, a user with DBA security privilege, or the SYSADM.
You cannot create any new database objects with CONNECT security privilege.
You must be granted the CONNECT security privilege before you can be granted
any other privilege.
RESOURCE
security privilege allows you to create and drop tables, indexes, views,
synonyms, and domains. You can only drop tables, views, synonyms, and
domains you created yourself, not those created by other users. You can
also grant and revoke object privileges to other users on any database
objects you created yourself. Users with RESOURCE security privilege also
have all privileges of CONNECT security privilege.
DBA security
privilege allows you to start, terminate, and back up databases, manage
database resources such as tablespaces and files, and access all tables,
indexes, views, synonyms, and domains without having been explicitly granted
any privileges. You can also grant, change, and revoke object privileges
on any database object owned by any user. You may not grant security privileges
to new users or create new groups, but you may add and remove users from
existing groups. Users with DBA security privilege also have all privileges
of RESOURCE and CONNECT security privilege.
SYSADM security
privilege allows you to grant and revoke security privileges to all users,
create and drop groups, and add and remove users from groups. You can
also change the password of any user. There is only one user in each database
with SYSADM security privileges. DBMaker automatically creates this user
when you create the database, and assigns the user name SYSADM. You may
not grant SYSADM security privileges to any other users. The SYSADM user
also has all privileges of DBA, RESOURCE, and CONNECT security privileges.
You must
set the security mode before you create a database. Once you have created
a database, you cannot change the security mode unless you unload and
recreate the database. You can use the DB_SECUR keyword in the dmconfig.ini
configuration file to set the security mode. If you do not use the DB_SECUR
keyword when you create a database, security mode is ON by default.
When security
mode is ON, only users who have been granted appropriate security privileges
can connect to the database. A user name and password (if assigned) are
required to connect to a database, and DBMaker not allow you to connect
to a database unless both are correct. DBMaker maintains a list of authorized
users and their security privileges for the database, and checks this
list to determine the specific commands each user can execute.
When security
mode is OFF, any user can connect to a database with any user name. Passwords
are not required to connect to a database, and DBMaker will ignore any
password you enter. DBMaker does not maintain a list of users or security
privileges for the database, and any user can execute any command.
When you
execute the CREATE DB command, DBMaker creates a new database, starts
the database, and connects you as the SYSADM. DBMaker does not assign
a password to the SYSADM user when it is created. You should change the
SYSADM password immediately after creating the database to prevent unauthorized
access to your database. DBMaker starts a newly created database in single-user
mode to prohibit other users from logging on to the database before you
can change the SYSADM password. To put the new password into effect and
allow other users to connect, you must shut down the database and restart
it in either single- or multi-user mode.
DBMaker
starts all databases in single-user mode by default. To start a database
in multi-user mode, you must use the DB_SVADR and DB_PTNUM keywords in
the client-side dmconfig.ini configuration file, and the DB_PTNUM keyword
in the server-side dmconfig.ini configuration file.
The DB_SVADR
keyword specifies the IP address or host name of the computer the DBMaker
server is running on. This keyword is required only on the client side;
it is optional on the server side. To specify an IP address or host name,
set the DB_SVADR keyword to any valid IP address or host name. If you
use a host name, you must also ensure that the Domain Name Service (DNS)
is properly set up on your computer.
The DB_PTNUM
keyword specifies the port number the DBMaker server is bound to. This
keyword is required on both the client and server sides. To specify a
port number, set the DB_PTNUM keyword to a value between 1025 - 65535.
If you do not specify a port number, DBMaker will default to port number
23000 by default.
EXAMPLES
The following
example creates a new database named Accounts with the default settings
for all parameters. (No database configuration section for this database
exists in the dmconfig.ini configuration file when this command is executed.)
This creates a single-user database in the application directory using
the default file names ACCOUNTS.SDB, ACCOUNTS.SBB, ACCOUNTS.DB, ACCOUNTS.BB
and ACCOUNTS.JNL and the default file sizes of 600 KB for the .SDB and
.DB files, 20 KB for the .SBB and .BB files, and 4000 KB for the .JNL
file. To start this database in multi-user mode, you must add the DB_SVADR
and DB_PTNUM keywords to the Accounts database configuration section in
the dmconfig.ini configuration file after you create the database.
The following
example creates a new database named Accounts using the settings shown
in the dmconfig.ini section below.
This database
configuration section exists in the dmconfig.ini configuration file when
the command is executed. This creates a single-user database with security
in the C:\DATABASE\ACCOUNTS directory, using file names ACCOUNTS.SDB for
the system data file, ACCOUNTS.SBB for the system BLOB file, ACNTDATA.DB
for the default user data file, ACNTBLOB.BB for the default user BLOB
file, and ACNTHIST.JN1, ACNTHIST.JN2, and ACNTHIST.JN3 for the three journal
files. The file sizes are 600 KB for the system data file, 20 KB for the
system BLOB file, 1000 KB for the default user data file, 8000 KB for
the default user BLOB file, and 2000 KB for each of the three journal
files. To start this database in multi-user mode, you must add the DB_SVADR
and DB_PTNUM keywords to the Accounts database configuration section in
the dmconfig.ini configuration file after creating the database.
[ACCOUNTS] DB_DBDIR = C:\DATABASE\ACCOUNTS DB_DBFIL = ACCOUNTS.SDB DB_BBFIL = ACCOUNTS.SBB DB_USRDB = ACNTDATA.DB 250 DB_USRBB = ACNTBLOB.BB 250 DB_BFRSZ = 32 DB_JNFIL = ACNTHIST.JN1, ACNTHIST.JN2, ACNTHIST.JN3 DB_JNLSZ = 500
|
RELATED COMMANDS
<
CREATE COMMAND | Contents
| CREATE DOMAIN >
|