Take the 2-minute tour ×
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.

I'm trying to backup the database I made in postgresql but it doesn't seem to work

root@localhost:/home/tests# sudo -s -u postgres
postgres@localhost:/home/tests$ psql
psql (8.4.17)
Type "help" for help.
postgres=# pg_dump test_site > payroll.dump.out  
postgres-# ls
postgres@localhost:/home/tests$ exit
root@localhost:/home/tests# ls # Where is the backup?
cars  manage.py  media  staticfiles  test.db  tests  tests.db  test.wsgi

Can someone help me , please :)

share|improve this question

1 Answer 1

up vote 3 down vote accepted

pg_dump is not an SQL command. It's a separate command, like psql. So you can't run it from within a psql session, you must run it from a regular shell.

The reason you're not getting an outright error is that you didn't write a semicolon on the end of the line. That's why the prompt changed, too:

postgres=# pg_dump test_site > payroll.dump.out  
postgres-# ls
        ^ <-- See how it goes from = to - ?

That indicates that it's a continuation line, so psql is buffering up a statement and hasn't sent it yet.

share|improve this answer
    
u live in australia ? I live in sydney :) –  Uncle Toby Jun 16 '13 at 7:04
    
thank for the help craig –  Uncle Toby Jun 16 '13 at 7:58
    
@UncleToby Perthite here, I'm afraid, practically a different country. Anyway - welcome to Stack Overflow. You might want to think about (a) upgrading PostgreSQL and (b) starting to read through the really rather good manual. –  Craig Ringer Jun 16 '13 at 23:31
    
Western Australia, Australia . What australia are you talking about sir? –  Uncle Toby Jun 29 '13 at 8:44

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.