Restore dump on the remote machine

前端 未结 5 880
醉话见心
醉话见心 2020-12-15 06:50

I\'ve got my own machine with postgres dmp file, which I want to restore on the remote virtual machine (e.g. ip is 192.168.0.190 and postgres port is 5432) in my network. Is

5条回答
  •  醉酒成梦
    2020-12-15 07:28

    I run this and works to me:

        scp backup.dump user@remotemachine:~
    
        ssh user@remotemachine "pg_restore -h localhost -p 5432 -U databaseuser -W -F c -d databasename -v backup.dump"
    

    You can write a script to automate this.

提交回复
热议问题