Re: recovering database from a linux file system

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Alka Gupta <alka(dot)gupta(at)broadcom(dot)com>, John R Pierce <pierce(at)hogranch(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: recovering database from a linux file system
Date: 2016-03-10 20:58:29
Message-ID: 56E1DFF5.5020509@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 03/10/2016 12:25 PM, Alka Gupta wrote:
> Thank you John!
>
> Do you know if there is any encryption or security or will plainly copying
> the files will work? Do I need to know any db usernames and passwords, which
> obviously I don't have?

The files should not be encrypted. There will be database usernames and
possibly passwords. I would assume the usual default superuser name
postgres. To get around the password see pg_hba.conf:

http://www.postgresql.org/docs/9.5/interactive/auth-pg-hba-conf.html

In particular you want the below at the top of the entries, assuming you
are connecting on from the same machine as the server:

local all all trust

The above says just trust anyone connecting over the local socket.
Assuming you get in then:

\du postgres
role name | Attributes | Member of
-----------+------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication | {}

to verify you are superuser and then:

select * from pg_shadow ;

to see the users and whether they have passwords.

>
>
>
> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of John R Pierce
> Sent: Thursday, March 10, 2016 12:10 PM
> To: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] recovering database from a linux file system
>
> On 3/10/2016 12:05 PM, Alka Gupta wrote:
>> The vendor won't give us any way to access the machine and retrieve
>> the DB, so I removed the HDD and connected it to my Linux laptop. I
>> was able to grab all the DB files and copy them to my Windows desktop,
>> where I then installed PostgreSQL 9.0 (to match the version that was
>> on the server) with pgAdmin III. I changed the default directory to
>> the folder containing the DB files using this tutorial:
>> https://wiki.postgresql.org/wiki/Change_the_default_PGDATA_directory_o
>> n_Windows
>
>
> I would try installing postgres on linux, and try running it with a copy
> of this data directory. skip the pgadmin thing entirely as its just
> another layer of obfuscation, stick with CLI tools.
>
>
>
> --
> john r pierce, recycling bits in santa cruz
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2016-03-10 20:59:58 Re: pg_restore without dropping db/table
Previous Message Karsten Hilbert 2016-03-10 20:53:55 Re: pg_restore without dropping db/table