Create a Database (dbCreate)

The dbCreate command creates a database in the grid according to the specified database definition.

ttGridAdmin dbCreate name 
                     [-instance hostname[.instancename]]
                     [-nowait | -wait [timeout]]

Options

The dbCreate command has the options:

Option Description

name

Name of the database definition to use in creating the database. This becomes the name of the database.

-instance hostname[.instancename]

If specified, database element(s) will be created only on the specified instance(s), instead of on all instances of the grid. Any element previously created successfully on any of the specified instances must first be destroyed.

This is typically used to recover after a failure in the grid or after database elements were not successfully created on one or more instances in a previous run of dbCreate.

The hostname is required. The instancename is required only if there is more than one instance on the host. (See Grid Objects and Object Naming.)

You can use this option only once, specifying a single instance, in a single command.

-nowait | -wait [timeout]

The command initiates a state change that is recorded in the active management instance of the grid.

The -nowait option causes the command to return immediately without waiting for the state change. This is the default behavior.

The -wait option causes the command to wait for the state change to complete, when the database element has been created on each instance in the grid. You can optionally subject the wait to a limit of timeout seconds. Otherwise, or if timeout is set to 0, there is no limit.

In a large grid, it is not typical or generally advisable to use -wait. If you do, it is advisable to set a timeout. (See Database Management Operations.)

Examples

This example creates a database without waiting for the elements to be created on all instances, then checks the status, first while database creation is still in progress, then after it is complete.

% ttGridAdmin dbCreate database1
Database database1 creation started
...
% ttGridAdmin dbStatus database1
Database database1 summary status as of Mon Nov 13 18:38:39 PST 2017
 
creating,loading-partial,closed
Completely created elements: 1 (of 4) (3 in progress)
Completely loaded elements: 1 (of 4) (3 in progress)
Completely created replica sets: 0 (of 0)
Completely loaded replica sets: 0 (of 0)
 
Open elements: 0 (of 4)
...
% ttGridAdmin dbStatus database1
Database database1 summary status as of Mon Nov 13 18:39:16 PST 2017
 
created,loaded,closed
Completely created elements: 4 (of 4)
Completely loaded elements: 4 (of 4)
Completely created replica sets: 0 (of 0)
Completely loaded replica sets: 0 (of 0)
 
Open elements: 0 (of 4)

In the following example, element creation on one instance fails. The example tries again to create the element on that instance after the problem is resolved.

% ttGridAdmin dbCreate database1
Database database1 creation started
...
% ttGridAdmin dbStatus database1 -all
Database database1 summary status as of Sat Nov 11 14:23:05 PST 2017
 
created-partial,loaded,closed
Completely created elements: 3 (of 4)(1 failed)
Completely loaded elements: 3 (of 4)
Completely created replica sets: 0 (of 0)
Completely loaded replica sets: 0 (of 0)

Open elements: 0 (of 4)

Database database1 element level status as of Sat Nov 11 14:23:05 PST 2017
 
Host       Instance  Elem Status Date/Time of Event  Message 
---------- --------- ---- ------ ------------------- ------- 
mysys3host griddata1    1 loaded 2017-11-11 14:22:52         
mysys4host griddata2    2 loaded 2017-11-11 14:22:51         
mysys5host griddata3    3 failed 2017-11-11 14:22:52         
mysys6host griddata4    4 loaded 2017-11-11 14:22:53         
 
Database database1 Replica Set status as of Sat Nov 11 14:23:05 PST 2017
 
RS DS Elem Host Instance Status Date/Time of Event Message 
-- -- ---- ---- -------- ------ ------------------ ------- 
 
Database database1 Data Space Group status as of Sat Nov 11 14:23:05 PST 2017
 
DS RS Elem Host Instance Status Date/Time of Event Message 
-- -- ---- ---- -------- ------ ------------------ ------- 

(Resolve the problem with mysys5host.griddata3.)

% ttGridAdmin dbCreate database1 -instance mysys5host.griddata3
Database database1 creation started
...
% ttGridAdmin dbStatus database1
Database database1 summary status as of Mon Nov 13 13:44:12 PST 2017
 
created,loaded,closed
Completely created elements: 4 (of 4)
Completely loaded elements: 4 (of 4)
Completely created replica sets: 0 (of 0)
Completely loaded replica sets: 0 (of 0)
 
Open elements: 0 (of 4)

Notes

  • Each instance creates its element of the database, loads the element into memory, and records the state of the element.

  • If you run dbCreate asynchronously (without waiting), you can use the dbStatus command to see when the database is created.

  • The database is marked as "existing" as soon as the dbCreate command returns. If you run the command in the default -nowait mode, you can unload the database while its creation is still in progress.

  • The database is not available for connections from users other than the instance administrator until you define the database distribution map with dbDistribute and open the database with dbOpen.

  • A typical use case for the -instance option is when an element of the database had previously failed, been evicted or removed from the database distribution map, and been destroyed. (Then also use dbDistribute to add the element to the distribution map.)