A.Stopping postgresql database

pg_ctl can be used to stop a database cluster

•pg_ctl supports three modes of shutdown
−smart quit after all clients have disconnected
−fast (default)quit directly, with proper shutdown
−immediate quit without complete shutdown; will lead to recovery

•Syntax
−pg_ctl stop [-W] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]

-bash-4.1$ pwd
/opt/edb/as9.6/bin
-bash-4.1$ ./pg_ctl -D /opt/edb/as9.6/data -mf stop
waiting for server to shut down.... done
server stopped
-bash-4.1$ ps -ef|grep postgresql
54322 12838 12225 0 09:30 pts/2 00:00:00 grep postgresql

B.Starting postgresql database

pg_ctl can be used to start a database cluster

Choose a unique port for postmaster
•Change the port in postgresql.conf

•pg_ctl utility can be used to start a cluster
•Syntax
−pg_ctl start [options]
−Options
-D location of the database storage area
-l write (or append) server log to FILENAME
-w wait until operation completes
-t seconds to wait when using -w option

-bash-4.1$ ./pg_ctl -D /opt/edb/as9.6/data -mf start
server starting
-bash-4.1$ 2018-05-08 09:30:19 IST LOG: redirecting log output to logging collector process
2018-05-08 09:30:19 IST HINT: Future log output will appear in directory "pg_log".
-bash-4.1$ ps -ef|grep post
root 1947 1 0 May07 ? 00:00:00 /usr/libexec/postfix/master
postfix 1956 1947 0 May07 ? 00:00:00 qmgr -l -t fifo -u
postfix 12663 1947 0 09:13 ? 00:00:00 pickup -l -t fifo -u
54322 12841 1 0 09:30 pts/2 00:00:00 /opt/edb/as9.6/bin/edb-postgres -D /opt/edb/as9.6/data
54322 12842 12841 0 09:30 ? 00:00:00 postgres: logger process
54322 12844 12841 0 09:30 ? 00:00:00 postgres: checkpointer process
54322 12845 12841 0 09:30 ? 00:00:00 postgres: writer process
54322 12846 12841 0 09:30 ? 00:00:00 postgres: wal writer process
54322 12847 12841 0 09:30 ? 00:00:00 postgres: autovacuum launcher process
54322 12848 12841 0 09:30 ? 00:00:00 postgres: stats collector process
54322 12849 12841 0 09:30 ? 00:00:00 postgres: bgworker: dbms_aq launcher

C.pg_controldatacan be used to view the control information for a database cluster

-bash-4.1$ ./pg_controldata /opt/edb/as9.6/data
pg_control version number: 960
Catalog version number: 201608131
Database system identifier: 6551197085840965172
Database cluster state: in production
pg_control last modified: Tue 08 May 2018 09:30:19 AM IST
Latest checkpoint location: 0/274D828
Prior checkpoint location: 0/274D7B8
Latest checkpoint's REDO location: 0/274D828
Latest checkpoint's REDO WAL file: 000000010000000000000002
Latest checkpoint's TimeLineID: 1
Latest checkpoint's PrevTimeLineID: 1
Latest checkpoint's full_page_writes: on
Latest checkpoint's NextXID: 0:2347
Latest checkpoint's NextOID: 24581
Latest checkpoint's NextMultiXactId: 1
Latest checkpoint's NextMultiOffset: 0
Latest checkpoint's oldestXID: 2326
Latest checkpoint's oldestXID's DB: 1
Latest checkpoint's oldestActiveXID: 0
Latest checkpoint's oldestMultiXid: 1
Latest checkpoint's oldestMulti's DB: 1
Latest checkpoint's oldestCommitTsXid:0
Latest checkpoint's newestCommitTsXid:0
Time of latest checkpoint: Tue 08 May 2018 09:29:55 AM IST
Fake LSN counter for unlogged rels: 0/1
Minimum recovery ending location: 0/0
Min recovery ending loc's timeline: 0
Backup start location: 0/0
Backup end location: 0/0
End-of-backup record required: no
wal_level setting: minimal
wal_log_hints setting: off
max_connections setting: 100
max_worker_processes setting: 8
max_prepared_xacts setting: 0
max_locks_per_xact setting: 64
track_commit_timestamp setting: off
Maximum data alignment: 8
Database block size: 8192
Blocks per segment of large relation: 131072
WAL block size: 8192
Bytes per WAL segment: 16777216
Maximum length of identifiers: 64
Maximum columns in an index: 32
Maximum size of a TOAST chunk: 1996
Size of a large-object chunk: 2048
Date/time type storage: 64-bit integers
Float4 argument passing: by value
Float8 argument passing: by value
Data page checksum version: 0

Leave a Reply

Your email address will not be published. Required fields are marked *