Thread: how to copy data between machines ?
Hi folks, After searching for a while as to how to transfer data from machine to machine, I came across the 'pg_dump' and 'pg_restore' commands. On machine 'A', I did .. /usr/local/pgsql/bin/pg_dump test -f /tmp/blah Then ... [socrates:/tmp] desmond% ls -l /tmp/blah -rw-r--r-- 1 desmond wheel 540 12 May 22:02 /tmp/blah I then scp that file to machine B, and do ... pg_restore -d test /tmp/test The result is ... pg_restore: [archiver] input file does not appear to be a valid archive Eh ??? What did I miss ? I'm using the same version of postgreSQL on both machines, both installed within minutes of each other. Thanks in advance. D.
Le 12 mai 05, à 22:05, D.C. a écrit : > pg_restore -d test /tmp/test Sorry: /tmp/blah. I didn't mix up the input files, but there are two of them. :-( So the question still remains unresolved. :-( D. -- Des Coughlan coughlandesmond@yahoo.fr
I think you need the '-F c' option in pg_dump to make pg_restore understand the archive. Mark On 5/12/05, D.C. <coughlandesmond@yahoo.fr> wrote: > > Hi folks, > > After searching for a while as to how to transfer data from machine to > machine, I came across the 'pg_dump' and 'pg_restore' commands. > > On machine 'A', I did .. > > /usr/local/pgsql/bin/pg_dump test -f /tmp/blah > > Then ... > > [socrates:/tmp] desmond% ls -l /tmp/blah > -rw-r--r-- 1 desmond wheel 540 12 May 22:02 /tmp/blah > > I then scp that file to machine B, and do ... > > pg_restore -d test /tmp/test > > The result is ... > > pg_restore: [archiver] input file does not appear to be a valid > archive > > Eh ??? > > What did I miss ? > > I'm using the same version of postgreSQL on both machines, both > installed within minutes of each other. > > Thanks in advance. > > D. > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org >
Le 12 mai 05, à 22:11, Mark Greenbank a écrit : > I think you need the '-F c' option in pg_dump to make pg_restore > understand the archive. Thank you !! D.
"D.C." <coughlandesmond@yahoo.fr> writes: > The result is ... > pg_restore: [archiver] input file does not appear to be a valid > archive > Eh ??? pg_restore is for restoring dumps that you make with the -Fc or -Ft options to pg_dump. The default output from pg_dump is a plain sql script that you just feed to psql. regards, tom lane
At 04:05 PM 5/12/05, D.C. wrote: >After searching for a while as to how to transfer data from machine to >machine, I came across the 'pg_dump' and 'pg_restore' commands. > >On machine 'A', I did .. > > /usr/local/pgsql/bin/pg_dump test -f /tmp/blah > >Then ... > > pg_restore -d test /tmp/test > >The result is ... > > pg_restore: [archiver] input file does not appear to be a valid archive > >What did I miss ? You forgot to read the manpage for pg_dump: -F format --format=format t Output a tar archive suitable for input into pg_restore. Using this archive format allows reordering and/or exclusion of schema ele- ments at the time the database is restored. It is also possible to limit which data is reloaded at restore time.
Le 12 mai 05, à 22:19, Tom Lane a écrit : > "D.C." <coughlandesmond@yahoo.fr> writes: >> The result is ... >> pg_restore: [archiver] input file does not appear to be a valid >> archive > >> Eh ??? > > pg_restore is for restoring dumps that you make with the -Fc or -Ft > options to pg_dump. The default output from pg_dump is a plain sql > script that you just feed to psql. Thanks again, and may I now make the most of your generosity by asking another question ? I got an error message when ./configuring postgreSQL, and now I find that I don't have 'history', and I can't use the 'up' arrow to cycle through previous commands. The error was about 'readline', I think. The installation I use is on an iBook, which might sound mad, but I want a version to be able to take everywhere with me, and learn whilst on the bus, in the train etc .. Thanks again. D.
"D.C." <coughlandesmond@yahoo.fr> writes: > Thanks again, and may I now make the most of your generosity by asking > another question ? I got an error message when > ./configuring postgreSQL, and now I find that I don't have 'history', > and I can't use the 'up' arrow to cycle through previous commands. The > error was about 'readline', I think. Yup, you need libreadline to support that. > The installation I use is on an iBook, which might sound mad, but I > want a version to be able to take everywhere with me, and learn whilst > on the bus, in the train etc .. I use a Mac laptop too. Personally, I get the readline sources (check freshmeat.net for a pointer) and build/install them in the default way, which drops 'em in /usr/local. This is highly Not Mac Approved I'm sure, but it gets the job done. You could no doubt also get readline from the fink project, if you'd rather have something prebuilt (but then again why are you building PG by hand if that's what you want ...) regards, tom lane
At 4:38 PM -0400 5/12/05, Tom Lane wrote: >"D.C." <coughlandesmond@yahoo.fr> writes: >> Thanks again, and may I now make the most of your generosity by asking >> another question ? I got an error message when >> ./configuring postgreSQL, and now I find that I don't have 'history', >> and I can't use the 'up' arrow to cycle through previous commands. The >> error was about 'readline', I think. > >Yup, you need libreadline to support that. > >> The installation I use is on an iBook, which might sound mad, but I >> want a version to be able to take everywhere with me, and learn whilst >> on the bus, in the train etc .. > >I use a Mac laptop too. Personally, I get the readline sources >(check freshmeat.net for a pointer) and build/install them in the >default way, which drops 'em in /usr/local. This is highly Not Mac >Approved I'm sure, but it gets the job done. You could no doubt also >get readline from the fink project, if you'd rather have something >prebuilt (but then again why are you building PG by hand if that's >what you want ...) There's nothing wrong with dropping stuff in /usr/local/ on a Mac. That's how I do it too. Apple makes an effort not to stomp in /usr/local for obvious reasons. :-) -pmb
Le 12 mai 05, à 22:38, Tom Lane a écrit : > "D.C." <coughlandesmond@yahoo.fr> writes: >> Thanks again, and may I now make the most of your generosity by asking >> another question ? I got an error message when >> ./configuring postgreSQL, and now I find that I don't have 'history', >> and I can't use the 'up' arrow to cycle through previous commands. >> The >> error was about 'readline', I think. > > Yup, you need libreadline to support that. > >> The installation I use is on an iBook, which might sound mad, but I >> want a version to be able to take everywhere with me, and learn whilst >> on the bus, in the train etc .. > > I use a Mac laptop too. Personally, I get the readline sources > (check freshmeat.net for a pointer) and build/install them in the > default way, which drops 'em in /usr/local. This is highly Not Mac > Approved I'm sure, but it gets the job done. You could no doubt also > get readline from the fink project, if you'd rather have something > prebuilt (but then again why are you building PG by hand if that's > what you want ...) Yep, that seems to work, thanks again !! Running it on my iBook is brilliant fun: as I don't need it all the time, a little 'wrapper' has gone into my $HOME/bin to 'su' start it up when I want to run psql ... I in fact was trained on oracle years ago when I worked in IT, but got bored and walked out after two days. Now a friend wants to start up a small business, and I quite fancy setting up her DB with a perl-generated webpage, to allow her to track customers, materials etc. She's not ready to take the plunge yet, and I'm just doing it for fun -- and having loads of fun at the same time ! D.