Обсуждение: Really Dumb Question...(Dumping db)
All I want to do is dump the db, which should be easy, right? If I do: pg_dump -u worldwide > worldwide.pgdump my system just hangs and doesn't ever ask for a username or password. if i remove the -u, it says it can't connect cause no password was supplied. What am i missing? Thanks, Joe
> All I want to do is dump the db, which should be easy, right? If I do: > pg_dump -u worldwide > worldwide.pgdump pg_dump, with the -u, expects you to enter your username/password to stdin or something. (guys, print the prompts to STDERR instead?) The problem is that stdout is redirected into your file there, so you don't see the username/password prompts. John
ok, makes sense, so how would I get around it? Thanks, Joe John Madden wrote: > > > All I want to do is dump the db, which should be easy, right? If I do: > > pg_dump -u worldwide > worldwide.pgdump > > pg_dump, with the -u, expects you to enter your username/password to > stdin or something. (guys, print the prompts to STDERR instead?) The > problem is that stdout is redirected into your file there, so you don't > see the username/password prompts. > > John
> ok, makes sense, so how would I get around it? Thanks, You type in the username/password as if the prompts were there. :) John
Alright, Next question. I got the dump out (thanks for all the help). Now I can't get it back in on the other server! It keeps telling me permission denied to the file itself. I even tried chmod'ing it to 777 and changing the ownership to postgres.postgres, su to postgres and it says "permission denied" when I try to: psql -e worldwide < worldwide.pgdump What now? Thanks for the help :) On another note -- the docs for postgres seem to be a bit scarce for the beginner... Joe
Joe, If you have password authentication on for the other server as well try this command instead, psql -e worldwide -f worldwide.pgdump where the -f switch tells psql to execute commands contained in a file. I just fought with that one today for a bit until I remembered that switch. You should then get a password prompt to enter your password. Tim Frank >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<< On 20/03/01, 6:18:02 PM, joe@jwebmedia.com (Joseph Koenig) wrote regarding Re: [GENERAL] Really Dumb Question...(Dumping db): > Alright, Next question. I got the dump out (thanks for all the help). > Now I can't get it back in on the other server! It keeps telling me > permission denied to the file itself. I even tried chmod'ing it to 777 > and changing the ownership to postgres.postgres, su to postgres and it > says "permission denied" when I try to: > psql -e worldwide < worldwide.pgdump > What now? Thanks for the help :) > On another note -- the docs for postgres seem to be a bit scarce for the beginner... > Joe > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> If you have password authentication on for the other server as well try > this command instead, > > psql -e worldwide -f worldwide.pgdump > > where the -f switch tells psql to execute commands contained in a file. > I just fought with that one today for a bit until I remembered that > switch. You should then get a password prompt to enter your password. Oh, and remember to "fix" the dump file -- it'll contain the username and password prompts (remember that they were sent to stdout...) You might consider doing filesystem backups instead of the dump stuff -- it's a great deal easier. John -- # John Madden weez@freelists.org ICQ: 2EB9EA # FreeLists, Free mailing lists for all: http://www.freelists.org # UNIX Systems Engineer, Ivy Tech State College: http://www.ivy.tec.in.us # Linux, Apache, Perl and C: All the best things in life are free!
3/20/2001 11:23:19 AM, Joseph Koenig <joe@jwebmedia.com> wrote: >Alright, Next question. I got the dump out (thanks for all the help). >Now I can't get it back in on the other server! It keeps telling me >permission denied to the file itself. I even tried chmod'ing it to 777 >and changing the ownership to postgres.postgres, su to postgres and it >says "permission denied" when I try to: >psql -e worldwide < worldwide.pgdump You must supply a username that has permissions to perform creates and inserts on the database: % psql -U postgres -e worldwide < wordwide.pgdump Brent --- Brent R. Matzelle Software Engineer Information Services Main Line Health Systems Tel: 610-240-4566 Pager: 610-640-8437 matzelleb@mlhs.org
John, Thanks for mentioning that fix :) I'm sure one could run sed or something similar to remove that line at the top of the file after the backup has completed (I shall have to try that sometime). Just a note about the filesystem level backups. In my experience they are about twice the size of the dumped data after being tar'd/gzip'd, which isn't that big of a deal these days but something to be aware of when allocating backup space (or writing to removable media such as CD's, zips, tapes, whatever). The other is just a note from the development docs for 7.1 which can be read here http://www.postgresql.org/devel-corner/docs/admin/backup-file.html so I won't repeat it myself. Tim Frank >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<< On 21/03/01, 9:15:27 AM, John Madden <weez@freelists.org> wrote regarding Re: [GENERAL] Really Dumb Question...(Dumping db): > > If you have password authentication on for the other server as well try > > this command instead, > > > > psql -e worldwide -f worldwide.pgdump > > > > where the -f switch tells psql to execute commands contained in a file. > > I just fought with that one today for a bit until I remembered that > > switch. You should then get a password prompt to enter your password. > Oh, and remember to "fix" the dump file -- it'll contain the username and > password prompts (remember that they were sent to stdout...) > You might consider doing filesystem backups instead of the dump stuff -- > it's a great deal easier. > John > -- > # John Madden weez@freelists.org ICQ: 2EB9EA > # FreeLists, Free mailing lists for all: http://www.freelists.org > # UNIX Systems Engineer, Ivy Tech State College: http://www.ivy.tec.in.us > # Linux, Apache, Perl and C: All the best things in life are free!
On Wed, 21 Mar 2001, Tim Frank wrote: > John, > > Thanks for mentioning that fix :) I'm sure one could run sed or > something similar to remove that line at the top of the file after the > backup has completed (I shall have to try that sometime). It's probably easier to set PGUSER and PGPASSWORD as needed, IMHO. They are self-explanatory, aren't they? You can use them at both ends to ease the backup stuff. -- Alvaro Herrera (<alvherre[@]atentus.com>)