pg_dump: aborting because of server version mismatch - postgresql

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

Related

Postgresql 13.9 pg_dump 12.12 server version mismatch

While taking the backup of the postgressql database I am getting below issue
pg_dump -Fc -h localhost -U postgres -d <user> -f <filename>`
pg_dump: error: server version: 13.9; pg_dump version: 12.12 (Ubuntu 12.12-0ubuntu0.20.04.1)
pg_dump: error: aborting because of server version mismatch
Can anyone help me with this issue and help us to take the appropriate backup?

How to use pg_restore without upgrading Postgresql?

I tried to restore a database from the command line using
pg_restore --host localhost --port 5434 __username "postgres" --dbname "database_name" -- verbose ""file_path"
But I keep getting the same message
pg_restore archiver unsupported version (1.13) in file header
BTW: I'm using Postgres 9.6
Is there another way to solve it without upgrading PostgreSQL?

pg_dump version mismatch

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.

pg_restore: [archiver] unsupported version (1.13) in file header

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.

PostgreSQL 9.4 database cannot be saved with pgAdmin 3 (Windows 8.1)

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.