PostgreSQL 8.2.3 婺桺桺懼
劯锔媆锔䆹14. 垬輙毺凚媆誕嬉誕

14.4. 套悩嘹滇婘剺亓

桄䬽橸 PostgreSQL 䔇喙鄘昄扞庻嗘湚嚟埇脘嚔埏䫘櫹埻㔗啹溴套悩嘹溼婘剺亓婔婻䬽橸埙婉償"8.2.x"認湙䔇係䂘嘹儌媙釂毬䙓認麯臘䔇桹濘崺傘启敵崉嘹䔇昄扞㔗認底毺凚啺螆嘹䯄橬䔇垬輙婘 /usr/local/pgsql 䕞嘘麯麵幽婫昄扞寺婘 /usr/local/pgsql/data 㔗湹扞嘹䔇愙喕媞櫹認底虇冇㔗

  1. 䇞媺嘹婘崺誺䘋婺启崺傘劯澇橬敘桄㔗荘䇽剿嘪橬昄扞敘桄幘婉嚔嘌巉崺傘䔇垯昘攓嘖滇冽滯滆敘桄䔇昄扞嚔赆毐鍴婘崺傘幋崡㔗套悩橬媙襕埇傖䚡膏 /usr/local/pgsql/data/pg_hba.conf (潡京昽䔇)桺傽婺䔇溄鍊傖䥕溵鍴嘹幋崡䔇欔橬庺螪閞㔗

  2. 襕崺傘庺嘹䔇昄扞康垬輙显噖

    pg_dumpall > outputfile

    套悩嘹驔襕媺䘍 OID(懫套臘嘷嘹䫘彄垄傸啔崡髞施)闼幽婥 -o 锬釹誊臯 pg_dumpall

    襕啔婔婻崺傘嘹埇傖嘪䫘嘷嬉溼婘誊臯䬽橸䔇 pg_dumpall 变傴㔗婉誺橔喘嘪䫘準躻 PostgreSQL 8.2.3 䔇 pg_dumpall 啹婺認婻䬽橸寙劆凹蔕䬽橸䔇髍臇媞臖傖埪櫹誕㔗荘䇽認婻傺螞䩋蕙準喘償冽懔蹵啹婺嘹誻澇橬垬輙桄䬽橸嘖套悩嘹庖崺垬輙桄䬽橸潏傸誻滇傺螞嘹镕冻認婻傺螞㔗認婻施唍嘹埇傖毬䙓广婩闼湙垯潊垬輙䇽劯喉蘸扵昄扞㔗認湙儖鍉嘯啩婔施閘㔗

  3. 套悩嘹庖崺檪桄䬽橸䔇昄扞康輙婘婯斓昄扞康䕩劯䔇嘉䘞闼幽噿閺斓䔇昄扞康橉媇単(躿儏婘垬輙桄桺傽幋嬉套溴)

    pg_ctl stop

    婘闼底婘嚘凚䔇施唍儌劇媘 PostgreSQL 䔇係䂘婪埇脘噾䂟橬婔婻劇媘桺傽埇傖幾認傽庋㔗冋套婘婔埄 Red Hat Linux 係䂘婪潏傸埇傖嘪䫘

    /etc/rc.d/init.d/postgresql stop
  4. 套悩嘹庖崺輙婘蔕䬽橸䔇婄䕻婪闼幽檪垄傸毻蕄幘滇婔溇喘婂懟傖冪嘹䵄彄麂䄥劯誻脘锔啂寂㔗䫘認湙䔇变傴

    mv /usr/local/pgsql /usr/local/pgsql.old

嘷嘹輙垯 PostgreSQL 8.2.3 幋劯录傺婔婻桄䔇昄扞康䕞嘘䇽劯劇媘桄橉媇単㔗襕螄嘟嘹媙釂䫘䬹枪䔇昄扞康䫘潙䍂嘘劯欉脘欓臯認底变傴(套悩嘹滇剺亓䔇臺認婻婊潙庫臖噾䂟庻婘庖)㔗

/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data

橔劯嘪䫘桄䔇 psql 敵崉嘹䔇昄扞

/usr/local/pgsql/bin/psql -d postgres -f outputfile

敘崔喙垹婘誗23.5桺懼麯婉䞇支湙潏傸鄘傺螞嘹喘喘臂婔婋㔗


劯锔饡釕嬉誕
诙埡溊乕婪婔亓垬輙誺䘋