2. Using Ingres Commands : createdb Command—Create a Database
 
Share this page                  
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, even if the character set for the installation is not UTF8. To disable Unicode, use the ‑e flag.
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. For procedures on creating alternate locations, see the Database Administrator Guide.
Note:  When a database is created, system catalogs are created with the server default page size, unless specified differently on the –page_size parameter.
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[/server_class] [cdbname] [-dlocationname] [-clocationname]
[-jlocationname] [-blocationname] [-wlocationname] [-f product {product}]
[-llanguage] [‑e] [-i[collationname]] [-n[collationname]][-p] [-S]
[-uusername] [-Ppassword] [-rlocationname] [-page_size=n] [‑nosrid] [‑m]
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).
Also specifies the server_class, if required, as described in Standard Flags and Parameters (see page Standard Flags and Parameters). If you are using Ingres Star, you must specify star as the server_class. For examples, see the Ingres Star User Guide.
cdbname
Overrides the default coordinator database name stored in the Ingres Star catalogs. The default name of the coordinator database is the dbname you specified, prefixed with ii. This is an optional parameter for use with Ingres Star.
-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.
-f product
Specifies user interface products for which you want to create catalogs. Valid product names are ingres, ingres/dbd, vision, windows_4gl, and nofeclients, as described in Standard Flags and Parameters (see page Standard Flags and Parameters). The default is to include all product names.
-llanguage
Specifies the collation sequence for a non-Unicode-enabled database. The sequence must exist in the installation before issuing the createdb command.
A database’s collation sequence determines the order in which data is sorted.
Valid values for language are:
multi
DEC Multinational Character Sequence
spanish
Spanish alphabet’s character sequence
collation_name
A custom collation sequence. For details see the System Administrator Guide.
To view the available collation sequences, examine the contents of the collation file (located in $II_SYSTEM/ingres/files/collation).
If the -l flag is not specified, the collation sequence is determined by the value of II_COLLATION (if this is set). If II_COLLATION is not set, the default collation sequence is assigned to the database. The default is the native sequence of the ASCII or EBCDIC character set, depending on which is present in your computer.
-e
Excludes the database from being Unicode enabled.
-i[collationname]
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.
Collationname specifies the collation rules to be used when using Unicode collation with Unicode data types. Collationname can be one of the following:
udefault
(Default) Sorts results according to collation weights specified in Unicode Version 6.0.0.
udefault5
Sorts results according to collation weights specified in Unicode Version 5.0.
unicode_french
Sorts results according to the French language.
-n[collationname]
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.
Collationname specifies the collation rules to be used when using Unicode collation with Unicode data types. Collationname can be one of the following:
udefault
(Default) Sorts results according to collation weights specified in Unicode Version 6.0.0.
udefault5
Sorts results according to collation weights specified in Unicode Version 5.0.
unicode_french
Sorts results according to the French language.
-p
Creates a private database. Only the DBA and names specified on the accessdb command have access to the database. Do not use this flag with Ingres Star.
-S
Creates an iidbdb. You must be a privileged user to use this flag. Do not use it with Ingres Star.
On VMS, enclose this flag in double quotation marks (“-S”).
-uusername
Specifies the effective user for the session, as described in Standard Flags and Parameters (see page Standard Flags and Parameters).
-Ppassword
Specifies the user password for the database.
-rlocationname
Specifies the new location of the read-only database; typically this will be the CD-ROM drive where the read-only database is located.
-page_size=n
Creates a database with catalogs that have the specified non-default page size.
Limits: Possible values for n are: 2048, 4096, 8192, 16384, and 65536.
Example: createdb dbname –page_size=4096
Note:  The -dmf_cache_size parameter for the DBMS Server should be enabled for the page size specified in this command.
-nosrid
Avoids loading all records (thousands) into the spatial_ref_system catalog. You can use this option if the database will not contain spatial data types.
-m
Indicates that all operations on this database must be logged. Attempts to use SET NOLOGGING on this database will be rejected.