Skip to Content

How to restore an Odoo database from a backup?

June 9, 2026 by

Restoring an Odoo database from a backup is a key skill for every ERP system administrator. Whether you need to recover data after a failure, migrate between servers, or test new features on a copy of the production database, the restore process must be carried out correctly and safely.

Preparing to restore the database

Before you start restoring an Odoo database, make sure you have all the necessary items. First of all, you need a backup file in ZIP format that contains both the PostgreSQL database (a dump.sql file or a dump directory) and the attachment files (filestore).

It is also important to check Odoo version compatibility. The database should be restored on the same or a newer Odoo version than the one the backup was created from. If you are planning a system upgrade, read our guide on how to upgrade Odoo to a newer version.

System requirements

Before you start restoring, make sure that:

  • You have administrator access to the Odoo instance
  • You know the database master password
  • You have enough disk space (at least 2-3x the size of the backup)
  • You have access to the PostgreSQL server with the appropriate permissions
  • The backup file is complete and not corrupted
  • The PostgreSQL version is compatible (PostgreSQL 12 or newer is recommended for Odoo 16+)

Method 1: Restoring via the web interface

The easiest way to restore an Odoo database from a backup is to use the built-in web interface. This method is intuitive and does not require knowledge of the command line.

Important note: Starting with Odoo 16, the database manager is disabled by default for security reasons. To access the database restore interface, you must enable the list_db = True parameter in the odoo.conf configuration file. In a production environment, it is recommended to disable this parameter once the operation is complete.

Step by step via the web interface

To restore an Odoo database from a backup via the web interface, follow these steps:

1. Enabling access to the database manager
Edit the odoo.conf file and add or change the parameter:

[options]
list_db = True

Then restart the Odoo service:

sudo systemctl restart odoo

2. Accessing the database manager
In your web browser, go to: http://your-domain:8069/web/database/manager. If you have changed the default Odoo port, see our guide on how to change the Odoo port.

3. Choosing the restore option
In the database manager, find and click the "Restore Database" button. The system will ask you for the master password.

4. Filling in the form
In the restore form, you need to provide:

  • Master Password - the master password for managing databases (set in odoo.conf as admin_passwd)
  • ZIP file - select the backup file from your disk (the maximum size depends on the server configuration)
  • Database Name - specify a name for the restored database (it can differ from the original)

5. Starting the process
After filling in all the fields, click "Continue". The restore process can take anywhere from a few seconds to several minutes, depending on the size of the database. The interface may display a processing message - do not close the browser window during this time.

6. Verification
Once the process is complete, the system will automatically redirect you to the login screen of the restored database. Log in using the credentials from the original database.

7. Disabling access to the manager (recommended)
Once the operation is complete, for security reasons, set the following in odoo.conf:

list_db = False

And restart the Odoo service again.

Method 2: Restoring via the command line

For more advanced users and system administrators, restoring an Odoo database via the command line offers greater control and the ability to automate the process.

Restoring from a ZIP file

If you have a ZIP backup file, follow these steps:

1. Extracting the archive
First, extract the ZIP file:

unzip backup_name.zip -d /tmp/odoo_restore

2. Checking the contents
Check the structure of the extracted backup:

ls -la /tmp/odoo_restore/

You should see a dump.sql file (or a dump/ directory) and a filestore/ directory.

3. Restoring the PostgreSQL database
Create a new database and restore the dump. If you have a dump.sql file (plain format):

sudo -u postgres createdb new_database_name
sudo -u postgres psql new_database_name < /tmp/odoo_restore/dump.sql

If the dump is in custom format (binary file):

sudo -u postgres createdb new_database_name
sudo -u postgres pg_restore -d new_database_name /tmp/odoo_restore/dump.sql

If you have a dump/ directory (directory format):

sudo -u postgres createdb new_database_name
sudo -u postgres pg_restore -d new_database_name -j 4 /tmp/odoo_restore/dump/

The -j 4 parameter uses 4 parallel processes, which speeds up the restoration of large databases.

4. Restoring the filestore
Copy the files to the appropriate Odoo filestore directory. The path may differ depending on the installation:

# For a standard package installation
sudo mkdir -p /var/lib/odoo/.local/share/Odoo/filestore/
sudo cp -r /tmp/odoo_restore/filestore /var/lib/odoo/.local/share/Odoo/filestore/new_database_name

