author avatar

sujay

Fri Feb 02 2024

pg_dump commands: Standard pg_dump without DROP table queries: `pg_dump -h your-hostname -p your-port -U your-username -d your-database-name -f output-file.sql``

pg_dump with DROP table queries (clean dump): pg_dump -h your-hostname -p your-port -U your-username -d your-database-name --clean -f output-file.sql

pg_dump for schema only: pg_dump -h your-hostname -p your-port -U your-username -d your-database-name --schema-only -f output-file.sql

pg_dump for data only: pg_dump -h your-hostname -p your-port -U your-username -d your-database-name --data-only -f output-file.sql

pg_dump for data only (no schema, INSERT commands only): pg_dump -h your-hostname -p your-port -U your-username -d your-database-name --data-only --inserts -f output-file.sql