Re: BUG #15213: unable to login on PostgreSQL by postgres user

From: dhirendra Singh <dhirendra04(at)hotmail(dot)com>
To: Arthur Zakirov <a(dot)zakirov(at)postgrespro(dot)ru>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #15213: unable to login on PostgreSQL by postgres user
Date: 2018-05-29 10:31:44
Message-ID: PN1PR0101MB15352CBFB6CE94BE6A1B4BFDA06D0@PN1PR0101MB1535.INDPRD01.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


Thanks for the update,
you are correct, /12950 is not available in /var/lib/pgsql/9.3/data/base also I do not have the database server or DB backup to restore it.
do I need to create new Postgres DB to resolve it or I need to follow any other step?

FYI, due to a space issue on default (/var/lib/pgsql/9.3) location of DB, I had tried to change data directory location of PostgreSQL and followed below step to change location but to verify data directory location I need to log in by user (postgres) to run (show data_directory) which is not possible due to original error posted in request 😞

1. Step : stope postgresql service $ sudo systemctl stop postgresql-9.3 and verify by command sudo systemctl status postgresql-9.3

2. Created new directory/ location for db data ($ sudo mkdir postgresql)

3. Sudo chown postgres:postgres postgresql

4. Then copy all data by command (sudo rsync -av /var/lib/pgsql/9.3/data /opt/postgresql/)

5. Login with (sudo –u postgres –i) on server

1. Open (vim /opt/postgresql/data/postgresql.conf)
2. Connented out (#data_directory = 'ConfigDir')
3. Added new line below above line (data_directory = '/opt/postgresql/data')

6. Updated (sudo vim /usr/lib/systemd/system/postgresql-9.3.service) by adding (Environment=PGDATA=/opt/postgresql/data) line below line and commented line (#Environment=PGDATA=/var/lib/pgsql/9.3/data/)

7. unable to run show data_directory to verify data directory location due to below error same error

psql: FATAL: database "postgres" does not exist
DETAIL: The database subdirectory "base/12950" is missing.

Regards,
Dhirendra Singh| 91-9902074990

________________________________
From: Arthur Zakirov <a(dot)zakirov(at)postgrespro(dot)ru>
Sent: Tuesday, May 29, 2018 1:53 PM
To: dhirendra04(at)hotmail(dot)com; pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15213: unable to login on PostgreSQL by postgres user

Hello,

On Tue, May 29, 2018 at 07:32:38AM +0000, PG Bug reporting form wrote:
> [dhirsing(at)jira-stg ~]$ sudo -u postgres psql postgres
> [sudo] password for dhirsing:
> could not change directory to "/home/dhirsing"
> psql: FATAL: database "postgres" does not exist
> DETAIL: The database subdirectory "base/12950" is missing.

I think you missed postgres database directory. Can you check using a
file manager if the directory "base/12950" exists in your PGDATA?

If it is lost the only way is to restore your instance from a backup.

--
Arthur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Arthur Zakirov 2018-05-29 11:05:04 Re: BUG #15213: unable to login on PostgreSQL by postgres user
Previous Message PG Bug reporting form 2018-05-29 09:18:26 BUG #15214: Pg 10.4 windows 64 bit installer is 32 bit