When something goes wrong with your Odoo installation — a failed upgrade, accidental data deletion, or a corrupted database — a working backup is only half the battle. You need to know exactly how to restore it. This guide covers every method, so you can be back online in minutes.
Understanding Odoo Backup Anatomy
A complete Odoo backup consists of two parts:
- The PostgreSQL database dump — contains all your business data: customers, invoices, products, configuration.
- The filestore — binary attachments stored on disk at
/var/lib/odoo/.local/share/Odoo/filestore/<dbname>/(or your configured data directory).
Restoring only the database without the filestore will result in broken attachments, missing images, and PDF report errors. Always restore both.
Method 1: pg_restore (Custom Format — Recommended)
If your backup was created with pg_dump -Fc (custom format), use pg_restore. This is the fastest and most flexible method.
Step 1: Stop Odoo
sudo systemctl stop odoo
# or for Docker:
docker compose stop odoo
Step 2: Drop and recreate the database
sudo -u postgres psql -c "DROP DATABASE IF EXISTS mydb;"
sudo -u postgres psql -c "CREATE DATABASE mydb OWNER odoo;"
Step 3: Restore the dump
sudo -u postgres pg_restore \
--no-owner \
--role=odoo \
-d mydb \
/path/to/backup.dump
The --no-owner flag prevents permission errors when the dump owner differs from your local Odoo user. Add -j 4 to parallelize the restore across 4 cores on large databases.
Method 2: Plain SQL Restore
If your backup is a .sql file (created with pg_dump without -Fc):
sudo -u postgres psql -c "DROP DATABASE IF EXISTS mydb;"
sudo -u postgres psql -c "CREATE DATABASE mydb OWNER odoo;"
sudo -u postgres psql mydb < /path/to/backup.sql
Plain SQL restores are slower on large databases because they cannot be parallelized. For databases over 1 GB, convert to custom format first:
pg_dump -Fc mydb > mydb_custom.dump
Method 3: Restoring the Filestore
After the database is restored, replace the filestore directory:
# Remove old filestore
sudo rm -rf /var/lib/odoo/.local/share/Odoo/filestore/mydb
# Extract backup archive (if your filestore was tarred)
sudo tar -xzf /path/to/filestore_backup.tar.gz \
-C /var/lib/odoo/.local/share/Odoo/filestore/
# Fix permissions
sudo chown -R odoo:odoo /var/lib/odoo/.local/share/Odoo/filestore/mydb
If you use Docker, the filestore path is typically a named volume. Check with docker volume inspect and copy files directly into the mount point.
Method 4: Odoo Database Manager UI
Odoo ships with a built-in database manager at https://your-domain.com/web/database/manager. This is the easiest method for non-technical users.
- Navigate to
/web/database/manager - Click Restore Database
- Upload the
.zipbackup file (Odoo's own format, which bundles the dump and filestore together) - Enter a database name and the master password
- Click Continue
Note: The database manager should be disabled in production environments after setup. If you've followed Odoo security best practices, you'll need to re-enable it temporarily or use the command-line methods above.
Step 5: Post-Restore Checks
- Start Odoo and verify login works
- Check
Settings > Technical > System Parameters— confirmweb.base.urlmatches your current domain - Test a few attachments to confirm the filestore is intact
- Run a test invoice PDF to verify report rendering
- Check the Odoo log for errors:
tail -f /var/log/odoo/odoo.log
How DeployMonkey Handles Backups and Restores
DeployMonkey automates the entire backup and restore lifecycle for your Odoo instance. Every instance gets scheduled S3-compatible backups with configurable retention, and you can trigger a restore from the control panel in one click — no terminal required. Backups include both the PostgreSQL dump and the filestore, bundled and encrypted before upload.
Ready to stop worrying about manual backup scripts? Start your free DeployMonkey account and get automated backups from day one.
Frequently Asked Questions
What is the difference between pg_restore and psql for restoring Odoo?
pg_restore is used for custom-format dumps (-Fc) and supports parallel restore with -j. psql is used for plain SQL (.sql) files and executes statements sequentially. For production Odoo databases over a few hundred MB, custom format with pg_restore -j is significantly faster.
Do I need to stop Odoo before restoring?
Yes. Always stop Odoo before dropping or restoring a database. Active connections will block the DROP DATABASE command and can cause partial restores or data corruption.
Can I restore an Odoo 16 backup to Odoo 17?
No — not directly. A raw database restore only works between the same Odoo version. To upgrade versions, restore to the source version first, then run the official Odoo migration scripts or use a migration service.
What if pg_restore reports errors about missing roles?
Use the --no-owner and --no-privileges flags with pg_restore. Then manually grant ownership: ALTER DATABASE mydb OWNER TO odoo; and reassign schema ownership if needed.
How do I verify the restore was successful?
Log in to Odoo and check a recent record (e.g., a sales order or invoice). Verify its attachments open correctly. Run a scheduled action or check the cron log to confirm background jobs are running normally.