Exporting data of postgresql database with pg_dump
pg_dump — extract a PostgreSQL database into a script file or other archive file.
Example
E:\postgre\bin>pg_dump -U postgres -h localhost data2 > db.sql Password: E:\postgre\bin>
after executing first line, the system only asks for password of the user and the dump file will be created.
Where :
pg_dump : is the dump executable, found under bin directory of postgres installation
-U : Username
-h : localhost
data2 : name of the database to be exported
db.sql : name of the export file