How to migrate a large Odoo instance (>5GB)

Introduction #

Some backups are too large to be uploaded in the Cloudpepper Backups section. You can use the following procedure to migrate your database.

Requirements #

  • A server provisioned by Cloudpepper (which will be hosting your Odoo instance)
  • SSH access to the server provisioned by Cloudpepper. If needed, add your SSH key using the Cloudpepper dashboard.

Step 1. Create an Odoo instance #

Create an new Odoo instance on the server provisioned by Cloudpepper. Under Advanced Options, choose a unique database name. eg: mydatabase and click Add instance.

Choose a unique database name when creating an Odoo instance

Step 2. Overwrite the database of your new instance #

Copy the zip backup to your server through scp, sftp or rsync. Example command using scp below. Ensure to replace 1.2.3.4 with the IP address of your provisioned server.

Bash
scp /path/to/backup.zip [email protected]:backup.zip

The following commands are to be executed on the SSH server. Ensure to replace mydatabase for all occurrences with the database name you chose when creating your Odoo instance.

Bash
sudo systemctl stop odona-mydatabase
unzip backup.zip
rm -f backup.zip
sudo -u postgres psql -c "DROP DATABASE \"mydatabase\";"
sudo -u odoo psql -d postgres -c "CREATE DATABASE \"mydatabase\" ENCODING 'unicode' LC_COLLATE 'C.UTF-8' LC_CTYPE 'C.UTF-8' TEMPLATE template0;"
cat dump.sql | sudo -u odoo psql -d mydatabase
rm -f dump.sql
sudo rm -fr /var/lib/odoo/.local/share/Odoo/filestore/mydatabase
sudo mv filestore /var/lib/odoo/.local/share/Odoo/filestore/mydatabase
sudo chown -R odoo:odoo /var/lib/odoo/.local/share/Odoo/filestore/mydatabase
sudo systemctl restart odona-mydatabase