Re: Recover PostgreSQL database folder data

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Edson Lidorio <edson(at)openmailbox(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: Recover PostgreSQL database folder data
Date: 2017-04-22 00:23:39
Message-ID: 116d4769-4277-9491-a13f-67d53c7aa8d9@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 04/21/2017 04:20 PM, Edson Lidorio wrote:
>
>
> On 21-04-2017 18:13, Edson Lidorio wrote:
>>
>>
>> On 21-04-2017 18:02, Adrian Klaver wrote:
>>> Chown -R postgres: postgres /var/lib/pgsql/9.6/data
>> After the command, I have the errors:
>>
>> Apr 21 18:11:41 localhost postgresql96-check-db-dir:
>> "/var/lib/pgsql/9.6/data/" is missing or empty.
>> Apr 21 18:11:41 localhost postgresql96-check-db-dir: Use
>> "/usr/pgsql-9.6/bin/postgresql96-setup initdb" to initialize the
>> database cluster.
>> Apr 21 18:11:41 localhost postgresql96-check-db-dir: See
>> /usr/share/doc/postgresql96/README.rpm-dist for more information.
>> Apr 21 18:11:41 localhost systemd: postgresql-9.6.service: control
>> process exited, code=exited status=1
>> Apr 21 18:11:41 localhost systemd: Failed to start PostgreSQL 9.6
>> database server.
>> Apr 21 18:11:41 localhost systemd: Unit postgresql-9.6.service entered
>> failed state.
>> Apr 21 18:11:41 localhost systemd: postgresql-9.6.service failed.
>>
> Follows all the results:
>
> What does the directory listing for /var/lib/pgsql/9.6/data show?
> [root(at)localhost data]# pwd
> /var/lib/pgsql/9.6/data
>
>
> Ls -la /var/lib/pgsql/9.6/data
>
> drwx------. 20 postgres postgres 4096 Abr 21 17:52 .
> drwx------. 4 root root 51 Abr 21 06:33 ..
> -rw-------. 1 postgres postgres 0 Abr 21 06:33 ArquivoASerCriado.dmp
> drwx------. 44 postgres postgres 4096 Abr 21 06:32 base
> drwx------. 2 postgres postgres 4096 Abr 21 06:32 global
> drwx------. 2 postgres postgres 18 Abr 21 06:32 pg_clog
> drwx------. 2 postgres postgres 6 Abr 21 06:32 pg_commit_ts
> drwx------. 2 postgres postgres 6 Abr 21 06:32 pg_dynshmem
> -rw-------. 1 postgres postgres 4345 Abr 21 06:33 pg_hba.conf
> -rw-------. 1 postgres postgres 1636 Abr 21 06:33 pg_ident.conf
> drwx------. 2 postgres postgres 188 Abr 21 06:32 pg_log
> drwx------. 4 postgres postgres 39 Abr 21 06:32 pg_logical
> drwx------. 4 postgres postgres 36 Abr 21 06:32 pg_multixact
> drwx------. 2 postgres postgres 18 Abr 21 06:32 pg_notify
> drwx------. 2 postgres postgres 6 Abr 21 06:32 pg_replslot
> drwx------. 2 postgres postgres 6 Abr 21 06:32 pg_serial
> drwx------. 2 postgres postgres 6 Abr 21 06:32 pg_snapshots
> drwx------. 2 postgres postgres 4096 Abr 21 06:32 pg_stat
> drwx------. 2 postgres postgres 6 Abr 21 06:32 pg_stat_tmp
> drwx------. 2 postgres postgres 18 Abr 21 06:32 pg_subtrans
> drwx------. 2 postgres postgres 84 Abr 21 06:32 pg_tblspc
> drwx------. 2 postgres postgres 6 Abr 21 06:32 pg_twophase
> -rw-------. 1 postgres postgres 4 Abr 21 06:33 PG_VERSION
> drwx------. 3 postgres postgres 4096 Abr 21 06:33 pg_xlog
> -rw-------. 1 postgres postgres 88 Abr 21 06:33 postgresql.auto.conf
> -rw-------. 1 postgres postgres 22289 Abr 21 06:33 postgresql.conf
> -rw-------. 1 postgres postgres 60 Abr 21 06:33 postmaster.opts
>
> Ensure you actually have a folder named "/var/lib/pgsql/9.6/data" with your
> database in it (not, possibly, a folder named "date" per your original
> message).
>
> [root(at)localhost 9.6]# du -hs *
> 0 backups
> 4,2G data
> 4,0K initdb.log
>
> chown -R postgres:postgres /var/lib/pgsql/9.6/data
>
> systemctl start postgresql-9.6.service
> Job for postgresql-9.6.service failed because the control process exited
> with error code. See "systemctl status postgresql-9.6.service" and
> "journalctl -xe" for details.
>
> restorecon -R /var/lib/pgsql/9.6/data
>
> Apr 21 19:11:58 localhost systemd: Starting PostgreSQL 9.6 database
> server...
> Apr 21 19:11:58 localhost postgresql96-check-db-dir:
> "/var/lib/pgsql/9.6/data/" is missing or empty.
> Apr 21 19:11:58 localhost postgresql96-check-db-dir: Use
> "/usr/pgsql-9.6/bin/postgresql96-setup initdb" to initialize the
> database cluster.
> Apr 21 19:11:58 localhost postgresql96-check-db-dir: See
> /usr/share/doc/postgresql96/README.rpm-dist for more information.
> Apr 21 19:11:58 localhost systemd: postgresql-9.6.service: control
> process exited, code=exited status=1
> Apr 21 19:11:58 localhost systemd: Failed to start PostgreSQL 9.6
> database server.
> Apr 21 19:11:58 localhost systemd: Unit postgresql-9.6.service entered
> failed state.
> Apr 21 19:11:58 localhost systemd: postgresql-9.6.service failed.
>
>
> If it still won't start after that, please do an "ls -alRZ
> /var/lib/pgsql/9.6", pastebin the output, and send the link.
>
> Download Link: http://myaccount.dropsend.com/file/2714afb84f8ecadd

Found postgresql96-check-db-dir in the RPM, it looks straight forward
and should not be failing from what I see.

>
>

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Cat 2017-04-22 01:05:46 Re: Recover PostgreSQL database folder data
Previous Message Edson Lidorio 2017-04-22 00:19:56 Re: Recover PostgreSQL database folder data