Creating and Removing a Database
Creating a Database
To create a database you must use the mkdbase command.
Databases may be of two types:
-
Partition database. This can be constructed in three ways:
-
Using standard host files on different file systems - this is available on both UNIX and Windows and gives the best performance on systems other than Solaris. If the file systems are on different spindles, the files can be striped by Reality to improve performance.
-
Using disk partitions directly - this is available on UNIX only and is optimised for use on Sun Solaris systems. The partitions are striped by Reality to improve performance.
-
Using standard host files with all the files on the same file system - this is available on both UNIX and Windows and is simple to configure. Reality striping is not possible, so the response can be slower when compared to the other types of partition database (depending on the efficiency of any striping performed by the operating system). Its use is not recommended where high performance is required and/or a large number of users must be supported.
A partition database can have up to 231 frames - with the default 1Kbyte frame size, this gives a maximum size of 2 Terabytes (2048Gbytes).
-
-
Filestore database (UNIX only). This is simple to configure, but has limitations when compared to the other types of database. It is best suited to small databases such as those used for test purposes.
A filestore database is constructed using the host file system. Each Reality dictionary and data file equates to a normal host file and each account is equivalent to a host directory. Because of this, a filestore database expands and contracts as you add and delete data.
The maximum size of a filestore database is determined by the size of the containing partition.
A newly created database is locked to all users except the owner and, on UNIX, the super-user. The database must be configured (see Reality Configuration on the Host) before it can be unlocked (see Locking and Unlocking a Database).
Note
On Windows 7 and Server 2008, databases that will be available on the network must be created in a folder with unrestricted access, such as a dedicated subfolder within the root folder. A database in a user's home folder cannot be accessed remotely.
Partition Database (single filesystem)
To create a partition database on a single file system, enter:
mkdbase -N databaseName -Ssize{
files}
{
databasePath}
where databaseName is the network name that you will use to connect to the database, and databasePath is the path to the directory that will hold the database files.
The size of the database is specified by the size parameter - you can specify size in Megabytes or Gigabytes by using the appropriate suffix (M or G respectively). files specifies the number of files used (default 10). For example, to create a 20Gbyte database called dbase1 in the current directory, enter:
mkdbase -N dbase1 -S20G
The database will consist of ten 2Gbyte files.
Note
Choose the number of files carefully - you enlarge this type of database by adding more files that are the same size as the existing ones.
This type of database is the default. If you omit the -S option and there is no corresponding entry in realfstab (see below), a partition database is created consisting of a single host file with 20000 frames (see Frame Size).
Partition Database (multiple filesystems or partitions)
To create a partition database using disk partitions or files on different file systems, add an entry to the realfstab file listing the partitions or files (as appropriate) assigned to the database. Then enter:
mkdbase -N realfstabEntry
where realfstabEntry is the name of the entry in the realfstab file. For example, having created a realfstab entry called dbase1, create the database by entering:
mkdbase -N dbase1
The database's base directory will be created in the current directory.
Filestore Database (UNIX only)
To create a filestore database, enter:
mkdbase -U -N databaseName{
databasePath}
where databaseName is the network name that you will use to connect to the database, and databasePath is the path to the directory that will hold the database files. If you omit databasePath, a sub-directory with the same name as the database is created in the current directory. For example, to create a filestore database called dbase1 in the current directory, enter:
mkdbase -U -N dbase1
Enlarging a Database
Partition Database (single filesystem)
A partition database on a single filesystem can be enlarged by adding files. Enter:
mkdbase -N databaseName -A files
where databaseName is the name of the database and files is the number of files to add. The files will be the same size as the existing ones - this depends on the size of the original database and number of files used (see Making a Database).
Partition Database (multiple filesystems or partitions)
There are two ways of enlarging a partition database that uses disk partitions or files on different file systems:
-
Change the striping scheme in the realfstab file to add new elements and then rebuild the database with mkdbase -r.
-
Add new partitions or files outside the striping scheme to the realfstab file. Then add them to the database with the host command:
mkdbase -a realfstabEntry
where realfstabEntry is the name of the entry in the realfstab file.
This method should be used only if insufficient time is available to rebuild the database. When time permits, you should rebuild the database with a revised striping scheme.
Filestore Database (UNIX only)
A filestore database expands and contracts automatically as you use the database.
Rebuilding a Database
In some circumstances it may be desirable to rebuild an existing database. This can be done using mkdbase with the -r option.
Caution
When you rebuild a database, the top database directory and the config file are retained, but the rest of the database is removed and rebuilt. Any user data in the existing database which you wish to keep must be saved, and restored on the re-constructed database.
Removing a Database
To remove a database you must use the rmdbase host command.