Knowledgebase

Question About Servers
We are aware of a potentially service impacting issue. Learn more

How to Backup and Restore a Database in Odoo Print

  • 0

Odoo's database backup and restore feature offers several valuable benefits. Users can reduce downtime and quickly recover their data in case of any mishaps.

How to Create a Database Backup

Step 1: Go to the database manager in your Odoo instance. To do this, use the following URL <odoo-url>/web/database/manager. Be sure to replace the "odoo-url' with the correct address and port that you use to access your Odoo instance. The database manager appears as shown below.

Step 2: Click on the "Backup" button as highlighted in the above screenshot. The dialog below will pop up. Enter the master password and select the backup format you wish to use. 

Odoo offers two backup formats for creating database backups:

  • ZIP (includes filestore): The ZIP format is the default and compressed backup option, reducing file size and making it suitable for most scenarios. By choosing the "zip" option, a zip file will be created, which includes the filestore, dump.sql, and manifest.json. The dump.sql file primarily holds all the (PostgreSQL backup) data, while the filestore contains static files like images and attachments stored on disks. The manifest.json file includes details such as the list of modules, Odoo version, database name, PostgreSQL version, and other relevant information.
  • Pg_dump custom format( without filestore): This format provides an uncompressed representation of the database, offering human-readable data and better control over large datasets or data migrations. Users can choose the format that best suits their specific needs and requirements.

Step 3: Click on the "Backup" button. Odoo will generate a backup for your database.

How to Restore a Database

The database restoration process in Odoo can be accomplished through either the Odoo interface or psql commands. For extensive databases, it is recommended to utilize psql commands. To initiate the restoration, a database backup is required. The restoration can be executed either through the front end or via the terminal.

From the GUI

Step 1: Using the front end, it is possible to restore the database. To do this, access the database manager at "odoo-url>/web/database/manager" and choose the "Restore Database" option as shown below.

Step 2: Click on the "Restore Database" button as highlighted in the above screenshot. The dialog below will pop up.

Step 3: Enter the master password, browse your directory for the .zip file, assign a name to the database, and then proceed by clicking the "Continue" button. 

In case you wish to exclude the filestore (images and attachments) during restoration, you can utilize the dump.sql file from the terminal to restore the database. Simply extract the database backup .zip file, which comprises filestore, manifest.json, and dump.sql.

From the Terminal

Execute the following commands in the terminal to perform the database restoration.

$sudo su postgres
$createdb -O [Owner] [database_name]
$pgrestore -d [database_name] [dumpfile_name].dump

Regularly creating backups of your Odoo database ensures that your business-critical information is protected from accidental deletion, corruption, or system malfunctions. In case of any data loss, you can quickly restore the backup to recover the lost information."

By consistently making backups of your Odoo database, you safeguard your vital business data from accidental deletion, corruption, or system issues.


Was this answer helpful?

« Back

Enterprise-Grade Hardware

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