简体   繁体   中英

How to restore backup postgres database on windows machine

I have tried on terminal:

 psql -d test <.\backup_database.sql
At line:1 char:14
+ psql -d test < .\backup_database.sql
+              ~
The '<' operator is reserved for future use.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : RedirectionNotSupported

pg_dump command worked seamlessly on terminal. So where do i run psql command. Tried on dbshell -Not working, Manually adding on pgadmin 4 gives pg_restore: error: input file appears to be a text format dump. Please use psql. pg_restore: error: input file appears to be a text format dump. Please use psql.

Don't use redirection on Windows, use the -f parameter to pass the file to be run:

psql -d test -f backup_database.sql

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM