debugsqlMinor
Why is my pg_restore command not working?
Viewed 0 times
whyworkingcommandnotpg_restore
Problem
Yesterday, I created backups of my various PostgreSQL databases using the following command:
I created an individual backup for each database.
Today, I'm trying to restore them to an upgraded database server using the following command:
When I run
When I check the database, the database is not present. What am I doing wrong?
Employed versions info
-
Backups created with version 9.6.0
-
Attempting to restore using version 9.6.1
pg_dump -Fc -d junk -h localhost -p 5434 -U postgres -W > z:\pg_dump\96_junk.dumpI created an individual backup for each database.
Today, I'm trying to restore them to an upgraded database server using the following command:
pg_restore -h localhost -p 5434 -U postgres -W -C -v z:\pg_dump\96_junk.dumpWhen I run
pg_restore using the above it seems that the database was restored. The console screen displays a series of SQL statements and other messages I would expect to see for this database and, at the end, "PostreSQL database dump complete" is the output shown.When I check the database, the database is not present. What am I doing wrong?
Employed versions info
-
Backups created with version 9.6.0
-
Attempting to restore using version 9.6.1
Solution
Try specifying the name of the DB to start in, using the
-d or --dbname argument. This worked for me when I had the same problem. Note that it doesn't have to be the target DB: pg_restore -h localhost -p 5434 -U postgres -d postgres -W -C -v z:\pg_dump\96_junk.dumpCode Snippets
pg_restore -h localhost -p 5434 -U postgres -d postgres -W -C -v z:\pg_dump\96_junk.dumpContext
StackExchange Database Administrators Q#157539, answer score: 7
Revisions (0)
No revisions yet.