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
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)
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>
The easiest way to backup PostgreSQL databases is to use PostgreSQL-Backup (https://postgresql-backup.com/ )
ReplyDelete