PostgreSQL深入淺出 | 數(shù)據(jù)庫(kù)的啟動(dòng)與停止
1、概述
上一章節(jié)我們已經(jīng)講述了基于CentOS7.9的操作系統(tǒng)環(huán)境安裝PostgreSQL的過(guò)程,本章將介紹Postgres數(shù)據(jù)庫(kù)的常用命令和基本操作。
2、Postgre數(shù)據(jù)庫(kù)的啟停
2.1、切換到postgres用戶
[root@localhost ~]# su - postgres
2.2、查看PG數(shù)據(jù)庫(kù)進(jìn)程
[postgres@localhost ~]$ ps -aux|grep postgres
2.3、啟動(dòng)數(shù)據(jù)庫(kù)
[postgres@localhost ~]$ pg_ctl -D /usr/local/pgsql/pgdata -l /tmp/logfile start
/usr/local/pgsql/pgdata:數(shù)據(jù)庫(kù)的數(shù)據(jù)目錄
/tmp/logfile:指定日志
啟動(dòng)成功后檢查進(jìn)程
[postgres@localhost ~]$ ps -aux|grep postgres
2.4、停止數(shù)據(jù)庫(kù)
[postgres@localhost ~]$ pg_ctl stop -D /usr/local/pgsql/pgdata -m fast
補(bǔ)充:
這里停止數(shù)據(jù)庫(kù)使用的-m參數(shù)有三個(gè)常用選項(xiàng):
smart: 需要等到所有連接斷開(kāi)后才關(guān)閉數(shù)據(jù)庫(kù)。
fast: 可以理解為Oracle數(shù)據(jù)庫(kù)的immdiate模式。
immediate:可以理解為Oracle數(shù)據(jù)庫(kù)的abort模式。
3、查看PostgreSQL數(shù)據(jù)庫(kù)
[postgres@localhost ~]$ pg_ctl status
版權(quán)聲明:
本站所有文章和圖片均來(lái)自用戶分享和網(wǎng)絡(luò)收集,文章和圖片版權(quán)歸原作者及原出處所有,僅供學(xué)習(xí)與參考,請(qǐng)勿用于商業(yè)用途,如果損害了您的權(quán)利,請(qǐng)聯(lián)系網(wǎng)站客服處理。