Dariush Jafari
Dariush Jafari

Reputation: 5443

postgresql import backup into a new db

I am trying to restore my .sql backup of postgresql. I read its documents but I want to have clear simple command for importing my whole db (schema and data) into a new postgresql db.

Upvotes: 0

Views: 146

Answers (1)

Sarfaraz Makandar
Sarfaraz Makandar

Reputation: 6733

First of all you need to create a database with template name template0 and use:

Example:

c:\program files\postgresql\9.3\bin> psql -h localhost -p 5432 
                                    -U postgres newDBname < D:\backup.sql

Note: Be sure with template name as template0 and enter a new database name in place of newDBname.

Upvotes: 3

Related Questions