Re: Recover PostgreSQL database folder data

From: Edson Lidorio <edson(at)openmailbox(dot)org>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Recover PostgreSQL database folder data
Date: 2017-04-22 00:19:56
Message-ID: 6df29a7e-e2d5-4cb7-b137-131104550879@openmailbox.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 21-04-2017 20:55, Adrian Klaver wrote:
> On 04/21/2017 04:20 PM, Edson Lidorio wrote:
>>
>>
>> On 21-04-2017 18:13, Edson Lidorio wrote:
>
>> 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
>
> Not sure it applies here, but I see that in the above file you have
> tablespace links.
>
> Are those tablespaces actually there?
>
> Can you find postgresql96-check-db-dir and see what it is looking for?
>
>>
>>
>
>
The tablespace exists I have restored in the same directory that was
/var/tablespace_pgsql
chown -R postgres:postgres /var/tablespace_pgsql/
chmod 700 /var/tablespace_pgsql/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2017-04-22 00:23:39 Re: Recover PostgreSQL database folder data
Previous Message Periko Support 2017-04-22 00:14:06 Strange Issue between PSQL 9.3 and Label Zebra Printer?