Skip to Content
Menu
This question has been flagged
1 Reply
1830 Views
please how I can backup a postgress 60G database on an ssh server and remount it on another remote server


Avatar
Discard
Best Answer

Hi,

You can try the pg_dump command to create the backup and then restore it in your remote server using pg_restore.

connect to the source server where the db is located using SSH and run the following command

pg_dump -F c --dbname=mydb > backup.dump [This will create a compressed backup.dump that contains all the tables and data from the mydb database]

scp backup.dump dest_server:~/ [Copy the backup file from source server to the destination where you want to restore the database]

Now connect to destination server via ssh and execute the following,

createdb mydb [Create an empty database to hold the restored data]

pg_restore -d mydb backup.dump [Run pg_restore to load the data from the backup file into the new database]

Let me know if you need further assistance on this.

Thanks


Avatar
Discard