Friday, October 11, 2013

Error while starting PostgreSQL with Windows OS : pg_ctl: invalid data in PID file "postmaster.pid"


while start PostgreSQL on windows OS, 

C:>"C:/Program Files/PostgreSQL/8.3/bin/pg_ctl.exe-D "C:/ProgramFiles/PostgreSQL/8.3/data" start

Error

pg_ctl: invalid data in PID file "C:/ProgramFiles/PostgreSQL/8.3/data/postmaster.pid"
pg_ctl: invalid data in PID file "/postgres/directory/postmaster.pid"

SOLUTION

Just manually remove  the postmaster.pid file at /postgres/directory/postmaster.pid and start it again, now PostgreSQL server will start successfully.  

Why this cause - Explanation 


postmaster.pid was the process ID file for PostgreSQL, which indicate PostgreSQL process. If the file exists, it would mean that PostgreSQL is alive and running. If it doesn't, it would mean PostgreSQL have been terminated, either on purpose or abnormally.

In our case, the file exist but the
PostgreSQL instance is not running. i'm just looking up the file postmaster.pid, it was empty but showing size as 1KB, no indication of process ID describe the process. this end of with the conclusion of PostgreSQL have been terminated abnormally, leaving an empty postmaster.pid.




No comments: