Knowledgebase

Question About Servers

How to Restore a Database Backup in Odoo Print

  • 1

In this guide, we will cover the step-by-step process to restore an Odoo database backup file into a new PostgreSQL database.

 

Decompress the Snapshot

The database backup file is usually 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: Replace psql_backup with the actual name of your compressed backup file.

 

Create the Database in PostgreSQL

Switch to the postgres linux user.

sudo su postgres

 

Enter the PostgreSQL shell.

psql

 

Create a new database:

CREATE DATABASE db_name;

Note: Replace db_name with a relevant and descriptive 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