[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: upgrading to postgresql 7.1



On Tue, May 22, 2001 at 10:36:46AM +1000, Brian May wrote:
> >>>>> "Petr" == Petr Cech <cech@atrey.karlin.mff.cuni.cz> writes:
> 
>     Petr> yes. dump. purge. install. reload - there are IMHO way too
>     Petr> much possible configurations to can safely do this
>     Petr> automaticaly. And that's what is the .deb also trying to do
>     Petr> - automaticaly. So do it by hand and you're OK.
> 
> How do you dump a 7.0 database? I keep getting memory errors generated
> by the old server all the time. (maybe I am not starting it correctly? 
> It is the copy stored in /var/lib/postgresql/dumpall/7.0/)

    I've attached the backup script I use to do dumps, which works
mostly because I only have a few different users that actually need
postgres access (my method would become a major nuisance with more
than half a dozen or so).  I do restores manually.  The script has
been tested on 7.0 and 7.1 (the grep -v template0 is a 7.1 specific
thing I added), and should work on pretty much any older version,
though I do miss pg_dumpall.


> How do you import the new database into 7.1?  I tried psql, but
> without success. Will try it again when I know the answers to the
> above (at least the 2nd one).

    su to postgres first, then recreate accounts for all the users that
you had before (if someone knows a decent way to do this
automatically, please let me know).  Set your pg_hba.conf to blind
trust mode.  Do a createdb -U <username> <database> for each
database.  Do psql -f <dumpfile> <database> for each dump.

-- 
Zed Pobre <zed@debian.org> a.k.a. Zed Pobre <zed@resonant.org>
PGP key and fingerprint available on finger; encrypted mail welcomed.
#!/bin/sh
#
for a in `/usr/bin/psql template1 -l -t | grep -v template0 | /usr/bin/cut -d ' ' -f 2` ; do
  rm -f data_backup-$a-`/bin/date +%Y%m%d`
  pg_dump $a >> data_backup-$a-`/bin/date +%Y%m%d`
done

Attachment: pgpBzpkrE2_TJ.pgp
Description: PGP signature


Reply to: