база-данных – PostgreSQL schema restore from backup


Faced a problem. You must first backup and then restore from the backup one of the database schemas in Posgresql 9.3.9.

I make a backup with the following command:

pg_dump business_card_base --schema test > /tmp/test.backup

Back tried to recover and

pg_dump business_card_base < /tmp/test.backup


pg_dump business_card_base --schema test < /tmp/test.backup

the diagram is empty.

Tell me what am I doing wrong?


pg_dump only dumps the database and does not restore the data. Look in your file /tmp/test.backup , the SQL code is there. To restore, this code simply needs to be executed, for example like this:

 $ psql -f /tmp/test.backup business_card_base
Scroll to Top