---
title: "The CLI dbcleanup command"
slug: "the-cli-dbcleanup-command"
abstract: "Reference for the Sitecore CLI dbcleanup command."
---
# The CLI dbcleanup command

The Sitecore CLI Database Cleanup plugin performs database cleanup according to the provided tasks.

> [!warning]
> This command triggers a full cache cleanup, and it can cause performance degradation. It should be executed during a maintenance window.

<details>
<summary><h2>Usage</h2></summary>

The `dbcleanup` command requires elevated permissions.

You can use the `dbcleanup` command as follows:

```text
sitecore dbcleanup [options]

```

</details>

<details>
<summary><h2>Options</h2></summary>

The `dbcleanup` command has the following options:

| Option | Description |
| --- | --- |
| `–db <list-of-databases>`<br><br>`--database <list-of-databases>` | Comma-separated list of databases targeted for cleanup tasks. |
| `–cf`, `--clean-fields` | Clean up fields. Deletes data from shared, unversioned, and versioned fields that have no related items. |
| `–cof`, `--clean-orphanfields` | Clean up orphaned fields. Cleans the field data from the orphans removed in items with no parent. |
| `–cb`, `--clean-blobs` | Clean up blobs. Deletes blob fields that have no related field. |
| `–c`, `--config` | Path to root sitecore.config directory.<br><br>Default: current working directory. |
| `–n`, `--environment-name` | Named Sitecore environment to use.<br><br>Default: "default". |
| `–v`, `--verbose` | Write some additional diagnostic and performance data. |
| `–t`, `--trace` | Write more additional diagnostic and performance data. |
| `–?`, `-h`, `--help` | Display developer help and usage information about the command. |

</details>

<details>
<summary><h2>Examples</h2></summary>

The following are examples of using the `dbcleanup` subcommand:

- Command: Result
- `sitecore dbcleanup`: Performed all cleanup tasks on all databases.

```

[Task][core] clean-fields completed
[Task][core] clean-blobs completed
[Task][core] clean-orphanfields completed
[Task][web] clean-fields completed
[Task][web] clean-blobs completed
[Task][web] clean-orphanfields completed
[Task][master] clean-fields completed
[Task][master] clean-blobs completed
[Task][master] clean-orphanfields completed

```

- `sitecore dbcleanup --db web, master --cb`: Performed the clean-blobs task for Web and Master databases.

```

[Task][web] clean-blobs completed
[Task][master] clean-blobs completed

```

</details>