Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 1 down vote accepted

#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.

share|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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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