Aim: backup a database and restore it in database2
pg_dump
A PG Dump has been created by issuing the following command:
c:\Temp>pg_dump -U postgres postgres > backupTest2.sql
Opening backupTest2.sql
shows SQL statements.
restore pg_dump
However, once the backup would like to be restored in another database nothing seems to happen (number of tables in database2 remains 0, command hangs).
c:\Temp>psql -U postgres -d utrechtTest > backupTest2.sql
^C
Best Answer
This:
runs
psql
and writes its stdout tobackupTest2.sql
, which will be overwritten.You meant:
which is better written as:
because if you use
-f
thenpsql
can show line numbers.