Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgresql fatal the database system is starting up - windows 10

Tags:

postgresql

I have installed postgresql on windows 10 on usb disk. Every day when i start my pc in work from sleep and plug in the disk again then trying to start postgresql i get this error:

FATAL: the database system is starting up

The service starts with following command:

E:\PostgresSql\pg96\pgservice.exe "//RS//PostgreSQL 9.6 Server"

It is the default one.

logs from E:\PostgresSql\data\logs\pg96

2019-02-28 10:30:36 CET [21788]: [1-1] user=postgres,db=postgres,app=[unknown],client=::1 FATAL:  the database system is starting up
2019-02-28 10:31:08 CET [9796]: [1-1] user=postgres,db=postgres,app=[unknown],client=::1 FATAL:  the database system is starting up

I want this start up to happen faster.

like image 686
tryingHard Avatar asked Feb 28 '19 09:02

tryingHard


People also ask

What is PostgreSQL and why is it on my computer?

PostgreSQL is a powerful, open source object-relational database system that uses and extends the SQL language combined with many features that safely store and scale the most complicated data workloads.

How do I open port 5432 in Windows?

Open Windows Firewall Port As an alternative you can go to Control Panel -> Systems and Security -> Windows Firewall -> Allow a program or feature through Windows Firewall -> Advanced Settings -> New Rule: Rule Type: Port. TCP or UDP: TCP. Specific local ports: 5432.

What IDE should I use for PostgreSQL?

dbForge Studio for PostgreSQL The PostgreSQL IDE allows users to create, develop, and execute queries, edit and adjust the code to the requirements in a convenient and UI.


1 Answers

When you commit data to a Postgres database, the only thing which is immediately saved to disk is the write-ahead log. The actual table changes are only applied to the in-memory buffers, and won't be permanently saved to disk until the next checkpoint.

If the server is stopped abruptly, or if it suddenly loses access to the file system, then everything in memory is lost, and the next time you start it up, it needs to resort to replaying the log in order to get the tables back to the correct state (which can take quite a while, depending on how much has happened since the last checkpoint). And until it's finished, any attempt to use the server will result in FATAL: the database system is starting up.

If you make sure you shut the server down cleanly before unplugging the disk - giving it a chance to set a checkpoint and flush all of its buffers - then it should be able to start up again more or less immediately.

like image 104
Nick Barnes Avatar answered Oct 03 '22 02:10

Nick Barnes