How to do it? Opened the command line " С:\Program and Files\PostgreSQL\8.4\bin\psql.exe ", but I don’t remember anything further, I С:\Program and Files\PostgreSQL\8.4\bin\psql.exe something in my memory, the user name postgres is the name of the dump db.sql <and then I don’t remember.
3 answers
On good, first remove the target database, even if there is none - to be safe from errors in the process is necessary.
Immediately for an explanation:
-his the server address,-pis the port-Uis the username. A password will be requested for subsequent actions.-e- specify the name of the database-Eis a base encoding, it is found in both UTF8 and CP1251,-O- the owner of the database-i- display all messages in the database import process,-d- specify the base for import,-v- specify the dump file"C:\\Program Files\\PostgreSQL\\8.4\\bin\\dropdb.exe" -h localhost -p 5432 -U postgres -e ВашаБазаThen create an empty target database:
"C:\\Program Files\\PostgreSQL\8.4\\bin\\createdb.exe" -h localhost -p 5432 -U postgres -E UTF8 -O postgres ВашаБазаWell, import the dump:
"C:\\Program Files\\PostgreSQL\\8.4\\bin\\pg_restore.exe" -i -h localhost -p 5432 -U postgres -d ВашаБаза -v "d:\\backup.backup"
psql dbname < db.sql See the documentation for more info http://www.postgresql.org/docs/8.1/static/backup.html
- Ok, I read it, tried it with \ i is also normal, but it turns out I have a password on my base) - Goldy
pgdump and pgrestore