Thread: Uninstall postgresql 9.2 on red hat linux

Uninstall postgresql 9.2 on red hat linux

From
Thara Vadakkeveedu
Date:
Hi
I am new to postgresql. I have postgresql 9.2 installed on Red hat linux 6.4
I accidentally deleted data directory this morning (/var/lib/postgresql/9.2/data)
 
I tried to start posgresql 9.2 service
"service postgresql-9.2 start"
 
I got a message to initialize the db first.
 
so I ran "service postgresql-9.2 initdb"
 
This was successful.
 
Then I tried "service postgresql-9.2 start"
This failed.
 
pgstartup.log indicated I can start the database server using:
    /usr/pgsql-9.2/bin/postgres -D /var/lib/pgsql/9.2/data
or
    /usr/pgsql-9.2/bin/pg_ctl -D /var/lib/pgsql/9.2/data -l logfile start
However I  am unable to start the service as root.
 
That is the only account I use on this server. I am not aware of any other account on this server.
I tried  su - postgres
and then from the bash shell I tried to run these commands (tried one at a time)
but I got the message  that address was in use. There are no processes running on 5432.
 
How can I start postgres service?
 
Thanks,
TG

Re: Uninstall postgresql 9.2 on red hat linux

From
raghu ram
Date:

On Mon, Sep 23, 2013 at 5:27 AM, Thara Vadakkeveedu <tharagv@yahoo.com> wrote:
Hi
I am new to postgresql. I have postgresql 9.2 installed on Red hat linux 6.4
I accidentally deleted data directory this morning (/var/lib/postgresql/9.2/data)
 
I tried to start posgresql 9.2 service
"service postgresql-9.2 start"
 
I got a message to initialize the db first.
 
so I ran "service postgresql-9.2 initdb"
 
This was successful.
 
Then I tried "service postgresql-9.2 start"
This failed.
 
pgstartup.log indicated I can start the database server using:
    /usr/pgsql-9.2/bin/postgres -D /var/lib/pgsql/9.2/data
or
    /usr/pgsql-9.2/bin/pg_ctl -D /var/lib/pgsql/9.2/data -l logfile start
However I  am unable to start the service as root.
 
That is the only account I use on this server. I am not aware of any other account on this server.
I tried  su - postgres
and then from the bash shell I tried to run these commands (tried one at a time)
but I got the message  that address was in use. There are no processes running on 5432.
 
How can I start postgres service?
 


Could you please try to start the PostgreSQL Service using "postgres" user.

su - postgres

/usr/pgsql-9.2/bin/pg_ctl -D /var/lib/pgsql/9.2/data -l logfile start


Once you executed above commands,please share the output messages along with log file for further investigation.

Thanks & Regards,
Raghu Ram

Re: Uninstall postgresql 9.2 on red hat linux

From
Luca Ferrari
Date:
On Mon, Sep 23, 2013 at 1:57 AM, Thara Vadakkeveedu <tharagv@yahoo.com> wrote:

> I accidentally deleted data directory this morning
> (/var/lib/postgresql/9.2/data)
>

What a start of a day!

> I tried  su - postgres
> and then from the bash shell I tried to run these commands (tried one at a
> time)
> but I got the message  that address was in use. There are no processes
> running on 5432.


I suspect if it gives you such an error there must something bound to
the address. Have you tried to execute nmap against the IPv4 address
your server is listening on (or supposed to be listening on)?

Luca


Re: Uninstall postgresql 9.2 on red hat linux

From
Thara Vadakkeveedu
Date:
Hi,
I tried the following command. No luck.
# su - postgres
-bash-4.1$ /usr/pgsql-9.2/bin/pg_ctl -D /var/lib/pgsql/9.2/data -l logfile start
server starting
-bash-4.1$ pwd
/var/lib/pgsql/9.2
-bash-4.1$ vi pgstartup.log

The startup file is empty.
Can you please point me to the uninstaller ? This is a fairly new install. I don't have any data to save.
I'd like to uninstall and reinstall.

Thanks,
Thara.

From: raghu ram <raghuchennuru@gmail.com>
To: Thara Vadakkeveedu <tharagv@yahoo.com>
Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
Sent: Sunday, September 22, 2013 11:22 PM
Subject: Re: [NOVICE] Uninstall postgresql 9.2 on red hat linux


