欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

更新postgresql數(shù)據(jù)庫的方法-創(chuàng)新互聯(lián)

創(chuàng)新互聯(lián)www.cdcxhl.cn八線動態(tài)BGP香港云服務器提供商,新人活動買多久送多久,劃算不套路!

創(chuàng)新互聯(lián)建站是一家網(wǎng)站設(shè)計公司,集創(chuàng)意、互聯(lián)網(wǎng)應用、軟件技術(shù)為一體的創(chuàng)意網(wǎng)站建設(shè)服務商,主營產(chǎn)品:響應式網(wǎng)站設(shè)計品牌網(wǎng)站制作、全網(wǎng)整合營銷推廣。我們專注企業(yè)品牌在網(wǎng)站中的整體樹立,網(wǎng)絡(luò)互動的體驗,以及在手機等移動端的優(yōu)質(zhì)呈現(xiàn)。成都網(wǎng)站設(shè)計、做網(wǎng)站、成都外貿(mào)網(wǎng)站建設(shè)公司、移動互聯(lián)產(chǎn)品、網(wǎng)絡(luò)運營、VI設(shè)計、云產(chǎn)品.運維為核心業(yè)務。為用戶提供一站式解決方案,我們深知市場的競爭激烈,認真對待每位客戶,為客戶提供賞析悅目的作品,網(wǎng)站的價值服務。

小編給大家分享一下更新postgresql數(shù)據(jù)庫的方法,相信大部分人都還不怎么了解,因此分享這邊文章給大家學習,希望大家閱讀完這篇文章后大所收獲,下面讓我們一起去學習方法吧!

1、升級工具

在程序的bin目錄下,提供了很多的數(shù)據(jù)庫工具,有一個pg_upgrade的工具就是專門用于數(shù)據(jù)庫升級的。關(guān)于該工具可以使用幫助命令來查看具體的用法:

[postgres@pgmaster pgdata]$ pg_upgrade --help
pg_upgrade upgrades a PostgreSQL cluster to a different major version.
Usage:
  pg_upgrade [OPTION]...
Options:
  -b, --old-bindir=BINDIR       old cluster executable directory
  -B, --new-bindir=BINDIR       new cluster executable directory
  -c, --check                   check clusters only, don't change any data
  -d, --old-datadir=DATADIR     old cluster data directory
  -D, --new-datadir=DATADIR     new cluster data directory
  -j, --jobs                    number of simultaneous processes or threads to use
  -k, --link                    link instead of copying files to new cluster
  -o, --old-options=OPTIONS     old cluster options to pass to the server
  -O, --new-options=OPTIONS     new cluster options to pass to the server
  -p, --old-port=PORT           old cluster port number (default 50432)
  -P, --new-port=PORT           new cluster port number (default 50432)
  -r, --retain                  retain SQL and log files after success
  -U, --username=NAME           cluster superuser (default "postgres")
  -v, --verbose                 enable verbose internal logging
  -V, --version                 display version information, then exit
  -?, --help                    show this help, then exit
Before running pg_upgrade you must:
  create a new database cluster (using the new version of initdb)
  shutdown the postmaster servicing the old cluster
  shutdown the postmaster servicing the new cluster
When you run pg_upgrade, you must provide the following information:
  the data directory for the old cluster  (-d DATADIR)
  the data directory for the new cluster  (-D DATADIR)
  the "bin" directory for the old version (-b BINDIR)
  the "bin" directory for the new version (-B BINDIR)
For example:
  pg_upgrade -d oldCluster/data -D newCluster/data -b oldCluster/bin -B newCluster/bin
or
  $ export PGDATAOLD=oldCluster/data
  $ export PGDATANEW=newCluster/data
  $ export PGBINOLD=oldCluster/bin
  $ export PGBINNEW=newCluster/bin
  $ pg_upgrade
Report bugs to <pgsql-bugs@postgresql.org>.

