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?
Related
Source db is Postgres RDS 9.6.11 version
Target db is Postgres RDS 9.6.18 version
I am trying to migrate the data from source to target db using postgres native tools.
But Its not working for me..
pg_dump --host qatest.us-east-1.rds.amazonaws.com -c -Fc -U username -d username >qadump_original_fc.sql
pg_restore -U postgres -d postgres -Fc -h qatest.us-east-1.rds.amazonaws.com qadump_original_fc.sql
pg_restore: [archiver] did not find magic string in file header
pg_restore -U postgres -d postgres -h qatest.us-east-1.rds.amazonaws.com qadump_original_fc.sql
pg_restore: [archiver] input file does not appear to be a valid archive
Using psql to import throwing multiple errors like Invalid large objects,syntax error etc,.
I have tried with and without -Fc in pg_dump for pg_restore and psql, but no luck.
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.
When I issued the command:
psql -h localhost -U ruanpc
The console fails to connect to localhost postgres db and display:
psql: symbol lookup error: psql: undefined symbol: PQsetErrorContextVisibility
My postgres and psql versions are:
ruanpc#slave-40:~$ postgres --version
postgres (PostgreSQL) 11devel
ruanpc#slave-40:~$ psql --version
psql (PostgreSQL) 11devel
Any one knows how to solve it?
Your psql loads a libpq with version 9.5 or older. Make sure to use the same version of libpq as the psql version.
Oh, I forget to set the LD_LIBRARY_PATH to point to Postgres shared library!
Easy fix for me!
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
New install of PostgreSQL and pgAdmin on Ubuntu 11.04 64-bit.
On restoring a database schema with pgAdmin, it launches the following command:
/usr/bin/pg_restore --host opusdb --port 5432 --username postgres --dbname \"mydb\" --verbose "mydb.backup"
pg_restore: connecting to database for restore
pg_restore: [archiver (db)] connection to database ""mydb"" failed: FATAL: database ""mydb"" does not exist
pg_restore: *** aborted because of error
Process returned exit code 1.
The problem is due to the \" before and after the database name. The following works on the command line (note the absent \ characters):
/usr/bin/pg_restore --host opusdb --port 5432 --username postgres --dbname "mydb" --verbose "mydb.backup"
Not sure if pgAdmin is suddenly using a different syntax, or pg_restore doesn't understand the \" anymore. Could it be in any way related to the 64-bit installation of Ubuntu?
Obviously this is a problem with the particular pgadmin3 version: osdir.com/ml/ubuntu-bugs/2011-05/msg30089.html
The next version shouldn't have this problem anymore.