程序 pg_ctl 有一些可能有帮助的选项。( man pg_ctl
)
-c
Attempt to allow server crashes to produce core files, on platforms
where this is possible, by lifting any soft resource limit placed
on core files. This is useful in debugging or diagnosing problems
by allowing a stack trace to be obtained from a failed server
process.
-l filename
Append the server log output to filename. If the file does not
exist, it is created. The umask is set to 077, so access to the log
file is disallowed to other users by default.
程序 postgres 也有一些调试选项。( man postgres
)
-d debug-level
Sets the debug level. The higher this value is set, the more
debugging output is written to the server log. Values are from 1 to
5. It is also possible to pass -d 0 for a specific session, which
will prevent the server log level of the parent postgres process
from being propagated to this session.
在“半内部选项”部分。. .
-n
This option is for debugging problems that cause a server process
to die abnormally. The ordinary strategy in this situation is to
notify all other server processes that they must terminate and then
reinitialize the shared memory and semaphores. This is because an
errant server process could have corrupted some shared state before
terminating. This option specifies that postgres will not
reinitialize shared data structures. A knowledgeable system
programmer can then use a debugger to examine shared memory and
semaphore state.
-T
This option is for debugging problems that cause a server process
to die abnormally. The ordinary strategy in this situation is to
notify all other server processes that they must terminate and then
reinitialize the shared memory and semaphores. This is because an
errant server process could have corrupted some shared state before
terminating. This option specifies that postgres will stop all
other server processes by sending the signal SIGSTOP, but will not
cause them to terminate. This permits system programmers to collect
core dumps from all server processes by hand.