Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My hard drive crashed yesterday, luckily I had a back up. I didn't restore from backup though cause I needed a fresh system anyways. However there was a development database I would like back.

Is there a way to grab an old database file from my back up and somehow get that database onto my new localhost?

share|improve this question

migrated from Jul 2 '13 at 8:13

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

When you say back up, do you mean a formatted back up as in the kind produced by pg_dump or an actual copy of the files in the pg_data folder?

If pg_dump, then you can restore using pg_restore or the in the UI using PGAdmin.

If pg_data folder, then you can install a new instance of Postgres and drop the pg_data folder from the old version in the same place where the new version is (but first stop the postmaster process and rename the new version of pg_data to pg_data_old first). As long as the major version numbers are the same, when you restart the postmaster process, it will read the data and log files and config files just fine (unless you have some special circumstances that I don't know about).

share|improve this answer
Yes I mean an actual copy of the files. How do I stop and start the postmaster process? I am very new to PSQL – Deekor Jul 2 '13 at 17:05
Which operating system are you using and which version? Also, are you using a command line or a UI? – efesar Jul 2 '13 at 17:23
Mac OS. I use the psql shell – Deekor Jul 2 '13 at 17:46
Also where is the pg_data folder typically located? – Deekor Jul 2 '13 at 17:49
I would recommend using PGAdmin for doing backups and restores: ... As for pg_data, it's in the root of your PostgreSQL installation folder. I don't know where it resides in OSX, but in many *NIX installations, it's in /var/pgsql/pg_data ... – efesar Jul 2 '13 at 17:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.