Re: [GENERAL] Recover PostgreSQL database folder data

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: [GENERAL] Recover PostgreSQL database folder data
Дата
Msg-id e40d2779-c599-de4f-9aea-2ec607f3f756@aklaver.com
обсуждение исходный текст
Ответ на Re: [GENERAL] Recover PostgreSQL database folder data  (Edson Lidorio <edson@openmailbox.org>)
Ответы Re: [GENERAL] Recover PostgreSQL database folder data
Re: [GENERAL] Recover PostgreSQL database folder data
Список pgsql-general
On 04/21/2017 10:09 AM, Edson Lidorio wrote:
>
>
> On 21-04-2017 13:48, Adrian Klaver wrote:
>> On 04/21/2017 09:40 AM, Edson Lidorio wrote:
>>> Hi,
>>> There was a disaster in my development note. I was able to recover the
>>> data folder. PostgreSQL 9.6.2, was installed in Centos 7.
>>>
>>> Here are the procedures I'm trying to initialize Postgresql for me to do
>>> a backup.
>>>
>>> 1- I installed PostgreSQL 9.6.2 on a VM with Centos 7.
>>> 2- I stopped the PostgreSQL service: sudo systemctl stop postgresql-9.6
>>> 3- I renamed the /var/lib/pgsql/9.6/data folder to date data_old and
>>> copied the old date folder
>>> 4- I gave permission in the folder date:
>>>      sudo chown postgres: postgres /var/lib/pgsql/9.6/data;
>>>      sudo chmod 700 /var/lib/pgsql/9.6/data
>>> 5 - I tried to start the service: sudo systemctl start postgresql-9.6
>>> It is generating the following errors:
>>>
>>> Abr 21 01:25:35 localhost.localdomain systemd[1]: Starting PostgreSQL
>>> 9.6 database server...
>>> Abr 21 01:25:36 localhost.localdomain postgresql96-check-db-dir[19996]:
>>> cat: /var/lib/pgsql/9.6/data//PG_VER…ada
>>> Abr 21 01:25:36 localhost.localdomain postgresql96-check-db-dir[19996]:
>>> cat: /var/lib/pgsql/9.6/data//PG_VER…ada
>>> Abr 21 01:25:36 localhost.localdomain systemd[1]:
>>> postgresql-9.6.service: control process exited, code=ex...us=1
>>> Abr 21 01:25:36 localhost.localdomain systemd[1]: Failed to start
>>> PostgreSQL 9.6 database server.
>>> Abr 21 01:25:36 localhost.localdomain systemd[1]: Unit
>>> postgresql-9.6.service entered failed state.
>>> Abr 21 01:25:36 localhost.localdomain systemd[1]: postgresql-9.6.service
>>> failed.
>>> Hint: Some lines were ellipsized, use -l to show in full.
>>
>> What do you see if you do the above, add -l to the systemctl command?
> ● postgresql-9.6.service loaded failed failed    PostgreSQL 9.6 database
> server
>>
>> What does the system log show?
>> Apr 21 04:01:01 localhost systemd: Started Session 53 of user root.
>> Apr 21 04:01:01 localhost systemd: Starting Session 53 of user root.
>> Apr 21 04:01:48 localhost systemd: Starting PostgreSQL 9.6 database
>> server...
>> Apr 21 04:01:48 localhost postgresql96-check-db-dir: cat:
>> /var/lib/pgsql/9.6/data//PG_VERSION: Permissão negada
>> Apr 21 04:01:48 localhost postgresql96-check-db-dir: cat:
>> /var/lib/pgsql/9.6/data//PG_VERSION: Permissão negada

So you got a permissions error when the script was trying to read
PG_VERSION.

The suspicious part is this:
/var/lib/pgsql/9.6/data//PG_VERSION

in particular the //

Is that really the case?


>> Apr 21 04:01:48 localhost postgresql96-check-db-dir: An old version of
>> the database format was found.
>> Apr 21 04:01:48 localhost postgresql96-check-db-dir: You need to dump
>> and reload before using PostgreSQL 9.6.
>> Apr 21 04:01:48 localhost postgresql96-check-db-dir: See
>> /usr/share/doc/postgresql96/README.rpm-dist for more information.

Have to believe the above is a consequence of the permissions error. In
the event it is not:

1) What are the contents of PG_VERSION for data_old versus data?

2) Did you use the same repos in the VM that you used in the original
machine?

>> Apr 21 04:01:48 localhost systemd: postgresql-9.6.service: control
>> process exited, code=exited status=1
>> Apr 21 04:01:48 localhost systemd: Failed to start PostgreSQL 9.6
>> database server.
>> Apr 21 04:01:48 localhost systemd: Unit postgresql-9.6.service entered
>> failed state.
>> Apr 21 04:01:48 localhost systemd: postgresql-9.6.service failed.
>> Apr 21 04:02:07 localhost gnome-session: (nautilus:17753): Gtk-WARNING
>> **: gtk_widget_size_allocate(): attempt to allocate widget with width
>> -15 and height 34
>> Apr 21 04:02:57 localhost gnome-session: (nautilus:17753): Gtk-WARNING
>> **: gtk_widget_size_allocate(): attempt to allocate widget with width
>> -15 and height 34
>> Apr 21 04:03:00 localhost gnome-session: (nautilus:17753): Gtk-WARNING
>> **: gtk_widget_size_allocate(): attempt to allocate widget with width
>> -15 and height 34
>>
>>
>>>
>>>
>>>
>>
>>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: [GENERAL] pg_basebackup ----xlog-method=stream
Следующее
От: John R Pierce
Дата:
Сообщение: Re: [GENERAL] Recover PostgreSQL database folder data