How to restore PostgreSQL dump file into Postgres databases?

后端 未结 7 902
小鲜肉
小鲜肉 2020-12-04 14:05

I have a dump file with a .SQL extension (in fact it is a plain-text SQL file). I want to restore it into my created databases. I am using pgAdmin III, and when

7条回答
  •  渐次进展
    2020-12-04 15:02

    By using pg_restore command you can restore postgres database

    First open terminal type

    sudo su postgres
    

    Create new database

    createdb [database name] -O [owner]

    createdb test_db [-O openerp]
    

    pg_restore -d [Database Name] [path of dump file]

    pg_restore -d test_db /home/sagar/Download/sample_dbump
    

    Wait for completion of database restoring.

    Remember that dump file should have read, write, execute access, so for that you can apply chmod command

提交回复
热议问题