On Mon, Sep 23, 2013 at 5:27 AM, Thara Vadakkeveedu <tharagv@yahoo.com> wrote:
Hi
I am new to postgresql. I have postgresql 9.2 installed on Red hat linux 6.4
I accidentally deleted data directory this morning (/var/lib/postgresql/9.2/data)
 
I tried to start posgresql 9.2 service
"service postgresql-9.2 start"
 
I got a message to initialize the db first.
 
so I ran "service postgresql-9.2 initdb"
 
This was successful.
 
Then I tried "service postgresql-9.2 start"
This failed.
 
pgstartup.log indicated I can start the database server using:
    /usr/pgsql-9.2/bin/postgres -D /var/lib/pgsql/9.2/data
or
    /usr/pgsql-9.2/bin/pg_ctl -D /var/lib/pgsql/9.2/data -l logfile start
However I  am unable to start the service as root.
 
That is the only account I use on this server. I am not aware of any other account on this server.
I tried  su - postgres
and then from the bash shell I tried to run these commands (tried one at a time)
but I got the message  that address was in use. There are no processes running on 5432.
 
How can I start postgres service?
 


Could you please try to start the PostgreSQL Service using "postgres" user.

su - postgres

/usr/pgsql-9.2/bin/pg_ctl -D /var/lib/pgsql/9.2/data -l logfile start


Once you executed above commands,please share the output messages along with log file for further investigation.

Thanks & Regards,
Raghu Ram


Re: Uninstall postgresql 9.2 on red hat linux

From
Thara Vadakkeveedu
Date:
There are no processes belonging to postgres on the system.
-bash-4.1$ ps -edf | grep postgres
root      6412  6249  0 18:22 pts/0    00:00:00 su - postgres
postgres  6413  6412  0 18:22 pts/0    00:00:00 -bash
root      6781  6756  0 20:35 pts/1    00:00:00 su - postgres
postgres  6782  6781  0 20:35 pts/1    00:00:00 -bash
postgres  6846  6782  1 20:45 pts/1    00:00:00 ps -edf
postgres  6847  6782  0 20:45 pts/1    00:00:00 grep postgres
-bash-4.1$
Thanks,
TG



From: Luca Ferrari <fluca1978@infinito.it>
To: Thara Vadakkeveedu <tharagv@yahoo.com>
Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
Sent: Monday, September 23, 2013 2:41 AM
Subject: Re: [NOVICE] Uninstall postgresql 9.2 on red hat linux

On Mon, Sep 23, 2013 at 1:57 AM, Thara Vadakkeveedu <tharagv@yahoo.com> wrote:

> I accidentally deleted data directory this morning
> (/var/lib/postgresql/9.2/data)
>

What a start of a day!

> I tried  su - postgres
> and then from the bash shell I tried to run these commands (tried one at a
> time)
> but I got the message  that address was in use. There are no processes
> running on 5432.


I suspect if it gives you such an error there must something bound to
the address. Have you tried to execute nmap against the IPv4 address
your server is listening on (or supposed to be listening on)?

Luca


Re: Uninstall postgresql 9.2 on red hat linux

From
Thara Vadakkeveedu
Date:
I tried starting postgres using the main configuration file. I get "not a directory" message...

-bash-4.1$ /usr/pgsql-9.2/bin/postgres -D /var/lib/pgsql/9.2/data/postgresql.conf

postgres cannot access the server configuration file "/var/lib/pgsql/9.2/data/postgresql.conf/postgresql.conf": Not a directory

-bash-4.1$ ls -al
...
...
drwx------.  3 postgres postgres  4096 Sep 22 12:20 pg_xlog
-rw-------.  1 postgres postgres 19601 Sep 22 11:35 postgresql.conf
-rw-------   1 postgres postgres    59 Sep 23 20:35 postmaster.opts
-bash-4.1$ /usr/pgsql-9.2/bin/postgres -D /var/lib/pgsql/9.2/data/postgresql.conf
postgres cannot access the server configuration file "/var/lib/pgsql/9.2/data/postgresql.conf/postgresql.conf": Not a directory

-bash-4.1$ chmod 755 postgresql.conf

-bash-4.1$ /usr/pgsql-9.2/bin/postgres -D /var/lib/pgsql/9.2/data/postgresql.conf
postgres cannot access the server configuration file "/var/lib/pgsql/9.2/data/postgresql.conf/postgresql.conf": Not a directory

