ODOO Automatic Backup: The Simple and Reliable Way to Protect Your Data

Hilar Ak
3 min readAug 2, 2020

Odoo Data Backup Automatically & Restore Using PSQL/From Odoo Views

Effective backup management is essential for maintaining a live ERP system. One option for backing up and restoring data in ODOO is to use the conventional method provided by the software, but this can be slow and prone to errors when dealing with large databases. It is important to consider alternative approaches that may be more efficient and reliable.

There are many backup management modules available for ODOO in the marketplace, but a common issue is that they often combine dump backups and attachment filestores. If the database size is large (e.g. 25 GB) and the filestore is even larger (e.g. 50 GB), this can put a strain on the system and potentially cause errors during the restore process. Additionally, the restoration process can be time-consuming, especially with larger datasets. It is important to have a strong ODOO configuration to avoid these issues.

There are more reliable options for backing up and restoring data in ODOO than the conventional methods mentioned earlier. One such approach is to use PSQL queries to compress the data and split the filestore and database backups into separate files. These backups can then be moved to a local location, a remote server via a secure FTP connection, or to cloud storage like Google Drive or Dropbox. This allows for more control over the backup and restoration process and can reduce the risk of errors.

To ensure that the backup and restoration process is performed regularly and automatically, we can utilize ODOO CRON jobs. These jobs can handle the repetition of the process and provide status updates, making it easier to monitor the health of the backups. This can help to ensure that data is consistently being protected and can be easily restored if necessary.

All of these thoughts reached as an ODOO module and you can find it in the ODOO Apps Store.

ODOO Database Backup Configuration
ODOO Database Backup Configuration and status.

You can get the module from this link.

https://apps.odoo.com/apps/modules/17.0/auto_backup_odoo/

Here is the video demonstration of the ODOO module.

How to setup ODOO Backup to do automatically.

How to restore ODOO databases?

Using the traditional method for restoring data in ODOO, it is not possible to restore backup files in the Plain SQL or compressed gzip formats. Attempting to restore a large database dump using this method may result in a timeout error. This can be frustrating and time-consuming, and it is important to consider alternative approaches that may be more efficient and reliable.

I recommend using PSQL queries to restore ODOO databases, as this method is reliable, fast, and efficient. I can provide you with simple methods for restoring databases using PSQL if you are interested.

Plain SQL Format

The plain text format is useful for very small databases with a minimal number of objects but other than that, it should be avoided.

psql -U username -d database -f backupfile.sql

or

psql database < backupfile.sql

Tar Format

Using this archive format allows reordering and/or exclusion of database objects at the time the database is restored. It is also possible to limit which data is reloaded at restore time. we use tar with gzip

pg_restore -d database backupfile.tar -U username

You can add following parameters

  • -c create a new database before restore
  • -v verbose mode
  • - t particular table only

Compressed Format

This is the most flexible format in that it allows the reordering of loading data as well as to object definitions. This format is also compressed by default.

pg_restore -d database backupfile.sql.gz -U username

or

gunzip -c backupfile.sql.gz | psql -U username -d database

--

--

Hilar Ak

Experienced Python / ODOO Developer with a demonstrated history of working in the information technology and services industry.