createdb(1sql)
Name
createdb − create a database.
Syntax
createdb [ −p] dbname [ −uusername]
[−clocationname] [−dlocationname] [−jlocationname ]
Description
The createdb command creates an ULTRIX/SQL database. By default, the person who executes this command becomes the database administrator (DBA) for the database being created. The DBA has special powers not granted to ordinary users of the database. The parameter dbname is the name of the database to be created. The value for dbname must uniquely identify a database in the ULTRIX/SQL system, must begin with an alphabetic character, and can be no more than twelve characters. If, for any reason, execution of the createdb command fails and the database is only partially created, delete the partially created database using the destroydb command.
Options
−clocationname
Assign checkpoints to the location specified by locationname. The location ii_checkpoint is the default.
−dlocationname
Assign database components (for example, tables, indexes, and system catalogs) to the location specified by locationname. The default location is ii_database.
−jlocationname
Assign journals to the location specified by locationname. The default location is ii_journal.
−pRestrict database access to only the DBA and other users who have been given the right to access the database through the accessdb utility. By default, a database is created with access permitted to all ULTRIX/SQL users, although access to any tables in the database must be explicitly granted. The accessdb utility, used by the ULTRIX/SQL system administrator, allows additional users access to a private database.
−uusername
Allow the ULTRIX/SQL system administrator to create a database as the user specified by username.
Before you can specify a locationname using a −d, −c, or −j option, the ULTRIX/SQL system administrator must run accessdb to define the locationname and map it to an existing directory. If you do not specify a locationname for database, checkpoint, or journal, the files will be placed in the appropriate default directories; that is, the files will be stored in directories to which default locationnames (ii_database, ii_checkpoint, and ii_journal) are mapped. It is recommended that the database, checkpoint, and journal files associated with dbname be stored on separate devices so that you can recover data in the event of single disk failure. Depending on how the ULTRIX/SQL system administrator set up the ULTRIX/SQL file system at initialization time, ii_database, ii_checkpoint, and ii_journal locations may be mapped to directories that are mounted to different devices. The −c, −d and −j options allow you to distribute database components to non-default locations (and also to different directories on different devices). You may want to do this to protect your ability to recover data (if the default locations are not mapped to directories on different devices), to improve performance (if a default device cannot handle the I/O demands of additional databases), or both.
Examples
Create a private database named mydb using default locations:
createdb -p mydb
As the ULTRIX/SQL system administrator, create a public database named empnews and specify that the DBA privileges be assigned to username persdba. Assume that persdba is an ULTRIX username that is also defined in the ULTRIX/SQL users file:
createdb -upersdba empnews
Create a public database named orders with nondefault locations for database, checkpoints, and journals. Assume that the locations orderdb_loc, orderckp_loc, and orderjnl_loc have already been defined and mapped to existing directories using accessdb:
createdb orders -dorderdb_loc -corderckp_loc -jorderjnl_loc
Files
$II_SYSTEM/sql/files/dbtmplt
Directory of template files used by ULTRIX/SQL when new databases are created.
$II_DATABASE/ingres/data/default/dbname
Default directory for database files associated with dbname. (The default location ii_database is mapped to this directory.)
$II_CHECKPOINT/ingres/ckp/default/dbname
Default directory for checkpoint files associated with dbname. (The default location ii_checkpoint is mapped to this directory.)
$II_JOURNAL/ingres/jnl/default/dbname
Default directory for journal files associated with dbname. (The default location ii_journal is mapped to this directory.)
See Also
destroydb(1sql), intro(1sql), accessdb(8sql), intro(8sql)
ULTRIX/SQL Database Administrator’s Guide