Take the 2-minute tour ×
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. It's 100% free, no registration required.

I'm going to warn you that whoever explains this needs to talk to me like I'm five years old, because this is something way, way beyond my level of expertise.

In short, I have what I think is a PostgreSQL dump file that someone sent me, and I need to be able to open it up to extract the information. I was expecting a simple tabular format (such as an Excel spreadsheet), but I got something way more complicated (a .backup file). I know how to run some basic SQL queries, but I think whoever sent this to me strongly overestimated my knowledge of database programs. Could someone give me a very, very, VERY simple, completely 110% spoon-fed explanation on how to open this?

(As an aside, I know the person who sent this to me and I know the nature of the file, so I know it's not something completely different.)

share|improve this question
add comment

migrated from stackoverflow.com Mar 12 '12 at 12:26

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

2 Answers

You cannot just "open" a database backup. You have to restore the database. For this, you first need to install PostgreSQL. The latest version should be capable of taking backups from older versions, too. But older version may have problems with newer features in the backup. So your version should be at least as recent as the source.

How you install PostgreSQL depends on your OS that you cunningly kept a secret. In Debian it's basically a matter of:

apt-get install postgresql-8.4

(Or you take postgresql-9.1 from the backports.)

Depending on the format (there are various) you can then restore the backup. If the backup holds a complete database cluster (produced with pg_dumpall - ask your friend!), you can simply:

psql postgres -f /path/tp/file.sql

To view the data you would best use a GUI like pgAdmin. Or you learn how to use SQL. :)

For more advise you would need to provide more information. Like a short(!) sample of the backup and how it was produced.

For more about PostgreSQL start by reading the manual or one of the thousand pages on the web.

But really, your friend should just export the relevant data do a CSV file that you can open in Open Office Calc or some other spreadsheet application. Or even any text editor.

share|improve this answer
I know that I had to install PostgreSQL. I did that, but I didn't have the slightest clue what to do after that. I read the help files, but I just kept spinning my wheels, because I really had no idea what I was doing. My OS is Windows 7. As for version, I think the thing I'm trying to restore is 8.4, but I was using 9.1. Does that matter? Should I just download an older version? As for a sample of the backup, I can't do that. The information is confidential. And, I wouldn't really call this person a friend. He's a co-worker, and it's not even my job to know how to do this! –  Yikes Mar 12 '12 at 12:54
@Yikes: PostgreSQL 9.1 should be fine for a backup from 8.4. –  Erwin Brandstetter Mar 12 '12 at 12:58
add comment

Since you don't show the content of the file I'm going to assume that it was created with the pg_dump command. If that's the case, you will see a lot of SQL-commands in it, such as CREATE TABLE, INSERT INTO and such (open it in any text-editor of your choice to find out).

If it's in this format, restoring it is simple but it would require atleast a tiny bit of knowledge that's above a five year old level.

In short you will need to load the file into a database, something like psql -a < backup_file and then dump it again in a better format for you, like tabular data.

But since this is just plain guesswork (we don't know what the backup file really is), I will stop here unwil you provide more information.

share|improve this answer
add comment

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.