I am restoring a database which I rather hastily did not pg_dump, I merely tarred the data files themselves. The data files are too old (8.1) to load into the postgres on the machine I am bringing them to, so I compiled (fc14) and installed postgres 8.1 in order to load them in and pg_dump them, to get a dump file to restore in the new db installation.

Everything was going well until I tried to see the data. That is, I start the postmaster with pg_ctl start -D /mypath/mydata and get 'postmaster starting', the server is running and I can connect to it. It's just that the database I expected to see is not there. Attempting to connect to that database tells me it does not exist.

postgres=# \dn
    List of schemas
    Name        |  Owner   
 information_schema | postgres
 pg_catalog         | postgres
 pg_toast           | postgres
 public             | postgres
(4 rows)

postgres=# \c ridenetdb
FATAL:  database "ridenetdb" does not exist
Previous connection kept

The only thing I touched in the data files was something called pg_hba.conf, I set all connections to 'trust'. Am I just missing something perhaps, or is this a lost cause?

  • Probably you should try dba.stackexchange.com as well. – Jamess Jun 16 '11 at 15:31

You might want to check these things:

  • Postgres data files are not architecture independent - are you running the same architecture as the original host (virtualization is your friend)
  • Postgres data files only work within the same version. Just to be sure get the exactly same version although I believe patchlevel version changes should be compatible

Sorry for the bother - it turned out I had backed up the wrong data tree, so naturally the db wasn't there. Fortunately, that sinking feeling I got when I realized this went away a few minutes later when I discovered I had actually made a text dump of the data anyway. I really need to be more organized...

Just so that this adventure wasn't a total waste of time, I did find out one tidbit that might be useful for anyone drawn to click this question: in the data tree, the file /global/pg_database is a little text file which shows the names of the databases contained.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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