# Or for an installation in the odoo user's directory
sudo mkdir -p /opt/odoo/.local/share/Odoo/filestore/
sudo cp -r /tmp/odoo_restore/filestore /opt/odoo/.local/share/Odoo/filestore/new_database_name

5. Setting permissions
Make sure the files have the appropriate permissions:

# For /var/lib/odoo
sudo chown -R odoo:odoo /var/lib/odoo/.local/share/Odoo/filestore/new_database_name
sudo chmod -R 755 /var/lib/odoo/.local/share/Odoo/filestore/new_database_name

# Or for /opt/odoo
sudo chown -R odoo:odoo /opt/odoo/.local/share/Odoo/filestore/new_database_name
sudo chmod -R 755 /opt/odoo/.local/share/Odoo/filestore/new_database_name

6. Granting permissions to the Odoo user in PostgreSQL
Make sure the Odoo user has access to the new database:

sudo -u postgres psql
GRANT ALL PRIVILEGES ON DATABASE new_database_name TO odoo;
\q

Restoring from a plain PostgreSQL dump

If you only have a PostgreSQL dump without the filestore, the process is simpler:

sudo -u postgres createdb new_odoo_database
sudo -u postgres psql new_odoo_database < backup_database.sql

Note: Without the filestore, you will not have access to attachments, product images and other files. Make sure you also have a copy of the filestore directory.

Try Odoo for free

Restoring a database on a different server

Restoring an Odoo database on a different server requires a few additional steps. This is a common scenario during migrations or when setting up a test environment.

If you are planning a comprehensive migration of the entire system, we recommend reading our detailed guide: How to move Odoo to another server.

Configuration after restoring

After restoring the database on a new server, you may need to adjust the configuration:

  • Updating system parameters - change the parameters in Settings → Technical → System Parameters, especially web.base.url to the new server address
  • Modifying the configuration file - adjust odoo.conf to the new environment - you will find the details in our article on how to configure the odoo.conf file
  • Verifying paths - check the paths to the addons, data_dir and logfile directories
  • Reconfiguring SSL certificates if you use HTTPS
  • Neutralizing the test database - if you are restoring a production database to a test environment, disable scheduled actions and mail servers to avoid sending real emails

Neutralizing the database after restoring (test environment)

If you are restoring a production database for testing purposes, take the following safety steps:

1. Disabling scheduled actions:

sudo -u postgres psql new_database_name
UPDATE ir_cron SET active = false;
\q

2. Disabling outgoing mail servers:

sudo -u postgres psql new_database_name
UPDATE ir_mail_server SET active = false;
\q

3. Disabling incoming mail servers:

sudo -u postgres psql new_database_name
UPDATE fetchmail_server SET active = false;
\q

These steps will prevent emails from being accidentally sent from the test environment to real customers or business partners.

Updating modules after restoring

After restoring the database, especially on a different server or a newer Odoo version, it is recommended to update all modules:

# Stop the Odoo service
sudo systemctl stop odoo

# Update all modules
sudo -u odoo /opt/odoo/odoo-bin -c /etc/odoo/odoo.conf -d new_database_name -u all --stop-after-init

# Start the service again
sudo systemctl start odoo

This process may take a few minutes and ensures that all modules are synchronized with the current Odoo code.

The most common problems and their solutions

Master password problem

If you do not know the master password, you must reset it in the Odoo configuration file. Edit the odoo.conf file and change or add the parameter:

[options]
admin_passwd = new_secure_password

Then restart the Odoo service:

sudo systemctl restart odoo

Note: This password should be long and complex. Do not use simple passwords in a production environment.

Version-related errors

Attempting to restore a database from a newer Odoo version onto an older one will always fail. Always restore the database on the same or a newer version of the system. If the database structure does not match the Odoo version, you will see errors such as "column does not exist" or "relation does not exist".

PostgreSQL permission problems

Make sure the Odoo user has the appropriate permissions in PostgreSQL:

sudo -u postgres psql
ALTER USER odoo WITH CREATEDB;
GRANT ALL PRIVILEGES ON DATABASE new_database_name TO odoo;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO odoo;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO odoo;
\q

Insufficient disk space

Before restoring, check the available disk space. Restoring requires at least 2-3x the size of the backup file (for extraction, import and temporary PostgreSQL operations).

df -h

If you are short on space, you can restore directly from the archive or use a different temporary directory.