幫助文件中,提到了使用pg_upgrade工具前,必須創(chuàng)建一個新的數(shù)據(jù)庫,并且是已經(jīng)初始化的,同時關(guān)閉原來的數(shù)據(jù)庫和新的數(shù)據(jù)庫。使用pg_upgrade時候,必須要加上前后版本的data目錄和bin目錄。

2、升級過程

首先確認的是,原來的數(shù)據(jù)庫版本是pg9.6,數(shù)據(jù)目錄在/data/pgdata。然后,安裝完pg10.5后,不要初始化目錄。

將原來的9.6版本數(shù)據(jù)目錄重命名為pgdata.old

mv /data/pgdata /data/pgdata.old

在/data/下創(chuàng)建一個pgdata目錄,作為新版本的數(shù)據(jù)庫數(shù)據(jù)目錄,需要注意的是,這個目錄權(quán)限是700,owner是postgres

cd /data/
mkdir pgdata
chmod 700 pgdata
chown -R postgres.postgres pgdata

使用pg10.5的initdb初始化/data/pgdata目錄

initdb -D /data/pgdata

進行升級check,注意后面加上-c,這一步只是檢查不會實際執(zhí)行升級。所有項都是ok即認為是可以升級。

[postgres@pgmaster ~]$ pg_upgrade -b /usr/local/pgsql-9.6/bin -B /usr/local/pgsql/bin/ -d /data/pgdata.old/ 
-D /data/pgdata -p 5432 -P 5432 -c
Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for invalid "unknown" user columns                 ok
Checking for hash indexes                                   ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok
*Clusters are compatible*

執(zhí)行升級。即在上一步去掉-c,需要注意的是這一步根據(jù)數(shù)據(jù)庫的大小執(zhí)行時間長短不一,執(zhí)行完畢后會產(chǎn)生兩個腳本analyze_new_cluster.sh和delete_old_cluster.sh,根據(jù)實際需要來進行執(zhí)行,一般都會執(zhí)行第一個腳本,第二個不建議執(zhí)行,以防需要回滾升級,保留原來的數(shù)據(jù)目錄比較保險。

[postgres@pgmaster ~]$ pg_upgrade -b /usr/local/pgsql-9.6/bin -B /usr/local/pgsql/bin/ -d /data/pgdata.old/ 
-D /data/pgdata -p 5432 -P 5432 
Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for invalid "unknown" user columns                 ok
Creating dump of global objects                             ok
Creating dump of database schemas
                                                   ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok
If pg_upgrade fails after this point, you must re-initdb the
new cluster before continuing.
Performing Upgrade
------------------
Analyzing all rows in the new cluster                       ok
Freezing all rows in the new cluster                        ok
Deleting files from new pg_xact                             ok
Copying old pg_clog to new server                           ok
Setting next transaction ID and epoch for new cluster       ok
Deleting files from new pg_multixact/offsets                ok
Copying old pg_multixact/offsets to new server              ok
Deleting files from new pg_multixact/members                ok
Copying old pg_multixact/members to new server              ok
Setting next multixact ID and offset for new cluster        ok
Resetting WAL archives                                ok
Setting frozenxid and minmxid counters in new cluster       ok
Restoring global objects in the new cluster                 ok
Restoring database schemas in the new cluster
                                         ok
Copying user relation files
                                         ok
Setting next OID for new cluster                            ok
Sync data directory to disk                                 ok
Creating script to analyze new cluster                      ok
Creating script to delete old cluster                       ok
Checking for hash indexes                               ok
Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade so,
once you start the new server, consider running:
    ./analyze_new_cluster.sh
Running this script will delete the old cluster's data files:
    ./delete_old_cluster.sh

執(zhí)行腳本前,需要先啟動數(shù)據(jù)庫pg_ctl -D /data/pgdata start

