omar marouani
omar marouani

Reputation: 103

odoo12 database backup no owner?

I can't backup odoo 12 database, i use postgres 10 and docker containers.error:

Database backup error: Postgres subprocess ('/usr/bin/pg_dump', '--no-owner', '--file=/tmp/tmpgoyjsd3i/dump.sql', 'odoo') error 1

Upvotes: 0

Views: 4208

Answers (2)

sewunet Abebaw
sewunet Abebaw

Reputation: 1

I also experience this error. It is because your odoo docker image has a different version of Postgresql than the odoo database PostgreSQL image. please make sure that both have the same version.

  • Steps

docker exec -ti -u 0 yourodoocontainername bash

psql --version

the above will give you the version of PostgreSQL in the odoo container

docker exec -ti -u 0 yourodoocontainername bash

 psql --version

the above will give you the version of the PostgreSQL image

if the above two versions are different please use the following commands.

apt-get update
echo 'deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main' >  /etc/apt/sources.list.d/pgdg.list
yes Y | apt-get install wget
yes Y | apt-get install gnupg
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
apt-get update

yes Y | apt-get install postgresql-client-{virsion of your PostgreSQL image eg, 12 )

Upvotes: 0

Veikko
Veikko

Reputation: 3610

This error occurs if you have a different version of Postgresql client (the version on Odoo server) and server (the version on your database server). If you are using the Odoo "official" Docker image or image based on that, e.g. veivaa/odoo image, it is based on debian:stretch version and it has Postgresql version 9.6 as default client. With this setup you will have a mismatch: client v9.6 connecting to server v10. It will result in the error you are getting.

To solve this you have to install same version on client and server. You can either downgrade your Postgres server to 9.6, or upgrade Postgres client in your Odoo Docker container to 10. You can test this by doing the client upgrade manually. docker exec -ti -u 0 yourodoocontainername bash to the Odoo container and executing these commands inside the Odoo container:

apt-get update
echo 'deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main' >  /etc/apt/sources.list.d/pgdg.list
yes Y | apt-get install wget
yes Y | apt-get install gnupg
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
apt-get update
yes Y | apt-get install postgresql-client-10

You need to have root permissions in the container to run these. After this install you can exit from exec and restart your container with docker restart yourodoocontainername. Make sure you have persistent storage used for Odoo data so that you don't lose your filestore. After these steps you are able to do backups and restores with Odoo web interface.

You can check your Postgresql client version with psql --version command. The expected result with version 9.6 is psql (PostgreSQL) 9.6.10 and with version 10 psql (PostgreSQL) 10.6 (Debian 10.6-1.pgdg90+1).

The exec method is good for testing but not good for permanent use because it involves manual steps. You should build your Docker images with the right version by modifying your Dockerfile.

Upvotes: 1

Related Questions