Friday 13 January 2012

PostgreSQL Backup and Restore (Linux to Windows)

In case we want to take a PostgreSQL database backup from a Linux Box and restore it to a Windows Machine, the following steps can be performed.

In the Linux Box

Create the backup


pg_dump -U <username> -F c  –f <backupname>  <databasename>



Now copy the created Backup file to the windows machine



In the Windows Machine

Open CMD

Change directory to the PostgreSQL bin folder (Incase the Path Variable is not set)


pg_restore -U <username>  <backupname>    >    <databasename>




1 comment:

  1. The easiest way to backup PostgreSQL databases is to use PostgreSQL-Backup (https://postgresql-backup.com/ )

    ReplyDelete