On Sat, 2002-08-03 at 22:53, Johnson, Shaunn wrote:
>
> --Howdy
>
> --I'm looking at the page for restoration and I'm having a few
> problems.
>
> --In the docs, it suggest that I do the cat file* | psql database,
> but I get other errors with using the cat command
>
> [snip error]
> bash: /bin/cat: Argument list too long
You could say:
for f in file*
do
psql -d database < $f
done
or
ls file* | xargs cat | psql -d database
but how do you come to have so many files defining the structure and
contents of a single database? That looks very odd to me. Or did you
just split it into too small chunks? (You should have used something
like "split -b 1900m" to make 1.9Gb chunks.)
> [/snip error]
>
> --I'm trying to do something like `ls -1` files* | psql database
> and I'm not getting any successful messages.
1. That should be `ls -l files*` with the backticks enclosing the whole
command. (You had file* above - which is right?)
2. That would feed the output of ls -l into psql, which is not at all
what you want to do - it is a long directory listing, not SQL.
> --I got a few other errors ... I supposed I was thinking
> that the system files from before would be save and I wouldn't
> have to create those by hand (users, groups, etc).
If this is for a database upgrade, you should be using pg_dumpall to
dump all databases at once, and the users and groups as well. (Then
don't specify the database to psql when you restore.)
> --I know this seems silly, but, why can't I copy the original
> files back to the database directory after I've upgraded
> postgres? doesn't that give you most of the same things
> (OID, system files, users, etc ... )?
pg_upgrade lets you do this, but its status is somewhat experimental.
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"I am crucified with Christ, nevertheless I live; yet
not I, but Christ liveth in me; and the life which I
now live in the flesh I live by the faith of the Son
of God, who loved me, and gave himself for me."
Galatians 2:20