HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlModerate

pg_restore hangs in terminal indefinitely with zero output in verbose mode

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
zeroterminalwithindefinitelymodeoutputhangsverbosepg_restore

Problem

I'm trying to restore a PostgreSQL backup that was created on version 11.7 on a fresh install of version 14.1.

When running the pg_restore command, it hangs on the terminal indefinitely with zero output even with verbose logging enabled. Trying to connect as a non-existing user doesn't even give an error. Connecting via psql works fine and I can execute commands without problems.

The following command was used to create the dump:
pg_dump -Fc -f file.pgdump -d mydb

I have tried restoring the dump from another host to the problematic host (one that had no problems restoring it to it's own local instance of PostgreSQL 14.1) which resulted in the same problem. This is the command I am using: pg_restore -f file.pgdump -U user -j 6 --verbose

The fact that I am getting zero feedback from the pg_restore command is making this rather difficult to diagnose. What could be the issue?

Solution

This is the command I am using: pg_restore -f file.pgdump -U user -j 6
--verbose

This is assumes that -f filename is the dump file, but that's not the case. It introduces an output file.

From the manpage:

-f filename --file=filename
Specify output file for generated script, or for the listing when
used with -l. Use - for stdout.

The synopsis is: pg_restore [connection-option...] [option...] [filename]

It expects the path of the dump file at the end of the command, not as an option.

Nothing happens with your invocation because it's waiting for the dump contents in the standard input, since no file is specified at the end of the command.

Context

StackExchange Database Administrators Q#305900, answer score: 13

Revisions (0)

No revisions yet.