Starting and shuting down Postgres server

Here are simple steps on how to start or stop PostgreSQL server.

----------------------------------------------------
-- SHUTDOWN POSTGRES
----------------------------------------------------

/etc/rc.d/init.d/postgresql stop
[root@OEL1 local]# su postgres
bash-4.1$ pg_ctl stop
pg_ctl: no database directory specified and environment variable PGDATA unset
Try "pg_ctl --help" for more information.
bash-4.1$ pwd
/usr/local
bash-4.1$ cd
bash-4.1$ . .bash_profile
[postgres@OEL1:~]$ pg_ctl stop
waiting for server to shut down.... done
server stopped
[postgres@OEL1:~]$ ps -ef|grep postgres
root      2772  2737  0 10:32 pts/1    00:00:00 su postgres
postgres  2773  2772  0 10:32 pts/1    00:00:00 bash
postgres  2810  2773  0 10:33 pts/1    00:00:00 ps -ef
postgres  2811  2773  0 10:33 pts/1    00:00:00 grep postgres


----------------------------------------------------
-- STARTUP POSTGRES
----------------------------------------------------

/etc/rc.d/init.d/postgresql start
[postgres@OEL1:~]$  pg_ctl start
server starting
[postgres@OEL1:~]$ ps -ef|grep postgres
root      2772  2737  0 10:32 pts/1    00:00:00 su postgres
postgres  2773  2772  0 10:32 pts/1    00:00:00 bash
postgres  2819     1  7 10:35 pts/1    00:00:00 /usr/bin/postgres
postgres  2820  2819  0 10:35 ?        00:00:00 postgres: logger process  
postgres  2822  2819  0 10:35 ?        00:00:00 postgres: writer process  
postgres  2823  2819  0 10:35 ?        00:00:00 postgres: wal writer process  
postgres  2824  2819  0 10:35 ?        00:00:00 postgres: autovacuum launcher process  
postgres  2825  2819  0 10:35 ?        00:00:00 postgres: stats collector process  
postgres  2826  2773  0 10:35 pts/1    00:00:00 ps -ef
postgres  2827  2773  0 10:35 pts/1    00:00:00 grep postgres

Comments

Popular posts from this blog

Oracle Alter session like in postgres

switching between users in postgres

Connecting to PostgresSQL database