I have a remote postgres DB version 10.8 setup on a linux. I am trying to back it up on windows machine using postgres 9.6.12
pg_dump --host dahost --port 5432 --username "postgres" --no-password --format tar --blobs --verbose --file "path\noury.backup" "highlands_wastewater"
I get these errors
pg_dump: server version: 10.8 (Ubuntu 10.8-0ubuntu0.18.04.1); pg_dump version: 9.6.12
pg_dump: aborting because of server version mismatch
How can I backup this database remotely?
As the error message says, you cannot use an older version of pg_dump with a newer PostgreSQL Version.
The reason behind that is that PostgreSQL 9.6 cannot know how to dump a v10 database properly — there may be new features in the newer version (for example, partitioned tables).
You'll have to install PostgreSQL v10 or later on your Windows machine (exactly v10 if you want to be able to restore the dump to the original database).
Don't use the tar format. The custom format offers more advantages.
Related
I'm trying to dump a postgres db from a remote client:
pg_dump -Z7 -Fc -h xx.xx.xx.xx -U user dbname > /path/dump/dump.bck
This is the error I received:
pg_dump: server version: 9.4.21; pg_dump version: 9.3.24
pg_dump: aborting because of server version mismatch
The error itself is pretty clear, but unfortunately the remote client where I execute the command is a really old physical file server (ubuntu 14.04) that is impossibile to upgrade.
I have tried to add the postgresql repository in order to install a newer version of pg_dump but the actual os version is not supported anymore.
Is there a way to overcome this problem?
There is no way to overcome the problem except by using a more recent client version. Some options:
install PostgreSQL from source (easier than you think, unless it is Windows)
use a different client machine, e.g. the database server itself
When calling pg_dump to backup my database on remote server
pg_dump "postgresql://$DB_USER:$DB_PASS#$DB_HOST:$DB_PORT/$DB_NAME" | gzip > $BACKUP_GZ
I got below error
pg_dump: server version: 11.5 (Debian 11.5-3.pgdg90+1); pg_dump version: 10.14 (Ubuntu 10.14-0ubuntu0.18.04.1)
pg_dump: aborting because of server version mismatch
Currently, I have to try-and-get as coded here to detect when pg_dump failed with the mismatch version and get the remote version there - which is a very tiring process.
So my question is what is fastest way to get that remote pg_dump version on remote server?
Can simply just go for postgres version cause pg_dump/psql shares same version with postgres version
psql "postgresql://$DB_USER:$DB_PASS#$DB_HOST:$DB_PORT" -c 'select version()' -tA
C:\Program Files (x86)\pgAdmin III\1.22\pg_restore.exe --host localhost --port 5432 --username "postgres" --dbname "randd" --role "postgres" --no-password --verbose "C:\Users\ranjeet\Desktop\RandDbackup19-3final.backup"
pg_restore: [archiver] unsupported version (1.13) in file header
This error means that you are using an old and outdated version of pg_restore (and hence PostgreSQL) on the client side. The dump was created by a more recent release of PostgreSQL that the one installed, so your pg_restore does not know how to handle it.
Archive version 1.13 was introduced by commit 3d2aed664ee8271fd6c721ed0aa10168cda112ea in February 2018. It has been available since the point releases 10.3, 9.6.8, 9.5.12, 9.4.17 and 9.3.22.
You should upgrade your PostgreSQL installation, particularly because this release and this patch contain security relevant bug fixes.
No need to upgrade to the latest Postgres version.
We can backup and restore from any Postgres version to any as follows.
Create a backup in plain SQL format using pg_dump as follows in local/dev machine
pg_dump -U postgres -W -F p test > test.sql
Then use psql to restore dump on remote machine
psql -U postgres -W -d test -f test.sql
It works, on windows as well as Linux environments.
Please note if you see an error message while restoring on the remote machine like 'ERROR: unrecognized configuration parameter "default_table_access_method"'. You can simply ignore this message, as "default_table_access_method" option is introduced in Postgres 12 and while taking backedup added in sql file.
I am running ubuntu 14.04. while backing up a database on postgreSQL i am following error:
/usr/bin/pg_dump --host 127.0.0.1 --port 5432 --username "postgres" --no-password --format custom --section pre-data --section data --section post-data --verbose --file "/home/naveen/consumerDB/CONSUMER_DB" "CONSUMER_DB"
pg_dump: server version: 9.4.8; pg_dump version: 9.3.17
pg_dump: aborting because of server version mismatch
Process returned exit code 1.
Can anyone please help. I tried many other stack overflow links but nothing seems to be working.
The error message seems fairly clear. pg_dump for PostgreSQL 9.3 won't dump a PostgreSQL 9.4 database. Maybe you need to run pg_dump from PostgreSQL 9.4?
If you installed both from packages you'll be using pg_wrapper and should use Debian/Ubuntu's update-alternatives to change pg_dump to point to 9.4's pg_dump. Or run it via the direct path to the actual binary.
See also https://help.ubuntu.com/community/PostgreSQL
I am working with confuence under Windows 8.1 and have produced a lot of Input there.
Now I wanted to backup my PostgreSQL 9.4 database with pgAdmin 3.
I get the error:
C:\Program Files (x86)\pgAdmin III\1.18\pg_dump.exe --host localhost --port 5432 --username "postgres" --no-password --format custom --blobs --verbose --file "C:\Users\milenko\Desktop\output.backup" "confluence"
pg_dump: server version: 9.4.1; pg_dump version: 9.3.1
pg_dump: aborting because of server version mismatch
Do you know a solution?
You need to tell pgAdmin to use the 9.4 binaries, through the "Binary paths" section in the options dialog:
https://www.pgadmin.org/docs/pgadmin3/1.22.2/options-browser.html
your pgAdmin version is a bit old as well. 1.20 ships with Postgres 9.4, not 1.18
Also I found very effective to just replace pg_dump.exe in pgadmin version folder with my pg_dump.exe from my Postgres database.
I see why the solution above is better, but if someone would have problems with that, this also seems like functional alternative.
This solution above works fine for me!. You should try. Inside pgadmin folder, change pg_dump.exe name to pg_dump-bkp.exe and copy&paste pg_dump.exe from postgres folder.