Question About Servers

How to Restore a Database Backup in Odoo Print

  • 1

In this guide, we will cover the steps required for restoring the Odoo database backup file into a new database.


Decompress the Snapshot

The database backup file will probably be compressed to save disk space, so you need to decompress it first. 


Here's how to decompress the .tar.gz file:

tar -xzf psql_backup.tar.gz 


Here's how to decompress the .gz file:

gzip psql_backup.gz


Note: change the psql_backup to the actual name of the compressed backup file.


Create the Database in PostgreSQL

Switch to the postgres linux user.

sudo su postgres


Enter the PostgreSQL shell.



Create a new database:


Note: change db_name to a relevant database name.


Edit the Backup File

Now you need to open the backup file and replace the old database name with the new one (db_name in our case).

nano psql_backup.sql

Note: change the psql_backup.sql to the actual name of the uncompressed backup file.

The name should be in the first 5-6 lines of the SQL file. When you're done, save the file and close it.


Restore the Backup

Once you have changed the name in the backup file, you can restore it into the newly created database:

psql db_name < psql_backup.sql


Was this answer helpful?

« Back

Enterprise-Grade Hardware

  • Samsung
  • Juniper
  • Western Digital
  • Supermicro
  • LSI
  • Intel
  • R1Soft Backups
  • cPanel
  • MySQL
  • Parallels
  • HP Partner