backup restore database

How to Backup & Restore Odoo Database

Odoo is a popular ERP suite used by enterprises for application building and management. While using Odoo, it is advisable to regularly backup your Odoo database. In this article, we will look at how to backup & restore Odoo database.

How to Backup & Restore Odoo Database

Here are the steps to backup & restore Odoo database.

How to Backup Odoo database

Open terminal and run the following command to easily backup your Odoo database, using curl or wget, depending on your preference. Replace ADMIN_PASSWORD with your Odoo installation’s admin password and DB_NAME with your Odoo database name.

$ curl -X POST -F 'master_pwd=ADMIN_PASSWORD' -F 'name=DB_NAME' -F 'backup_format=zip' -o /backup_dir/ http://localhost:8069/web/database/backup
$ wget --post-data 'master_pwd=ADMIN_PASSWORD&name=DB_NAME&backup_format=zip' -O /backup_dir/ http://localhost:8069/web/database/backup

If you want to take backup of Odoo instance from remote server, you need to replace localhost with the URL or IP address of remote server where Odoo is installed.

Alternatively, you can open browser and visit the URL mentioned below.


You will see a form where you need to enter your Odoo installation’s master password, and database name, and click Backup.

You can also automate these backup by creating a shell script to take backup and run it periodically as a cronjob. Run the following command to create an empty shell script.

$ sudo vi

Add the following lines to it. Replace BACKUP_DIR, ODOO_DATABASE and ADMIN_PASSWORD variables according to your needs.


# vars

# create a backup directory
mkdir -p ${BACKUP_DIR}

# create a backup
curl -X POST \
    -F "master_pwd=${ADMIN_PASSWORD}" \
    -F "name=${ODOO_DATABASE}" \
    -F "backup_format=zip" \
    -o ${BACKUP_DIR}/${ODOO_DATABASE}.$(date +%F).zip \

# delete old backups
find ${BACKUP_DIR} -type f -mtime +7 -name "${ODOO_DATABASE}.*.zip" -delete

Save and close the file. Run the following command to make your shell script executable.

$ sudo chmod +x ~/

Open Crontab file to add cronjob.

$ sudo crontab -e

Add the following line.

30 1 * * * /home/<yourusername>/

Restore Odoo Database

Similarly, you can restore Odoo database with the following commands, using curl. Replace superadmin_passwd with your Odoo’s master password. Also update the file path to your backup zip file.

$ curl -F 'master_pwd=superadmin_passwd' -F backup_file=@/opt/odoo/odoo_backups/ -F 'copy=true' -F 'name=db3' http://localhost:8069/web/database/restore

In case of successful restore, you will see the following output.

<p>You should be redirected automatically to target URL: <a href="/web/database/manager">/web/database/manager</a>.  If not click the link.

Alternatively, you may open web browser and go to http://your_server_ip:8069/web/database/manager

You will see the following window. Select the backup file to restore, Enter master password and database name for restoration. Select if the database is a copy or if it was moved. Click Continue to proceed with database restoration.

That’s it. In this article, we have learnt how to backup & restore Odoo database in Ubuntu.

Also read:

How to Configure Odoo 13 with PyCharm
How to Install Odoo with Apache Reverse Proxy
How to Setup PostfixAdmin in Ubuntu
How to Completely Uninstall PostgreSQL in Ubuntu
How to Setup NTP Server & Client in Ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *