Saturday, 31 October 2020

how to restore postgresql database from a backup file

 in order to restore a postgresql database based on a backup file, use a command line (cmd) and enter the following code:




pg_restore -h localhost -p 5432 -U postgres -d testdatabse -v d:\db.backup


with 

localhost: your host name

5432: the used port for postgresql

testdatabase: the new database in which you want to retore you backup file

d:\db.backup: the database backup file.

don't hesitate to write your feedback or comment


3 comments:

  1. thanks, and how to get the backup file?

    ReplyDelete
    Replies
    1. plz take a look to this video. it contains the steps to create a backupfile and to restore it
      https://www.youtube.com/watch?v=AQuIRQQEvE4

      Delete

Thanks for your comments