Thread: Recovering db from cracked server

Recovering db from cracked server

From
"Don Doumakes"
Date:
I own a server that was recently cracked by, I presume, an incompetent
script kiddie.  Minutes after he bravely tagged the web site, the
server went down hard and would not boot.  I've built a new system.

I need to recover a postgresql 7.2 database from the old hard drive,
which is still readable.  The postgresql data directory is intact.  The
latest version of postgresql is incompatible with 7.2.x, so I compiled
postgresql-7.2.7 and attempted to run

  postgres -D copy_of_old_data_dir

The error response (on stdout) is

DEBUG:  database system was shut down at 2005-02-20 21:54:33 CST
DEBUG:  checkpoint record is at 0/5CCA0AC
DEBUG:  redo record is at 0/5CCA0AC; undo record is at 0/0; shutdown
TRUE
DEBUG:  next transaction id: 73360; next oid: 59092
DEBUG:  database system is ready
FATAL 1:  Database "postgres" does not exist in the system catalog.
DEBUG:  shutting down
DEBUG:  database system is shut down


Am I close?  or is this approach doomed?  Suggestions gratefully
accepted.


Don Doumakes
Email: doumakes at loganet dot net
Do not reply to spamtrap@pinko.net


Re: Recovering db from cracked server

From
Richard Huxton
Date:
Don Doumakes wrote:
> I own a server that was recently cracked by, I presume, an incompetent
> script kiddie.  Minutes after he bravely tagged the web site, the
> server went down hard and would not boot.  I've built a new system.
>
> I need to recover a postgresql 7.2 database from the old hard drive,
> which is still readable.  The postgresql data directory is intact.  The
> latest version of postgresql is incompatible with 7.2.x, so I compiled
> postgresql-7.2.7 and attempted to run
>
>   postgres -D copy_of_old_data_dir
>
> The error response (on stdout) is
>
> DEBUG:  database system was shut down at 2005-02-20 21:54:33 CST
> DEBUG:  checkpoint record is at 0/5CCA0AC
> DEBUG:  redo record is at 0/5CCA0AC; undo record is at 0/0; shutdown
> TRUE
> DEBUG:  next transaction id: 73360; next oid: 59092
> DEBUG:  database system is ready
> FATAL 1:  Database "postgres" does not exist in the system catalog.
> DEBUG:  shutting down
> DEBUG:  database system is shut down
>
> Am I close?  or is this approach doomed?  Suggestions gratefully
> accepted.

You're close - the only thing it was complaining about was the missing
"postgres" database. That's because it defaults to using the same
database as the username. Try
   postgres -D copy_of_old_data_dir template1

Or use the name of your old database.

--
   Richard Huxton
   Archonet Ltd

Re: Recovering db from cracked server

From
Tom Lane
Date:
"Don Doumakes" <spamtrap@pinko.net> writes:
> latest version of postgresql is incompatible with 7.2.x, so I compiled
> postgresql-7.2.7 and attempted to run

>   postgres -D copy_of_old_data_dir

You probably wanted to say "postmaster" not "postgres".  The quoted
result is about what I'd expect from trying to run a standalone backend
with the wrong arguments ;-)

            regards, tom lane

Re: Recovering db from cracked server

From
"Don Doumakes"
Date:
Richard Huxton wrote:

> You're close - the only thing it was complaining about was the
missing
> "postgres" database. That's because it defaults to using the same
> database as the username. Try
>    postgres -D copy_of_old_data_dir template1
>
> Or use the name of your old database.

Woohoo!  Thanks a million; I've got my data back.

Don Doumakes
Email: doumakes at loganet.net
Do not reply to spamtrap@pinko.net