Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

By Hannnes1
I have a script that backs up our managed PostgreSQL database cluster from DigitalOcean (Attached below). The backup works fine, but I’m having some issues when I try to restore the databases locally.
When I do that I get the following error:
pg_restore: from TOC entry 4819; 0 0 COMMENT EXTENSION aiven_extras
pg_restore: error: could not execute query: ERROR: extension "aiven_extras" does not exist
Command was: COMMENT ON EXTENSION aiven_extras IS 'aiven_extras';
I have found the aiven-extras repo, where the only instructions for installing the extension is to run CREATE EXTENSION aiven_extras;. But I suspect that there is something else I need to do. There seems to be very little information about this, however. If I run the command anyway I get:
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 3; 3079 18759 EXTENSION aiven_extras (no owner)
pg_restore: error: could not execute query: ERROR: could not open extension control file "/usr/share/postgresql/14/extension/aiven_extras.control": No such file or directory
Command was: CREATE EXTENSION IF NOT EXISTS aiven_extras WITH SCHEMA aiven_extras;
The (important part of) the backup script looks like this:
# Back up users, roles, etc.
pg_dumpall -h $DB_HOST -p $DB_PORT -U $DB_USER --globals-only --no-role-passwords -f $BACKUP_DIR/globals/globals.sql
# List all databases.
databases=$(psql -h $DB_HOST -p $DB_PORT -U $DB_USER -l -t | cut -d'|' -f1 | sed -e 's/ //g' -e '/^$/d')
# Remove databases that should not be backed up.
databases=$(echo "$databases" | grep -v -E "template0|template1|postgres|_dodb|defaultdb")
# Back up each database.
for db in $databases; do
mkdir -p $BACKUP_DIR/$db
pg_dump -Fc -d $db -h $DB_HOST -p $DB_PORT -U $DB_USER -f $BACKUP_DIR/$db/$db.dump
done
And the restore (to a new, local, empty database cluster):
psql -h localhost -U postgres -p 5432 < globals.sql
for db in $databases; do
pg_restore -d postgres -h localhost -U postgres -p 5432 -C $db.dump
done
Do I need to install the aiven_extras extension before doing a restore, or can/should I modify something in the backup script instead?
Thank you.
Aakash Singh
Aakash Singh
Frank Tufano
fullammo
4ae272398ee6445a9bf73f4cd632b5
eddie
Taha Aziz Ben Ali
Telmo Valverde
Alexandre Herlinvaux
52d4eff26a544eefb189e2005836b2