Destroy a Database (dbDestroy)

The dbDestroy command destroys the specified database. All data and schema contained in the database are irretrievably lost.

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

Options

The dbDestroy command has the options:

Option Description

name

Name of the database to destroy.

-instance hostname[.instancename]

If specified, database element(s) will be destroyed only on the specified instance(s), but elements will remain on all other instances of the grid. The elements to destroy must have been previously evicted or removed from the database distribution map or never added to the distribution map.

The hostname is required. The instancename is required only if there is more than one instance on the host.

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 destroyed 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 destroys a database without waiting for the elements to be destroyed on all instances. A subsequent attempt to check status indicates that the database was successfully destroyed.

% ttGridAdmin dbDestroy database1
Database database1 destroy started
...
% ttGridAdmin dbStatus database1
Error 2: Database database1 does not exist

This example destroys two of the four elements in the database. Both elements are from the same replica set and had previously been evicted.

% ttGridAdmin dbDestroy database1 -instance mysys3host.griddata1
Database database1 instance mysys3host.griddata1 destroy started
% ttGridAdmin dbDestroy database1 -instance mysys4host.griddata2 
Database database1 instance mysys4host.griddata2 destroy started
% ttGridAdmin dbStatus database1 -all
Database database1 summary status as of Tue Jan  9 16:04:16 PST 2021
 
created,unloaded,closed
Completely created elements: 2 (of 4)
Completely loaded elements: 0 (of 4)
Completely created replica sets: 1 (of 1)
Completely loaded replica sets: 0 (of 1)
 
Open elements: 0 (of 2)
 
Database database1 element level status as of Tue Jan  9 16:04:16 PST 2021
 
Host       Instance  Elem Status    Date/Time of Event  Message 
---------- --------- ---- --------- ------------------- ------- 
mysys3host griddata1    1 destroyed 2021-01-09 16:04:02         
mysys4host griddata2    2 destroyed 2021-01-09 16:04:01         
mysys5host griddata3    3 unloaded  2021-01-09 16:01:25         
mysys6host griddata4    4 unloaded  2021-01-09 16:01:01         
 
Database database1 Replica Set status as of Tue Jan  9 16:04:16 PST 2021
 
RS DS Elem Host       Instance  Status   Date/Time of Event  Message 
-- -- ---- ---------- --------- -------- ------------------- ------- 
 1  1    3 mysys5host griddata3 unloaded 2021-01-09 16:01:25         
 1  2    4 mysys6host griddata4 unloaded 2021-01-09 16:01:01         
 
Database database1 Data Space Group status as of Tue Jan  9 16:04:16 PST 2021
 
DS RS Elem Host       Instance  Status Date/Time of Event  Message 
-- -- ---- ---------- --------- -------- ------------------- ------- 
 1  1    3 mysys5host griddata3 unloaded 2021-01-09 16:01:25         
 2  1    4 mysys6host griddata4 unloaded 2021-01-09 16:01:01         

Notes

  • The database must be unloaded or unloading.

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

  • A typical use case for the -instance option is after an element of the database failed and was evicted or removed from the database distribution map. Then using dbDestroy with -instance recovers the disk space of the failed element.