目的
Windows環境のpostgreSQLで起動停止を実行
OS:Windows10
PostgreSQL:13.3
postgreSQLの起動停止
停止・起動・再起動コマンドは以下
停止
C:\Users\shun>pg_ctl -D "G:\Program\PostgreSQL\13\data" stop
起動
C:\Users\shun>pg_ctl -D "G:\Program\PostgreSQL\13\data" start
再起動
C:\Users\shun>pg_ctl -D "G:\Program\PostgreSQL\13\data" restart
一般ユーザで実行したところ以下エラー
pg_ctl: 停止シグナルを送信できませんでした。(PID: 5384): Operation not permitted
以下サイトを参考に管理者権限で実行
C:\WINDOWS\system32>pg_ctl -D "G:\Program\PostgreSQL\13\data" stop
サーバ停止処理の完了を待っています....完了
サーバは停止しました
C:\WINDOWS\system32>pg_ctl -D "G:\Program\PostgreSQL\13\data" start
サーバの起動完了を待っています....2022-01-31 23:29:44.965 JST [4360] LOG: redirecting log output to logging collector process
2022-01-31 23:29:44.965 JST [4360] HINT: Future log output will appear in directory "log".
完了
サーバ起動完了
停止・起動できました。