Upgrading PostgreSQL to 8.3

This post started off as a database move but a software upgrade got in the way.

I tried this move before, but failed to notice that the cvs-all subscription was not correct. This was a combination of DNS and subscription issues. They are now fixed.

Let us try moving the database now.

$ time pg_dump freshports.org | gzip >  freshports.sql.gz

real    21m29.016s
user    5m41.054s
sys     0m14.680s

While that was going on, I noticed the production server was running PostgreSQL 8.2. I upgraded the client and server to the latest versions of 8.2:

portupgrade postgresql-client postgresql-server

Then I upgraded the client to 8.3 (note: client, not server):

portupgrade -o databases/postgresql83-client postgresql-client

Then I dumped the production databases from the 8.2 server using the 8.3 client:

pg_dumpall -f dumpall.sql

I then upgraded the server:

/usr/local/etc/rc.d/postgresql stop
portupgrade -o databases/postgresql83-server postgresql-server

When that was done, I moved the old PostgreSQL data directory out of the way, so I could do an initdb, and then start the production server.

cd /usr/local/pgsql
mv data data.8.2.9
/usr/local/etc/rc.d/postgresql initdb
/usr/local/etc/rc.d/postgresql start

I also upgraded the docs and contrib modules:

portupgrade postgresql-contrib postgresql-docs

The database loading was simple:

su - pgsql
psql -f dumpall.sql postgres

That has the PostgreSQL server upgraded to 8.3.3.

Now for installing the latest version of the FreshPorts database:

$ time psql -f freshports.sql freshports.org.new > loading.txt 2>&1

real    14m5.820s
user    0m14.076s
sys     0m13.007s

That went well. But now I’m out of time. :)

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top