User Guide > User Guide > A. Command Reference > createdb Command--Create a Database
Was this helpful?
createdb Command--Create a Database
The createdb command creates a new database. The user who creates a database becomes the DBA for that database.
By default, all users have access to a database although access to tables in the database must be explicitly granted. To create a private database, use the -p flag.
By default createdb creates a Unicode-enabled database with Normalization Form C, with X100 storage structure.
Before you can specify file locations in the createdb command, the directories must exist. If not specified, a default location, created during installation, is assumed.
Note:  If createdb fails for any reason, destroy the partially created database using the destroydb command.
The createdb command has the following format:
createdb dbname [-dlocationname] [-clocationname]
[-jlocationname] [-blocationname] [-wlocationname]
[-encrypt] [-i] [-n] [-p] [-S] [-uusername] [-Ppassword]
[-rlocationname]
dbname
Specifies the name of the database to be created. The name must be unique and begin with an alphabetic character. The name can have a maximum of 24 alphanumeric characters (the underscore is also allowed).
-dlocationname
Specifies the location of the database files. The default is the location to which II_DATABASE points.
-clocationname
Specifies the location of the checkpoint files. The default is the location to which II_CHECKPOINT points.
-jlocationname
Specifies the location of the journal files. The default is the location to which II_JOURNAL points.
-blocationname
Specifies the location of the dump files. The default is the location to which II_DUMP points.
-wlocationname
Specifies the location of the work files. The default is the location to which II_WORK points.
-encrypt
Encrypts the database and prompts you to enter an initial encryption passphrase. Createdb leaves the encrypted database unlocked. The passphrase should contain at least 8 but no more than 512 characters and cannot contain control characters.
-i
Note:  Createdb uses the –i flag by default. You do not have to specify it unless you want to specify a collation name.
Creates a Unicode-enabled database using Normalization Form C (NFC). This enables storing and manipulating Unicode data by defining columns as Unicode data types (that is, nchar, nvarchar, and long nvarchar). The database uses NFC for normalization of Unicode strings for processing and storage. NFC results from the canonical decomposition of a Unicode string, followed by the replacement of all decomposed sequences by primary composites, where possible.
-n
Creates a Unicode-enabled database using Normalization Form D (NFD). This enables storing and manipulating Unicode data by defining columns as Unicode data types (that is, nchar, nvarchar, and long nvarchar). The database uses NFD for normalization of Unicode strings for processing and storage. NFD results from the canonical decomposition of a Unicode string.
-p
Creates a private database. Only the DBA and names specified on the accessdb command have access to the database.
-S
Creates an iidbdb. You must be a privileged user to use this flag.
-uusername
Specifies the effective user for the session, as described in Standard Flags and Parameters.
-Ppassword
Specifies the user password, not valid when using DBMS authentication.
-rlocationname
Specifies the new location of the read-only database; typically this will be the drive where the read-only database is located.
Last modified date: 12/06/2024