-bash-4.1$
-bash-4.1$ pwd
/var/lib/pgsql/9.2/data

Thanks,
Thara.


From: Thara Vadakkeveedu <tharagv@yahoo.com>
To: Luca Ferrari <fluca1978@infinito.it>
Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
Sent: Monday, September 23, 2013 8:45 PM
Subject: Re: [NOVICE] Uninstall postgresql 9.2 on red hat linux

There are no processes belonging to postgres on the system.
-bash-4.1$ ps -edf | grep postgres
root      6412  6249  0 18:22 pts/0    00:00:00 su - postgres
postgres  6413  6412  0 18:22 pts/0    00:00:00 -bash
root      6781  6756  0 20:35 pts/1    00:00:00 su - postgres
postgres  6782  6781  0 20:35 pts/1    00:00:00 -bash
postgres  6846  6782  1 20:45 pts/1    00:00:00 ps -edf
postgres  6847  6782  0 20:45 pts/1    00:00:00 grep postgres
-bash-4.1$
Thanks,
TG



From: Luca Ferrari <fluca1978@infinito.it>
To: Thara Vadakkeveedu <tharagv@yahoo.com>
Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
Sent: Monday, September 23, 2013 2:41 AM
Subject: Re: [NOVICE] Uninstall postgresql 9.2 on red hat linux

On Mon, Sep 23, 2013 at 1:57 AM, Thara Vadakkeveedu <tharagv@yahoo.com> wrote:

> I accidentally deleted data directory this morning
> (/var/lib/postgresql/9.2/data)
>

What a start of a day!

> I tried  su - postgres
> and then from the bash shell I tried to run these commands (tried one at a
> time)
> but I got the message  that address was in use. There are no processes
> running on 5432.


I suspect if it gives you such an error there must something bound to
the address. Have you tried to execute nmap against the IPv4 address
your server is listening on (or supposed to be listening on)?

Luca




Re: Uninstall postgresql 9.2 on red hat linux

From
Jayadevan M
Date:
What follows the -D option should be a directory. It looks like you have given a file name.


On Tue, Sep 24, 2013 at 6:37 AM, Thara Vadakkeveedu <tharagv@yahoo.com> wrote:
I tried starting postgres using the main configuration file. I get "not a directory" message...

-bash-4.1$ /usr/pgsql-9.2/bin/postgres -D /var/lib/pgsql/9.2/data/postgresql.conf

postgres cannot access the server configuration file "/var/lib/pgsql/9.2/data/postgresql.conf/postgresql.conf": Not a directory

-bash-4.1$ ls -al
...
...
drwx------.  3 postgres postgres  4096 Sep 22 12:20 pg_xlog
-rw-------.  1 postgres postgres 19601 Sep 22 11:35 postgresql.conf
-rw-------   1 postgres postgres    59 Sep 23 20:35 postmaster.opts
-bash-4.1$ /usr/pgsql-9.2/bin/postgres -D /var/lib/pgsql/9.2/data/postgresql.conf
postgres cannot access the server configuration file "/var/lib/pgsql/9.2/data/postgresql.conf/postgresql.conf": Not a directory

-bash-4.1$ chmod 755 postgresql.conf

-bash-4.1$ /usr/pgsql-9.2/bin/postgres -D /var/lib/pgsql/9.2/data/postgresql.conf
postgres cannot access the server configuration file "/var/lib/pgsql/9.2/data/postgresql.conf/postgresql.conf": Not a directory

-bash-4.1$
-bash-4.1$ pwd
/var/lib/pgsql/9.2/data

Thanks,
Thara.


From: Thara Vadakkeveedu <tharagv@yahoo.com>
To: Luca Ferrari <fluca1978@infinito.it>
Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
Sent: Monday, September 23, 2013 8:45 PM

Subject: Re: [NOVICE] Uninstall postgresql 9.2 on red hat linux

There are no processes belonging to postgres on the system.
-bash-4.1$ ps -edf | grep postgres
root      6412  6249  0 18:22 pts/0    00:00:00 su - postgres
postgres  6413  6412  0 18:22 pts/0    00:00:00 -bash
root      6781  6756  0 20:35 pts/1    00:00:00 su - postgres
postgres  6782  6781  0 20:35 pts/1    00:00:00 -bash
postgres  6846  6782  1 20:45 pts/1    00:00:00 ps -edf
postgres  6847  6782  0 20:45 pts/1    00:00:00 grep postgres
-bash-4.1$
Thanks,
TG



