I’m trying to restore backup (created with dhis2 tools) in a new lxc dhis2 instance.
I have the following error when I run restore command
sudo dhis2-restoredb dhis.sql.gz training
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ERROR: permission denied to change owner of foreign-data wrapper "dblink_fdw"
HINT: The owner of a foreign-data wrapper must be a superuser.
NB : For creating the new instance I ran with success following command
sudo dhis2-create-instance training 192.168.0.11 postgres
sudo dhis2-deploy-war -l https://releases.dhis2.org/2.34/dhis2-stable-latest.war training
The problem is with the user that you are using to import db with (i.e., trainging), this user doesn’t have enough privileges to execute the command REASSIGN OWNED BY root TO training. You can view the dhis2-restoredb script to get more info.
A quick solution, login to the db container and change user/role training to be superuser, you can remove later after db import.