start PostgreSQL ไม่ได้ บน windows

เกี่ยวกับ ปัญหาการใช้งาน การติดตั้ง ฐานข้อมูล MySql Oracle MSSQL ect...
การเขียน คำสั่ง SQL เพื่อดึกข้อมูล บอร์ดนี้ควรระบุโครงสร้างตารางของท่านในคำถามด้วยนะ

Moderator: mindphp

ภาพประจำตัวสมาชิก
MBMoo
PHP VIP Members
PHP VIP Members
โพสต์: 31620
ลงทะเบียนเมื่อ: 04/06/2020 10:05 am

start PostgreSQL ไม่ได้ บน windows

โพสต์ที่ยังไม่ได้อ่าน โดย MBMoo »

start PostgreSQL ไม่ได้ บน windows

โค้ด: เลือกทั้งหมด

C:\WINDOWS\system32>"C:\Program Files\PostgreSQL\12\bin\pg_ctl.exe" -D "C:\Program Files\PostgreSQL\12\data" start
waiting for server to start....2024-10-01 13:08:43.732 +07 [8136] LOG:  starting PostgreSQL 12.3, compiled by Visual C++ build 1914, 64-bit
2024-10-01 13:08:43.734 +07 [8136] LOG:  listening on IPv6 address "::", port 5449
2024-10-01 13:08:43.735 +07 [8136] LOG:  listening on IPv4 address "0.0.0.0", port 5449
2024-10-01 13:08:43.909 +07 [8136] LOG:  redirecting log output to logging collector process
2024-10-01 13:08:43.909 +07 [8136] HINT:  Future log output will appear in directory "log".
........................................................... stopped waiting
pg_ctl: server did not start in time
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 47740
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

Re: start PostgreSQL ไม่ได้ บน windows

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

ลองเช็ค Error logs
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ภาพประจำตัวสมาชิก
MBMoo
PHP VIP Members
PHP VIP Members
โพสต์: 31620
ลงทะเบียนเมื่อ: 04/06/2020 10:05 am

Re: start PostgreSQL ไม่ได้ บน windows

โพสต์ที่ยังไม่ได้อ่าน โดย MBMoo »

ใช้งานได้แล้ว ใน Folder C:\Program Files\PostgreSQL\12\data .ให้ทำการลบ ไฟล์ postmaster.pid ออก
SQL - Database-1.png
SQL - Database-1.png (52.62 KiB) Viewed 1206 times
จากนั้นไปทำการ start ใน services แทน การใช้ cmd และต้อง kill process ต่างๆ ที่ใช้งาน PostgreSQL ออกก่อนด้วย
SQL - Database-4.png
SQL - Database-4.png (32.04 KiB) Viewed 1206 times
ภาพประจำตัวสมาชิก
MBMoo
PHP VIP Members
PHP VIP Members
โพสต์: 31620
ลงทะเบียนเมื่อ: 04/06/2020 10:05 am

Re: start PostgreSQL ไม่ได้ บน windows

โพสต์ที่ยังไม่ได้อ่าน โดย MBMoo »

ทุกครั้งที่เปิดเครื่องใหม่จะเกิดปัญหาซ้ำๆ แต่รอบนี้แก้วิธีเดิมก็ยังไม่สามารถใช้งานได้
2024-10-02 10:51:19.809 +07 [15844] LOG: database system was interrupted; last known up at 2024-10-02 10:10:03 +07
SQL - Database-1.png
SQL - Database-1.png (19.86 KiB) Viewed 1191 times

ผ่าน command
C:\WINDOWS\system32>"C:\Program Files\PostgreSQL\12\bin\pg_ctl.exe" -D "C:\Program Files\PostgreSQL\12\data" start
waiting for server to start....2024-10-02 11:04:36.526 +07 [13260] LOG: starting PostgreSQL 12.3, compiled by Visual C++ build 1914, 64-bit
2024-10-02 11:04:36.528 +07 [13260] LOG: listening on IPv6 address "::", port 5449
2024-10-02 11:04:36.528 +07 [13260] LOG: listening on IPv4 address "0.0.0.0", port 5449
2024-10-02 11:04:36.726 +07 [13260] LOG: redirecting log output to logging collector process
2024-10-02 11:04:36.726 +07 [13260] HINT: Future log output will appear in directory "log".
........................................................... stopped waiting
pg_ctl: server did not start in time
ตรวจสอบในไฟล์ postmaster.pid กับ ใน services ไม่มีใช้งาน13260 อยู่
SQL - Database-1.png
SQL - Database-1.png (38.84 KiB) Viewed 1186 times
พอ start อีกรอบ ขึ้นว่ามีไฟล์ postmaster.pid ซ้ำ
C:\WINDOWS\system32>"C:\Program Files\PostgreSQL\12\bin\pg_ctl.exe" -D "C:\Program Files\PostgreSQL\12\data" start
pg_ctl: another server might be running; trying to start server anyway
waiting for server to start....2024-10-02 11:10:31.107 +07 [17028] FATAL: lock file "postmaster.pid" already exists
2024-10-02 11:10:31.107 +07 [17028] HINT: Is another postmaster (PID 13260) running in data directory "C:/Program Files/PostgreSQL/12/data"?
stopped waiting
pg_ctl: could not start server
Examine the log output.
พอลบไฟล์ postmaster.pid ออกก็กลับไปลูปเดิม และ อยู่ๆก็สามารถใช้งานได้


