How do I take a schema level backup in PostgreSQL database and restore on the another database? Is there any single command available for this? For example, can I pg_dump and restore in single line?
pg_dump --schema=masters oldDB > masters1.sql cat masters1.sql | psql newDB
or
in single command you can do by this
pg_dump oldDB --schema masters | psql -h localhost newDB;
2.1m questions
2.1m answers
60 comments
57.0k users