---
title: "Operations: Server: How to delete a database?"
url: "https://docs.ravendb.net/6.2/client-api/operations/server-wide/delete-database"
version: "6.2"
language: "csharp"
---

# Operations: Server: How to delete a database?

> Client language: C#. Also available for [Java](https://docs.ravendb.net/6.2/client-api/operations/server-wide/delete-database.java.md).
>
> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

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

## Syntax

```csharp
public DeleteDatabasesOperation(
  string databaseName,
  bool hardDelete,
  string fromNode = null,
  TimeSpan? timeToWaitForConfirmation = null)
{
}

public DeleteDatabasesOperation(DeleteDatabasesOperation.Parameters parameters)
{
}

public class Parameters
{
  public string[] DatabaseNames { get; set; }

  public bool HardDelete { get; set; }

  public string[] FromNodes { get; set; }

  public TimeSpan? TimeToWaitForConfirmation { get; set; }
}
```

| Parameters | | |
| - | - | - |
| **DatabaseName** | string | Name of a database to delete |
| **HardDelete** | bool | 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** | TimeSpan | Time to wait for confirmation. Default: `null` will user server default (15 seconds) |

## Example I

### Sync

```csharp
var parameters = new DeleteDatabasesOperation.Parameters
{
  DatabaseNames = new[] { "MyNewDatabase", "OtherDatabaseToDelete" },
  HardDelete = true,
  FromNodes = new[] { "A", "C" },     // optional
  TimeToWaitForConfirmation = TimeSpan.FromSeconds(30)    // optional
};
store.Maintenance.Server.Send(new DeleteDatabasesOperation(parameters));
```

### Async

```csharp
var parameters = new DeleteDatabasesOperation.Parameters
{
  DatabaseNames = new[] { "MyNewDatabase", "OtherDatabaseToDelete" },
  HardDelete = true,
  FromNodes = new[] { "A", "C" },   // optional
  TimeToWaitForConfirmation = TimeSpan.FromSeconds(30)    // optional
};
await store.Maintenance.Server.SendAsync(new DeleteDatabasesOperation(parameters));
```

## Example II

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

### Sync

```csharp
store.Maintenance.Server.Send(new DeleteDatabasesOperation("MyNewDatabase", hardDelete: true, fromNode: null, timeToWaitForConfirmation: null));
```

### Async

```csharp
await store.Maintenance.Server.SendAsync(new DeleteDatabasesOperation("MyNewDatabase", hardDelete: true, fromNode: null, timeToWaitForConfirmation: null));
```
