Friday, March 25, 2022

Back up of Postgres Database from Command Line


<location of postgres installation bin directory>/pg_dump -U <username> -h <server ip address or localhost> -p <port of database> -W -d <database name for which backup needed> > <backupfilename>.sql

Example:

/u01/postgres/9.6/bin/pg_dump -U testuser -h 127.0.0.1 -p 5452 -W -d test_db > test_db_bkp.sql

No comments:

Post a Comment