PostgreSQL学习第四篇--数据库cluster启停

启动数据库cluster:
pg_ctl start -D $PGDATA

关闭数据库cluster:
pg_ctl stop -D $PGDATA [-m mode]

mode有三种模式:

	1. smart :等待所有的连接终止后,关闭数据库cluster。如果客户端连接不终止,则无法关闭数据库cluster。看起来是Oracle的normal。
	2. fast:快速关闭数据库cluster,断开客户端的连接,让已有的事务回滚,然后正常关闭数据库cluster,看起来是Oracle的immediate。
	3. immediate:立即关闭数据库cluster,相当于数据库cluster进程立即停止,直接退出,下次启动数据库cluster需要恢复。看起来是Oracle的abort。


[postgres@single ~]$ pg_ctl start -D $PGDATA
server starting
[postgres@single ~]$ LOG:  could not bind IPv6 socket: Address already in use
HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
LOG:  could not bind IPv4 socket: Address already in use
HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
WARNING:  could not create listen socket for "localhost"
FATAL:  could not create any TCP/IP sockets
LOG:  database system is shut down


发现是因为前面已经启动了-D /usr/pg/postgresql-9.6.1/data/
先停掉:
[postgres@single ~]$ pg_ctl stop -D /usr/pg/postgresql-9.6.1/data/
waiting for server to shut down.... done
server stopped

然后起:
[postgres@single ~]$ pg_ctl start -D $PGDATA
server starting
[postgres@single ~]$ LOG:  database system was shut down at 2016-11-17 08:55:51 CST
LOG:  MultiXact member wraparound protections are now enabled
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started

可以了。
 

你可能感兴趣的:(postgresql,Oracle)