This question may be asked many times. We are trying to move a postgres db from windows (psql 9.3) to ubuntu runing postgres 9.3. Here is what we did:

  1. In windows, create backup for db cis with pgadmin. The backup file name is cis.backup
  2. Copy the cis.backup to ubuntu and save it under /home/myname
  3. Log in to psql with: sudo -u postgres psql postgres
  4. Create db cis_new on ubuntu with #CREATE DATABASE cis_new WITH OWNER postgres ENCODING 'UTF8';
  5. Restore #pg_restore --dbname cis_new --verbose /home/myname/cis.backup

The last pg_restore creates nothing and there was no restore at all. Is anything we missed here? Thanks.

  • Post the Error message – eckes Apr 3 '19 at 19:39

#pg_restore --dbname cis_new --verbose /home/myname/cis.backup

The hash is not part of the command name. It's a convention on unix systems used to indicate "root prompt". Unfortunately, it's also a comment on some shells.

Try again without the hash.

| improve this answer | |
  • Did you mean # sign? # was not included for pg_restore when it was typed in. – user938363 May 31 '14 at 15:43
  • You are right. The pg_restore should be ran under linux. Also we added linux root as pg superuser before running the pg_restore. – user938363 May 31 '14 at 17:34
  • Adding a 'root' user is unnecessary. Just sudo -u postgres pg_restore ... . As for running under linux vs windows, it should not matter at all. I'm glad your issue is resolved but that isny why. – Craig Ringer Jun 1 '14 at 0:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.