From: Luca Ferrari <fluca1978@infinito.it>
To: Thara Vadakkeveedu <tharagv@yahoo.com>
Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
Sent: Monday, September 23, 2013 2:41 AM
Subject: Re: [NOVICE] Uninstall postgresql 9.2 on red hat linux

On Mon, Sep 23, 2013 at 1:57 AM, Thara Vadakkeveedu <tharagv@yahoo.com> wrote:

> I accidentally deleted data directory this morning
> (/var/lib/postgresql/9.2/data)
>

What a start of a day!

> I tried  su - postgres
> and then from the bash shell I tried to run these commands (tried one at a
> time)
> but I got the message  that address was in use. There are no processes
> running on 5432.


I suspect if it gives you such an error there must something bound to
the address. Have you tried to execute nmap against the IPv4 address
your server is listening on (or supposed to be listening on)?

Luca





Re: Uninstall postgresql 9.2 on red hat linux

From
Luca Ferrari
Date:
On Tue, Sep 24, 2013 at 3:07 AM, Thara Vadakkeveedu <tharagv@yahoo.com> wrote:

> -bash-4.1$ /usr/pgsql-9.2/bin/postgres -D
> /var/lib/pgsql/9.2/data/postgresql.conf
> postgres cannot access the server configuration file
> "/var/lib/pgsql/9.2/data/postgresql.conf/postgresql.conf": Not a directory
>


Pay attention here: you are passing to the -D the full path to the
file, that is then expanded to the full path to the file again, that
is the postgresql.conf appears twice. You have to pass to the -D
(directory) the directory where the configuration file is.

Luca


Re: Uninstall postgresql 9.2 on red hat linux

From
Devrim GÜNDÜZ
Date:
Hi,

On Sun, 2013-09-22 at 16:57 -0700, Thara Vadakkeveedu wrote:
> I am new to postgresql. I have postgresql 9.2 installed on Red hat
> linux 6.4
> I accidentally deleted data directory this morning
> (/var/lib/postgresql/9.2/data)
>
> I tried to start posgresql 9.2 service
> "service postgresql-9.2 start"
>
> I got a message to initialize the db first.
>
> so I ran "service postgresql-9.2 initdb"
>
> This was successful.
>
> Then I tried "service postgresql-9.2 start"
> This failed.

Please look at  the log files under /var/lib/pgsql/9.2/data/pg_log/ .
PostgreSQL is probably complaining for another thing.

Regards,
--
Devrim GÜNDÜZ
Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org  Twitter: http://twitter.com/devrimgunduz

Attachment

Re: Uninstall postgresql 9.2 on red hat linux

From
Thara Vadakkeveedu
Date:
This is what I find in the posgresql log (entries relate to my attempts to start postgresql yesterday)
 
LOG:  database system was shut down at 2013-09-22 12:20:51 EDT
LOG:  invalid magic number 0000 in log file 0, segment 39, offset 0
LOG:  invalid primary checkpoint record
LOG:  invalid secondary checkpoint record
PANIC:  could not locate a valid checkpoint record
LOG:  startup process (PID 2361) was terminated by signal 6: Aborted
LOG:  aborting startup due to startup process failure
LOG:  database system was shut down at 2013-09-22 12:20:51 EDT
LOG:  invalid magic number 0000 in log file 0, segment 39, offset 0
LOG:  invalid primary checkpoint record
LOG:  invalid secondary checkpoint record
PANIC:  could not locate a valid checkpoint record
LOG:  startup process (PID 6323) was terminated by signal 6: Aborted
LOG:  aborting startup due to startup process failure
LOG:  database system was shut down at 2013-09-22 12:20:51 EDT
LOG:  invalid magic number 0000 in log file 0, segment 39, offset 0
LOG:  invalid primary checkpoint record
LOG:  invalid secondary checkpoint record
PANIC:  could not locate a valid checkpoint record
LOG:  startup process (PID 6346) was terminated by signal 6: Aborted
LOG:  aborting startup due to startup process failure
LOG:  database system was shut down at 2013-09-22 12:20:51 EDT
LOG:  invalid magic number 0000 in log file 0, segment 39, offset 0
"postgresql-Mon.log" 49L, 2709C
 
Thanks
thara.