[postgres@pgmaster ~]$ pg_ctl -D /data/pgdata start
waiting for server to start....2019-10-08 17:18:51.402 CST [35827] LOG:  listening on IPv6 address 
"::1", port 5432
2019-10-08 17:18:51.402 CST [35827] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2019-10-08 17:18:51.408 CST [35827] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2019-10-08 17:18:51.437 CST [35828] LOG:  database system was shut down at 2019-10-08 17:16:11 CST
2019-10-08 17:18:51.442 CST [35827] LOG:  database system is ready to accept connections
done
server started

執(zhí)行腳本./analyze_new_cluster.sh ,從運行日志來看,主要是創(chuàng)建統(tǒng)計信息

[postgres@pgmaster ~]$ ./analyze_new_cluster.sh 
This script will generate minimal optimizer statistics rapidly
so your system is usable, and then gather statistics twice more
with increasing accuracy.  When it is done, your system will
have the default level of optimizer statistics.
If you have used ALTER TABLE to modify the statistics target for
any tables, you might want to remove them and restore them after
running this script because they will delay fast statistics generation.
If you would like default statistics as quickly as possible, cancel
this script and run:
    "/usr/local/pgsql/bin/vacuumdb" --all --analyze-only
vacuumdb: processing database "postgres": Generating minimal optimizer statistics (1 target)
vacuumdb: processing database "template1": Generating minimal optimizer statistics (1 target)
vacuumdb: processing database "test": Generating minimal optimizer statistics (1 target)
vacuumdb: processing database "postgres": Generating medium optimizer statistics (10 targets)
vacuumdb: processing database "template1": Generating medium optimizer statistics (10 targets)
vacuumdb: processing database "test": Generating medium optimizer statistics (10 targets)
vacuumdb: processing database "postgres": Generating default (full) optimizer statistics
vacuumdb: processing database "template1": Generating default (full) optimizer statistics
vacuumdb: processing database "test": Generating default (full) optimizer statistics
Done

至此,查看version,發(fā)現(xiàn)已經(jīng)由原來的9.6升級為10.5,升級結(jié)束。

postgres=# select version();
                                      version
---------------------------------------------------------------------------------------------------------
 PostgreSQL 10.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39), 64-bit
(1 row)

以上是更新postgresql數(shù)據(jù)庫的方法的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學習更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道!

名稱欄目:更新postgresql數(shù)據(jù)庫的方法-創(chuàng)新互聯(lián)
當前URL:http://aaarwkj.com/article24/gdjje.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站營銷、品牌網(wǎng)站設(shè)計、網(wǎng)站內(nèi)鏈、商城網(wǎng)站、品牌網(wǎng)站建設(shè)、微信公眾號

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站制作
伊人欧美一区二区三区| av一区二区三区不卡在线看| 精品熟女少妇av免费久久野外| 日本人妻伦理在线播放| 亚洲久久精品中文字幕| 国产精品一区二区一牛影视| 亚洲热久久国产经典视频| 亚洲日本欧美一区二区| 免费在线观看欧美色妇| 黄片视频免费观看一起草| 狠狠久久五月综合色和啪| 中文字幕欧美精品日韩人妻| 最新91精品手机国产在线| 亚洲成在人天堂一区二区| 国产精品一区二区久久毛片| 精品黄色大片不卡国产| 日韩不卡高清免费在线视频| 亚洲国产精品一区二区电影| 久久久久久狠狠亚洲综合| 亚洲欧美熟妇欲乱又伦| 国产一区二区日本在线| 亚洲中文字幕一区乱码| 精品一区二区日韩在线| 日韩精品一区中文字幕在线| 国产在线播放精品视频| 天堂av一区二区三区| 日本高清不卡在线观看| 国产av日韩精品一区二区三区| 日韩国产欧美亚州精品| 野花日本免费高清完整| 国产高跟丝袜女王调教| 国产三级在线观看视频| 高潮国产精品一区二区| 97成人在线免费视频| 亚洲精品av在线网站| 激情视频一区二区三区| 久久精品一品二品三品| 成人av男人天堂东京热| 午夜激情在线观看网页| 东京热男人的天堂视频| 99久久精彩免费视频|