Thread: Recovering a database
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 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..
"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
-----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-----