อ้างอิง https://stackoverflow.com/questions/645 ... art-server
ภาพประจำตัวสมาชิก
noncup302
PHP VIP Members
PHP VIP Members
โพสต์: 24504
ลงทะเบียนเมื่อ: 17/05/2022 10:36 am

Re: start PostgreSQL ไม่ได้ บน windows

โพสต์ที่ยังไม่ได้อ่าน โดย noncup302 »

เจอเหมือนกันเลยครับ start ไม่ได้เลย

SQL - Database-1.png
SQL - Database-1.png (35.07 KiB) Viewed 1175 times

log ล่าสุด


-10-02 09:38:25.870 +07 [6176] LOG: received fast shutdown request
2024-10-02 09:38:25.875 +07 [8536] ERROR: canceling statement due to user request
2024-10-02 09:38:25.885 +07 [6176] LOG: aborting any active transactions
2024-10-02 09:38:25.894 +07 [35804] FATAL: terminating connection due to administrator command
2024-10-02 09:38:25.895 +07 [23088] FATAL: terminating connection due to administrator command
2024-10-02 09:38:25.895 +07 [11100] FATAL: terminating connection due to administrator command
2024-10-02 09:38:25.895 +07 [27072] FATAL: terminating connection due to administrator command
2024-10-02 09:38:25.898 +07 [28100] FATAL: terminating connection due to administrator command
2024-10-02 09:38:25.901 +07 [28624] FATAL: terminating connection due to administrator command
2024-10-02 09:38:25.904 +07 [28004] FATAL: terminating connection due to administrator command
2024-10-02 09:38:25.904 +07 [6176] LOG: background worker "logical replication launcher" (PID 8536) exited with exit code 1
2024-10-02 09:38:25.905 +07 [27040] FATAL: terminating connection due to administrator command
2024-10-02 09:38:25.905 +07 [14152] FATAL: terminating connection due to administrator command
2024-10-02 09:38:25.907 +07 [13960] FATAL: terminating connection due to administrator command
2024-10-02 09:38:25.986 +07 [8484] LOG: shutting down
2024-10-02 09:38:26.010 +07 [12000] FATAL: the database system is shutting down
2024-10-02 09:38:26.027 +07 [6176] LOG: database system is shut down
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 47740
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

Re: start PostgreSQL ไม่ได้ บน windows

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

stop service
และ kill จาก command
แล้วลองเปลี่ยน port และ start ใหม่
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ภาพประจำตัวสมาชิก
noncup302
PHP VIP Members
PHP VIP Members
โพสต์: 24504
ลงทะเบียนเมื่อ: 17/05/2022 10:36 am

Re: start PostgreSQL ไม่ได้ บน windows

โพสต์ที่ยังไม่ได้อ่าน โดย noncup302 »

mindphp เขียน: 02/10/2024 4:33 pm stop service
และ kill จาก command
แล้วลองเปลี่ยน port และ start ใหม่
stop อยู่ แล้ว

โค้ด: เลือกทั้งหมด

C:\Users\noncu>net stop PostgreSQL_For_Odoo
The PostgreSQL_For_Odoo - PostgreSQL Server 12 service is not started.

More help is available by typing NET HELPMSG 3521.
น่าจะ kill ไปแล้วไม่เจอ PID ID

โค้ด: เลือกทั้งหมด

C:\Windows\System32>tasklist | findstr postgres

C:\Windows\System32>sc queryex PostgreSQL_For_Odoo

SERVICE_NAME: PostgreSQL_For_Odoo
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 1  STOPPED
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0
        PID                : 0
        FLAGS              :

เปลี่ยน Port ใหม่แล้วยังไม่ได้
SQL - Database-1.png
SQL - Database-1.png (16.85 KiB) Viewed 1164 times

โค้ด: เลือกทั้งหมด

C:\Windows\System32>net start PostgreSQL_For_Odoo
The PostgreSQL_For_Odoo - PostgreSQL Server 12 service is starting.
The PostgreSQL_For_Odoo - PostgreSQL Server 12 service could not be started.

The service did not report an error.

More help is available by typing NET HELPMSG 3534.
ภาพประจำตัวสมาชิก
MBMoo
PHP VIP Members
PHP VIP Members
โพสต์: 31620
ลงทะเบียนเมื่อ: 04/06/2020 10:05 am

Re: start PostgreSQL ไม่ได้ บน windows

โพสต์ที่ยังไม่ได้อ่าน โดย MBMoo »

ถ้า stop services ทุกครั้งก่อนปิดเครื่องจะไม่ค่อยเจอปัญหาเวลา เปิดเครื่องใหม่
ภาพประจำตัวสมาชิก
noncup302
PHP VIP Members
PHP VIP Members
โพสต์: 24504
ลงทะเบียนเมื่อ: 17/05/2022 10:36 am

Re: start PostgreSQL ไม่ได้ บน windows

โพสต์ที่ยังไม่ได้อ่าน โดย noncup302 »

ยังเป็นเหมือนเดิม
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 47740
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

Re: start PostgreSQL ไม่ได้ บน windows

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

MBMoo เขียน: 02/10/2024 6:11 pm ถ้า stop services ทุกครั้งก่อนปิดเครื่องจะไม่ค่อยเจอปัญหาเวลา เปิดเครื่องใหม่
ลองตามนี้ดูหรือยังครับ
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 4