Error: "Database restore error: Command not found"

This error can occur when the PostgreSQL tools are not available in the PATH. Make sure PostgreSQL is installed:

sudo apt-get install postgresql-client

Error: "FATAL: Peer authentication failed"

A problem with the PostgreSQL authentication method. Edit the pg_hba.conf file:

sudo nano /etc/postgresql/14/main/pg_hba.conf

Change the "peer" method to "md5" for local connections and restart PostgreSQL:

sudo systemctl restart postgresql

Contact us

Security best practices

When restoring an Odoo database from a backup, keep a few security considerations in mind:

  • Create backups regularly - read our guide: How to back up an Odoo database
  • Test your backups - regularly (at least once a month) check that your backups can be restored
  • Store them securely - keep backups in a safe location, preferably off-site or in the cloud
  • Encryption - consider encrypting backups that contain sensitive data (GPG, password-protected 7zip)
  • Documentation - keep a log of the restore operations performed, with dates and database names
  • Access control - restrict access to the database manager (list_db = False in production)
  • Integrity verification - check the checksums of the backup files before restoring

Try Odoo for free

Verification after restoring

After successfully restoring the Odoo database, perform the following checks:

  1. Login test - log in to the administrator account and make sure that logging in works correctly
  2. Checking modules - go to Apps and make sure that all key modules are installed and active
  3. Data verification - check key records: customers, products, sales orders, invoices
  4. Functionality test - test basic operations: creating a quotation, an invoice, a delivery
  5. Checking attachments - open several documents with attachments and make sure the files are available
  6. System logs - review the Odoo logs for errors:
    sudo tail -f /var/log/odoo/odoo.log
  7. Performance tests - check that the system runs smoothly and has no performance problems
  8. Verifying the URL and parameters - check Settings → Technical → System Parameters → web.base.url

Automating the restore process

For production environments, it is worth considering automating the restore process, especially for testing purposes or for creating development environments.

You can create a bash script that automates the entire process:

#!/bin/bash

# Automatic Odoo database restore script
# Usage: ./restore_odoo.sh backup_file.zip new_database_name

set -e  # Stop the script at the first error

BACKUP_FILE=$1
NEW_DB_NAME=$2
TEMP_DIR="/tmp/restore_temp_$$"
ODOO_USER="odoo"
FILESTORE_PATH="/var/lib/odoo/.local/share/Odoo/filestore"

# Parameter validation
if [ -z "$BACKUP_FILE" ] || [ -z "$NEW_DB_NAME" ]; then
    echo "Usage: $0  "
    exit 1
fi

if [ ! -f "$BACKUP_FILE" ]; then
    echo "Error: Backup file does not exist: $BACKUP_FILE"
    exit 1
fi

echo "[1/6] Extracting backup..."
mkdir -p $TEMP_DIR
unzip -q $BACKUP_FILE -d $TEMP_DIR

echo "[2/6] Creating database..."
sudo -u postgres createdb $NEW_DB_NAME || {
    echo "Error: Cannot create the database. It may already exist."
    rm -rf $TEMP_DIR
    exit 1
}

echo "[3/6] Restoring data..."
if [ -f "$TEMP_DIR/dump.sql" ]; then
    # Plain SQL format
    sudo -u postgres psql $NEW_DB_NAME < $TEMP_DIR/dump.sql
elif [ -d "$TEMP_DIR/dump" ]; then
    # Directory format
    sudo -u postgres pg_restore -d $NEW_DB_NAME -j 4 $TEMP_DIR/dump/
else
    echo "Error: Neither a dump.sql file nor a dump/ directory was found"
    sudo -u postgres dropdb $NEW_DB_NAME
    rm -rf $TEMP_DIR
    exit 1
fi

echo "[4/6] Restoring filestore..."
if [ -d "$TEMP_DIR/filestore" ]; then
    sudo mkdir -p $FILESTORE_PATH/$NEW_DB_NAME
    sudo cp -r $TEMP_DIR/filestore/* $FILESTORE_PATH/$NEW_DB_NAME/
    sudo chown -R $ODOO_USER:$ODOO_USER $FILESTORE_PATH/$NEW_DB_NAME
    sudo chmod -R 755 $FILESTORE_PATH/$NEW_DB_NAME
else
    echo "Warning: No filestore directory found in the backup"
fi

echo "[5/6] Granting permissions..."
sudo -u postgres psql << EOF
GRANT ALL PRIVILEGES ON DATABASE $NEW_DB_NAME TO $ODOO_USER;
EOF

echo "[6/6] Cleaning up temporary files..."
rm -rf $TEMP_DIR

echo ""
echo "✓ Database $NEW_DB_NAME was restored successfully!"
echo "You can now log in using the original credentials."
echo ""
echo "NOTE: If this is a test environment, consider neutralizing the database:"
echo "  - Disable scheduled actions (ir_cron)"
echo "  - Disable mail servers (ir_mail_server, fetchmail_server)"
echo "  - Change web.base.url in the system parameters"

Save the script as restore_odoo.sh and make it executable:

chmod +x restore_odoo.sh

And use it as follows:

./restore_odoo.sh /path/to/backup.zip test_database_01

FAQ - Frequently asked questions

Can I restore an Odoo database from a backup onto a newer version of the system?

Yes, you can restore the database onto a newer Odoo version, but after restoring you will need to update the modules. The process is as follows: first restore the database on the new Odoo version, then run an update of all modules with the command odoo-bin -d database_name -u all --stop-after-init. Never restore a database from a newer version onto an older one - this will cause incompatibility of the database structure. For migrations between major versions (e.g. from Odoo 15 to 16), we recommend using the official migration tools or professional services.

How long does the Odoo database restore process take?

The restore time depends on the size of the database, the server performance and the method used. Small databases (up to 1 GB) are usually restored in 2-5 minutes, medium databases (1-5 GB) in 10-20 minutes, while large production databases (over 10 GB) may take from 30 minutes to several hours. The process via the web interface can be slower than restoring via the command line, especially for large databases. Using the pg_restore -j 4 option (4 parallel processes) can significantly speed up the import into PostgreSQL.

What should I do if I cannot log in after restoring the Odoo database?

If you cannot log in after restoring the database, first check the Odoo logs (tail -f /var/log/odoo/odoo.log) for errors. The most common causes are: (1) a mismatch between the Odoo version and the database version, (2) a missing or incorrectly configured filestore, (3) permission problems with the filestore files, (4) an incorrect configuration in the odoo.conf file, (5) PostgreSQL errors during the import. You can also try resetting the admin user's password directly in the PostgreSQL database or via the command line: odoo-bin -d database_name -c /etc/odoo/odoo.conf --db-filter=database_name and then use the "Reset Password" option in the interface. Also check that the modules are correctly installed and updated.

Can I restore only part of a database (e.g. specific modules)?

Restoring only part of an Odoo database is not directly supported by the standard backup tools. The Odoo database is tightly interlinked - the tables of different modules have relationships with each other. However, you can export specific data using the data export function in the Odoo interface (Settings → Technical → Database Structure → Export) or use the Studio module to migrate specific configurations. For more complex scenarios, we recommend using ETL tools or writing a dedicated Python script that uses the Odoo ORM.

How do I restore a database if I do not have access to the web interface?

If the web interface is not available (e.g. list_db = False in the configuration or web server problems), you can always restore the database via the command line. This is even the recommended method for large databases and production environments, as it offers greater control and better performance. Use the method described in the section "Method 2: Restoring via the command line". You need SSH access to the server and sudo privileges or access to the postgres user.

Summary

Restoring an Odoo database from a backup is a key process that every administrator should master. Whether you use the convenient web interface (remembering that list_db must be enabled in newer versions) or prefer full control via the command line, the most important thing is careful preparation and following security procedures.

Key points to remember:

  • Always check version compatibility before restoring
  • Make sure you have enough disk space (2-3x the size of the backup)
  • Restore both the database and the filestore
  • After restoring, update the modules with the -u all command
  • In a test environment, neutralize the database (disable cron and mail servers)
  • Test your regular backups to make sure they can be restored

Remember that regularly testing the restore process is just as important as creating backups. Only then can you be sure that, in the event of a failure, you will be able to quickly get the system running again.

Need help with Odoo?

Restoring a database, migrating between servers or complex Odoo system configurations can be challenging. KK Innovations is a team of experienced Odoo specialists who will help you with every aspect of implementing and administering your ERP system.

We offer comprehensive services: from installation and configuration, through backups and disaster recovery procedures, to the development of custom modules. Contact us today to find out how we can improve your work with Odoo!

Contact us