I had a hard disk crash recently (Those IBM 45Gb drives again) and had to
reinstall Linux (RedHat 7.2) on the new disk (Seagate)

My question is - how can I tell PostgreSQL (which I've obviously had to
reinstall) to look at my existing database which was mounted on another
volume and is still intact.?.  In other words- Can you tell a
freshly-installed PostgreSQL to use an existing (same version) database?

Thanks In Advance

Peter, Sydney Australia



Tue, 15 Jan 2002 09:42:37 GMT
"Peter Bayley" <peterb@homer.com.au>
Recovering a database

Peter Bayley <peterb@homer.com.au> wrote in message
news:hQS08.1234$gf1.7634@news-server.bigpond.net.au...
> I had a hard disk crash recently (Those IBM 45Gb drives again) and had to
> reinstall Linux (RedHat 7.2) on the new disk (Seagate)
>
> My question is - how can I tell PostgreSQL (which I've obviously had to
> reinstall) to look at my existing database which was mounted on another
> volume and is still intact.?.  In other words- Can you tell a
> freshly-installed PostgreSQL to use an existing (same version) database?
>
> Thanks In Advance
>
> Peter, Sydney Australia
>

Peter,
    I have not tried this but it is mentioned in the install docs that you
can set and environment variable PGDATA2 I beleive, and this will make
postgres look for the second data directory. I recommend searching for
environment variables in the docs at postgres.org.

Steve..




Tue, 15 Jan 2002 12:33:54 GMT
"Steve Spencer" <stevenspencer@ozemail.com.au>
Re: Recovering a database
"Peter Bayley" <peterb@homer.com.au> writes:

> I had a hard disk crash recently (Those IBM 45Gb drives again) and had to
> reinstall Linux (RedHat 7.2) on the new disk (Seagate)
> 
> My question is - how can I tell PostgreSQL (which I've obviously had to
> reinstall) to look at my existing database which was mounted on another
> volume and is still intact.?.  In other words- Can you tell a
> freshly-installed PostgreSQL to use an existing (same version) database?

Sure--set PGDATA appropriately before starting the postmaster.  See
the docs.

BTW, this would have been better posted to GENERAL rather than
HACKERS.

-Doug
-- 
Let us cross over the river, and rest under the shade of the trees.
   --T. J. Jackson, 1863

18 Jan 2002 14:47:15 -0500
Doug McNaught <doug@wireboard.com>
Re: Recovering a database
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> > My question is - how can I tell PostgreSQL (which I've obviously had to
> > reinstall) to look at my existing database which was mounted on another
> > volume and is still intact.?.  In other words- Can you tell a
> > freshly-installed PostgreSQL to use an existing (same version) database?

> Peter,
>     I have not tried this but it is mentioned in the install docs that you
> can set and environment variable PGDATA2 I beleive, and this will make
> postgres look for the second data directory. I recommend searching for
> environment variables in the docs at postgres.org.

I would think that more than that, you just want to tell postgres to use that 
directory as the data directory.  When you start postgres you can specify the 
data dir with the -D argument.  If you are using the redhat RPMS, then 
postgres is probably started by /etc/init.d/postgres script.  You can look in 
there, find the line that starts postgres, or sets the variable, and then 
startup postgres.  I assume the old data dir is the same major version of 
postgres (7.1.x).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8SIDA8BXvT14W9HARAt+lAJ9ORQioRifTLcQWj7MrGh/ALC6OvgCfWyKk
twSYblpdOM1GfM4gCA0I6Bc=
=Z2Uv
-----END PGP SIGNATURE-----

Fri, 18 Jan 2002 14:08:27 -0600
"Matthew T. O'Connor" <matthew@zeut.net>
Re: Recovering a database