There are three methods:
Stopping the Instance Using the Fast Mode
If backup is in progress, then terminate it, roll back all executing transactions, forcibly close client connections, and then stop the instance.
Stopping the Instance Using the Immediate Mode
Forcibly terminate the instance immediately. A crash recovery is run when the instance is restarted.
Forcibly Stopping the Server Process
Reliably stops the server process when the other methods are unsuccessful.
Specify "-m fast" in the pg_ctl command to stop the instance.
If the instance fails to stop when you use this method, stop the instance as described in "8.11.2.2 Stopping the Instance Using the Immediate Mode" or "8.11.2.3 Forcibly Stopping the Server Process".
Example
> pg_ctl stop -D /database/inst1 -m fast
Specify "-m immediate " in the pg_ctl command to stop the instance.
If the instance fails to stop when you use this method, stop the instance as described in "8.11.2.3 Forcibly Stopping the Server Process".
Example
> pg_ctl stop -D /database/inst1 -m immediate
If both the Fast mode and the Immediate mode fail to stop the instance, use the kill command or the kill parameter of the pg_ctl command to forcibly stop the server process.
The procedure is as follows:
Execute the ps command
> ps axwfo user,pid,ppid,tty,command | grep postgres symfo 19174 18027 pts/1 \_ grep postgres symfo 20517 1 ? /opt/symfoserver64/bin/postgres -D /database/inst1 symfo 20518 20517 ? \_ postgres: logger process symfo 20520 20517 ? \_ postgres: checkpointer process symfo 20521 20517 ? \_ postgres: writer process symfo 20522 20517 ? \_ postgres: wal writer process symfo 20523 20517 ? \_ postgres: autovacuum launcher process symfo 20524 20517 ? \_ postgres: archiver process symfo 20525 20517 ? \_ postgres: stats collector process
The process ID (20517) indicates the server process.
Forcibly stop the server process
As instance manager, forcibly stop the server process.
> pg_ctl kill SIGQUIT 20517
> kill -s SIGQUIT 20517