Skip to Content

How to Delete an Odoo Database: Step-by-Step Guide

November 6, 2026 by

A test database, a failed migration, or an environment you no longer need. Sooner or later, every administrator has to decide how to delete a database in Odoo. The operation is technically simple, but irreversible, so it is worth doing deliberately and following a proven procedure. In this guide, we cover all the methods: from the Database Manager, through the Odoo command line and PostgreSQL, to Odoo.sh and Odoo Online.

If you are just getting started with the system, test it first on your own safe database. You can create one for free in a few minutes.

Try Odoo for free

Before you delete an Odoo database: a checklist

Deleting a database erases all data: contacts, invoices, products, stock levels, settings, and users. Before you begin, check a few things:

  • Is it definitely the right database? Several databases often run on a single server (production, test, a copy made before an upgrade). Double-check the name.
  • Do you have a current backup? Even if the database seems unnecessary, make a copy together with the files (filestore). The simplest way is to use the Backup button in the Database Manager (the zip archive contains the database and the filestore), or to run pg_dump and copy the filestore directory separately. We described how to automate this process in the article how to configure automatic backups in Odoo.
  • Do you know the master password? This is the admin_passwd parameter in the odoo.conf configuration file. If it was set in the Database Manager, it is stored as a hash and cannot be read, only replaced with a new one. Do not confuse it with the password of the admin user inside the system itself. If you have lost the latter, this guide will help: how to reset the Odoo administrator password.
  • Is anyone working in the system? Active users will lose access, and open connections from other processes (e.g., workers or external integrations) can make it harder to delete the database.

Method 1: deleting a database in the Database Manager

This is the simplest way for on-premise installations, i.e., on your own server or in a private cloud. We describe how this tool works in detail in the article Odoo Database Manager: how it works and how to secure it.

Step by step

  1. Open https://twoja-domena/web/database/manager in your browser (locally: http://localhost:8069/web/database/manager).
  2. Find the tile of the database you want to delete.
  3. Click the Delete button.
  4. Enter the master password and confirm the operation.

After a moment, the database will disappear from the list. Odoo then removes both the PostgreSQL database and the filestore directory associated with it.

What to do if you cannot see the Database Manager?

In production environments, the Database Manager is often disabled on purpose. This is controlled by the list_db = False parameter in the odoo.conf configuration file. This is a good security practice, so we do not recommend enabling it permanently. If you need to delete a database, you can temporarily change the setting, restart the service, perform the operation, and immediately restore the previous configuration. You can also use the methods described below, which do not require the web interface.

Method 2: deleting a database from the Odoo command line

In Odoo 17 and later (including the latest version), the odoo-bin db command is available with the following subcommands: init, dump, load, duplicate, rename, and drop. It allows you to delete a database without using a browser:

./odoo-bin db drop nazwa_bazy

Run the command on the Odoo server, as a system user with access to PostgreSQL, with the correct database connection configuration (e.g., using the -c parameter pointing to the odoo.conf file). Like the Database Manager, it also removes the filestore directory. Keep in mind that this command does not exist in older versions; in that case, use Method 1 or 3.

Method 3: how to delete an Odoo database from PostgreSQL

Odoo stores its data in PostgreSQL, so you can delete the database directly on the server. This method is useful when the Database Manager is disabled or the web interface is not working.

Stop the Odoo service

To avoid active connections, first stop Odoo (the service name depends on the installation, e.g., odoo or odoo-server; in Docker, stop the application container):

sudo systemctl stop odoo

Delete the database with the dropdb command

Then run the following command as the postgres user:

sudo -u postgres dropdb nazwa_bazy

If you get an error saying that the database is being used by other sessions, in PostgreSQL 13 and later you can force the deletion:

sudo -u postgres dropdb --force nazwa_bazy

You can also close the connections manually in the psql console:

SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'nazwa_bazy';

After closing the connections, run the dropdb command again.

Delete the filestore directory

Deleting a database in PostgreSQL does not delete the attachments stored on disk. You will usually find the filestore directory in the path defined by the data_dir parameter, e.g., ~/.local/share/Odoo/filestore/nazwa_bazy or /var/lib/odoo/filestore/nazwa_bazy. Delete it manually to free up disk space and avoid leaving company data uncontrolled.

sudo rm -rf /var/lib/odoo/filestore/nazwa_bazy

Be careful: a mistake in the directory name can delete the data of another database. Finally, restart the service with the command sudo systemctl start odoo.

Working directly on a production server requires experience and certainty about which resources you are deleting, so if in doubt, it is worth turning to specialists for help.

Contact us

Deleting a database in Odoo.sh and Odoo Online

In environments managed by Odoo, the procedure is different because you have no direct access to PostgreSQL or the server's file system.

Odoo Online

Log in to your account on odoo.com, go to the database management section (My Databases), select the right database, and use the delete option (Delete). Before you do, download a backup (Download), because once you confirm, there is no way to restore the database on your own.

Odoo.sh

In Odoo.sh, the database is tied to a branch and a build. Deleting a development or staging branch removes the environment associated with it. A production branch cannot be deleted this way, and if needed you have to contact Odoo support. Before deleting, download a backup from the Backups tab. You can find more about this platform in the article how to install Odoo.sh step by step.

If you want to see how the latest Odoo works before deciding on an implementation or migration, create a free test database.

Try Odoo for free

The most common problems when deleting a database

  • The "database is being accessed by other users" error: stop Odoo or close the connections in PostgreSQL (or use dropdb --force), as described above.
  • Wrong master password: the admin_passwd value in odoo.conf may be hashed and cannot be read. Set a new password in the file and restart the service.
  • Insufficient permissions: the database user must be the owner of the database or have the superuser role.
  • Odoo does not start after the database is deleted: check whether the db_name or dbfilter parameters in odoo.conf point to the deleted database.
  • Leftovers from the database: check the filestore, cron jobs, the proxy configuration, and entries in monitoring tools.

Removing redundant databases will also improve server performance. You can find more tips in the article how to optimize Odoo performance.

Security best practices

To avoid accidental data loss, follow a few rules: disable the Database Manager in production, set a strong master password, make regular backups, and test restoring them. It is also a good idea to separate environments (production, test, development) and name them clearly, e.g., firma_prod and firma_test. This makes it easier to avoid mistakes when deleting.

FAQ: frequently asked questions

Can a deleted Odoo database be recovered?

Only from a backup. Deletion itself is irreversible, so always make a backup (including the filestore) before you start the operation.

Does deleting a database also delete attachments?

In the Database Manager and with the odoo-bin db drop command, Odoo also deletes the filestore. If you use the dropdb command in PostgreSQL, you have to delete the attachments directory manually.

How do I delete a database if I don't remember the master password?

A master password stored as a hash cannot be read, but you can enter a new admin_passwd parameter in the odoo.conf file and restart Odoo. You can also delete the database directly in PostgreSQL with the dropdb command if you have access to the server.

Need help with Odoo databases?

Managing databases, backups, and environments is an area where a mistake can be costly. The KK Innovations team will help you safely tidy up your Odoo environment, configure backups, and secure your system. Contact us and discuss your needs.

Contact us