Article For
4.0 4.2 5.0 5.1 5.2

Operations: Server: How to delete a database?

This operation is used to delete databases from a server, with a possibility to remove all the data from hard drive.


public DeleteDatabasesOperation(String databaseName, boolean hardDelete)

public DeleteDatabasesOperation(String databaseName, boolean hardDelete, String fromNode)

public DeleteDatabasesOperation(String databaseName, boolean hardDelete, String fromNode, Duration timeToWaitForConfirmation)

public DeleteDatabasesOperation(Parameters parameters)

public static class Parameters {
    private String[] databaseNames;
    private boolean hardDelete;
    private String[] fromNodes;
    private Duration timeToWaitForConfirmation;

    public String[] getDatabaseNames() {
        return databaseNames;

    public void setDatabaseNames(String[] databaseNames) {
        this.databaseNames = databaseNames;

    public boolean isHardDelete() {
        return hardDelete;

    public void setHardDelete(boolean hardDelete) {
        this.hardDelete = hardDelete;

    public String[] getFromNodes() {
        return fromNodes;

    public void setFromNodes(String[] fromNodes) {
        this.fromNodes = fromNodes;

    public Duration getTimeToWaitForConfirmation() {
        return timeToWaitForConfirmation;

    public void setTimeToWaitForConfirmation(Duration timeToWaitForConfirmation) {
        this.timeToWaitForConfirmation = timeToWaitForConfirmation;
DatabaseName String Name of a database to delete
HardDelete boolean Should all data be removed (data files, indexing files, etc.).
FromNode String Remove the database just from a specific node. Default: null which would delete from all
TimeToWaitForConfirmation Duration Time to wait for confirmation. Default: null will user server default (15 seconds)

Example I

DeleteDatabasesOperation.Parameters parameters = new DeleteDatabasesOperation.Parameters();
parameters.setDatabaseNames(new String[]{ "MyNewDatabase", "OtherDatabaseToDelete" });
parameters.setFromNodes(new String[]{ "A", "C" }); //optional
parameters.setTimeToWaitForConfirmation(Duration.ofSeconds(30)); // optional

    .server().send(new DeleteDatabasesOperation(parameters));

Example II

In order to delete just one database from a server, you can also use this constructor

    new DeleteDatabasesOperation("MyNewDatabase", true, null, null));