Creating a Database

To create a database you must have created at least one archive for the database. For more information, see Creating an Archive.

You may create a database in the durable domain using the create database command:

nuocmd create database --db-name <database name> --dba-user <username> --dba-password <password> --te-server-ids <server ID>

For more information on using NuoDB Command (nuocmd) and other command line tools, see Command Line Tools.

The create database command will create a database that uses the Vectorized Execution Engine (VEE) by default. VEE is the recommended SQL execution engine. If for any reason your database requires the legacy Scalar Execution Engine (SEE), please see additional instructions to create a new database using SEE.

Mandatory Parameters

This section describes parameters that can be provided when using the create database command.

Parameter Description Comments

--db-name DB_NAME

The database name associated with the archive.

For more information, see Creating an Archive.

--dba-user DBA_USER

The database administrator running the command.

-

--dba-password DBA_PASSWORD

The password for the database administrator running the command.

-

--te-server-ids TE_SERVER_IDS [TE_SERVER_IDS …​]

The Transaction Engine(s) (TE) to be started (on each server ID provided).

When starting multiple TEs, separate multiple server IDs using a space character.

--default-options [DEFAULT_OPTIONS [DEFAULT_OPTIONS …​]]

Starts the database with the list of database options provided. These options may be passed as options for the database processes.

Separate options values and options using a space character. Some options can only be set when creating the database. For more information about the available database options, see Database Options.

Example

The following command shows how to create a database named test, supplying credentials for the database administrator user.

$ nuocmd create database --db-name test \
   --dba-user dba --dba-password goalie \
   --te-server-ids nuoadmin-0 --default-options ping-timeout 60 mem 3g
STARTING: StartProcessRequest(archive_id=0, db_name=test, engine_type=SM, labels={}, options={}, server_id=nuoadmin-0)
STARTING: StartProcessRequest(db_name=test, engine_type=TE, labels={}, options={}, server_id=nuoadmin-0)
The create database command documented here defines:
- The database name (test).
- The DBA user account name (dba).
- The DBA user account password (goalie).
- The starting of a TE on the host running NuoDB Admin process (nuoadmin-0).
- Any TE and SM processes started for the database will have ping-timeout set to 60 seconds and memory set to 3 GB by default.
The create database command also implicitly starts an SM on the archive previously created.

Verifying the Database Created

To confirm that your database is up and running and that the SM and TE processes have started, run NuoDB command’s show domain command.

nuocmd show domain
server version: 4.0.6, server license: Enterprise
server time: 2019-10-14T15:04:44.712, client token: f5c160bd10886bbec541707ffc832ab6e847e354
Servers:
  [nuoadmin-0] localhost:48005 [last_ack = 3.89] [member = ADDED] [raft_state = ACTIVE] (LEADER, Leader=nuoadmin-0, log=0/16/16) Connected *
Databases:
  test [state = RUNNING]
    [SM] nuodbits-MacBook-Pro-2.local/localhost:48006 [start_id = 0] [server_id = nuoadmin-0] [pid = 21975] [node_id = 1] [last_ack =  0.45] MONITORED:RUNNING
    [TE] nuodbits-MacBook-Pro-2.local/localhost:48007 [start_id = 1] [server_id = nuoadmin-0] [pid = 21976] [node_id = 2] [last_ack =  7.44] MONITORED:RUNNING