Import and dump data for Postgresql on Windows 10

If you need to dump the schema and data for your Postgresql database, and may be re-import it to another database or share it with someone, you have the pg_dump and psql utility at help. If you’re using Windows 10 64-bit machine, the psql and pg_dump utility is available at the following path: C:\Program Files\PostgreSQL\11\bin.

To dump the data for your database, use the following command replacing the values as required:

pg_dump.exe -U postgres -d testdb -f D:\BackupData\import_dump.sql

To import the database, use the below command:


e.g. replace the parameter values for:

username as postgres

database name as testdb

import sql file (using -f switch) as import_dump.sql or provide the complete path to the file.

psql.exe -U postgres -d testdb -f D:\BackupData\import_dump.sql

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.