trying to using pg_dump to backup a postgres db
i connected through the command prompt and here is my command following this tutorial http://www.postgresqltutorial.com/postgresql-backup-database/
pg_dump -U postgres -W -F t lucz_2017 > X:\postgres_backup\lucz_backup.tar
it gives me an error
Invalid command \postgres_backup. Try \? for help.
what am I doing wrong?
the db name and paths are correct
windows 7 running this from the CMD
To backup one database, you can use the pg_dump tool. The pg_dump dumps out the content of all database objects into a single file. Second, execute the pg_dump program and use the following options to backup the dvdrental database to the dvdrental. tar file in the c:\pgbackup\ folder.
pg_dump is a utility for backing up a PostgreSQL database. It makes consistent backups even if the database is being used concurrently. pg_dump does not block other users accessing the database (readers or writers). pg_dump only dumps a single database.
pg_restore is a utility for restoring a PostgreSQL database from an archive created by pg_dump in one of the non-plain-text formats. It will issue the commands necessary to reconstruct the database to the state it was in at the time it was saved.
Using PostgreSQL executablewith -s (–schema-only) and -t (–table) option to generate DDL of required tables. The option -s dictates that only DDL has to be generated and the option -t dictates that we want DDL of only tables to be generated.
You are running pg_dump from psql. Get out of psql and run pg_dump command from Windows Command prompt. pg_dump is its own executable, different from psql.
This works for me in Windows PowerShell in Windows 10:
.\pg_dump.exe --username "yourUserName" --no-owner "yourDatabasName" >./filename.sql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With