PostgreSQL: Copy Database to another Server in Windows (pg_dump – backup & restore)

In our organization, junior database developers are learning PostgreSQL, and they require a sample database from our Validation Database Server.

In this scenario, Database Administrator takes PostgreSQL backup using pg_dump utility and restore that dump into the development environment.

A pg_dump is a PostgreSQL utility which is used for PostgreSQL database backup and restore.

Another option is, directly copy the database from one server to another server using pg_dump + psql. In this scenario, Database Administrator does not require any intermediate database backup file.

Open your windows command prompt and go to \PostgreSQL\bin directory where you can execute and test below two different commands.

Copy database from one server to another server (using, pg_dump | psql):

Copy database, Using pg_dump utility for backup and restore:

Take full database backup:

Restore database backup:

PostgreSQL: File System Level Backup to just Copy DATA Directory

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from

Leave a Reply

Be the First to Comment!

Notify of