From: Devrim GÜNDÜZ <devrim@gunduz.org>
To: Thara Vadakkeveedu <tharagv@yahoo.com>
Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
Sent: Tuesday, September 24, 2013 4:17 AM
Subject: Re: [NOVICE] Uninstall postgresql 9.2 on red hat linux


Hi,

On Sun, 2013-09-22 at 16:57 -0700, Thara Vadakkeveedu wrote:
> I am new to postgresql. I have postgresql 9.2 installed on Red hat
> linux 6.4
> I accidentally deleted data directory this morning
> (/var/lib/postgresql/9.2/data)
>
> I tried to start posgresql 9.2 service
> "service postgresql-9.2 start"
>
> I got a message to initialize the db first.
>
> so I ran "service postgresql-9.2 initdb"
>
> This was successful.
>
> Then I tried "service postgresql-9.2 start"
> This failed.

Please look at  the log files under /var/lib/pgsql/9.2/data/pg_log/ .
PostgreSQL is probably complaining for another thing.

Regards,
--
Devrim GÜNDÜZ
Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com/
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org/Twitter: http://twitter.com/devrimgunduz

Re: Uninstall postgresql 9.2 on red hat linux

From
Thara Vadakkeveedu
Date:
I looked at the postgres log, found a panic message on invalid checkpoint..verified there were no postgres processes running, deleted the data directory again, ran initdb and now the service starts successfully. I am all set.
thanks,
thara.

From: Thara Vadakkeveedu <tharagv@yahoo.com>
To: Devrim GÜNDÜZ <devrim@gunduz.org>
Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
Sent: Tuesday, September 24, 2013 9:53 AM
Subject: Re: [NOVICE] Uninstall postgresql 9.2 on red hat linux

This is what I find in the posgresql log (entries relate to my attempts to start postgresql yesterday)
 
LOG:  database system was shut down at 2013-09-22 12:20:51 EDT
LOG:  invalid magic number 0000 in log file 0, segment 39, offset 0
LOG:  invalid primary checkpoint record
LOG:  invalid secondary checkpoint record
PANIC:  could not locate a valid checkpoint record
LOG:  startup process (PID 2361) was terminated by signal 6: Aborted
LOG:  aborting startup due to startup process failure
LOG:  database system was shut down at 2013-09-22 12:20:51 EDT
LOG:  invalid magic number 0000 in log file 0, segment 39, offset 0
LOG:  invalid primary checkpoint record
LOG:  invalid secondary checkpoint record
PANIC:  could not locate a valid checkpoint record
LOG:  startup process (PID 6323) was terminated by signal 6: Aborted
LOG:  aborting startup due to startup process failure
LOG:  database system was shut down at 2013-09-22 12:20:51 EDT
LOG:  invalid magic number 0000 in log file 0, segment 39, offset 0
LOG:  invalid primary checkpoint record
LOG:  invalid secondary checkpoint record
PANIC:  could not locate a valid checkpoint record
LOG:  startup process (PID 6346) was terminated by signal 6: Aborted
LOG:  aborting startup due to startup process failure
LOG:  database system was shut down at 2013-09-22 12:20:51 EDT
LOG:  invalid magic number 0000 in log file 0, segment 39, offset 0
"postgresql-Mon.log" 49L, 2709C
 
Thanks
thara.

From: Devrim GÜNDÜZ <devrim@gunduz.org>
To: Thara Vadakkeveedu <tharagv@yahoo.com>
Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>
Sent: Tuesday, September 24, 2013 4:17 AM
Subject: Re: [NOVICE] Uninstall postgresql 9.2 on red hat linux


Hi,

On Sun, 2013-09-22 at 16:57 -0700, Thara Vadakkeveedu wrote:
> I am new to postgresql. I have postgresql 9.2 installed on Red hat
> linux 6.4
> I accidentally deleted data directory this morning
> (/var/lib/postgresql/9.2/data)
>
> I tried to start posgresql 9.2 service
> "service postgresql-9.2 start"
>
> I got a message to initialize the db first.
>
> so I ran "service postgresql-9.2 initdb"
>
> This was successful.
>
> Then I tried "service postgresql-9.2 start"
> This failed.

Please look at  the log files under /var/lib/pgsql/9.2/data/pg_log/ .
PostgreSQL is probably complaining for another thing.

Regards,
--
Devrim GÜNDÜZ
Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com/
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org/Twitter: http://twitter.com/devrimgunduz