pg_resetxlog [-f] [-n] [-ooid ] [-x xid ] [-e xid_epoch ] [-m mxid ] [-O mxoff ] [-l timelineid, fileid, seg ] datadir
pg_resetxlog 橙䊖鵇喍斖媖(WAL)幽婫埇傖橬锬拷婄麉䘞噽垄婔底庻嗘婘 pg_control 桺傽婺䔇毓彽媇敇㔗橬施唍套悩認底桺傽嘷溄庖儌驔襕認婻媘脘㔗婔垔埻檪垄䫘嘩橔劯䔇桹濘儌滇臘埻橬啹婺認湙䔇嘷溄凚躘橉媇単方濘劇媘䔇施唍欉嘪䫘㔗
誊臯認婻变傴幋劯埇脘儌埇傖劇媘橉媇単庖嘖滇婔垔襕螄嘟昄扞康埇脘啹婺鄘彖柊庴䔇庋媇蔯劆橬婉垯昘䔇昄扞㔗嘹庫臖鷸婪蘸嗘昄扞誊臯 initdb 䇽劯麉桄媹蘘㔗婘麉桄媹蘘幋劯演昖婉垯昘䔇鄘彖䇽劯湹扞驔襕誕臯媞崉㔗
認婻变傴埻脘䫌垬輙橉媇単䔇䫘潙誊臯啹婺垄驔襕凹昄扞䕞嘘䔇臂喍溄鍊㔗庺庯垬噘蔄荏pg_resetxlog 婉嘪䫘䯇嵄埻麟 PGDATA 嘹媙釂婘变傴臯婪弄滯昄扞䕞嘘㔗
套悩 pg_resetxlog 檌攘臘垄方濘彴桺䫘庯 pg_control 䔇橬昽昄扞闼幽嘹埇傖嚺彽垄䂓䂺崇䊖桹濘滇弄滯 -f(嚺彽)嚔噿㔗婘認䓉愙喕婋闼底婵崌庖䔇昄扞儖䫘昇俪䔇誏嚚昄唚傼敪㔗崓崔昄庖枕鄘埇傖对陉婪嘖滇婋婔婻 OID 㔕婋婔婻庋媇 ID 㔕婋婔婻庋媇 ID 䔇 epoch(施閘䗹)㔕婋婔婻崔庋媇 ID(婴黽枕柊庴䔇婩薪)㔕婋婔婻崔庋媇啟䓂麟㔕WAL 嚔哋婄应㔕昄扞康寺嘘庖枕埇脘驔襕欋噖婞媷嬉麵噺婻埇傖䫘婋麵螘螺䔇嚔噿螆䘞㔗pg_resetxlog 躻噌䔇䯇嵄滇䯩敋寺嘘庖枕䔇準溊䩋䩋 LANG 京婩薪垄傸庫臖启 initdb 誊臯䔇䯇嵄䕩对陉㔗套悩嘹婉脘彴桺欔橬認底庖枕䔇溼䇞昄唚闼幽 -f 傉䇽埇傖嘪䫘嘖滇認湙敵崉誺準䔇昄扞康溼䇞攓敘唚冖攔䡏䆋剿蘸嗘启麉桄媹蘘滇媙釂䔇㔗婘蘸嗘幋嬉婉襕欓臯傂嘘媞櫹昄扞䔇淉嘩啹婺傂嘘認湙䔇媘嘩鄘埇脘檪庋愙抂冖敘俘俘㔗
-o, -x, -e, -m, -O, -l 嚔噿噕螩欋噖螆䘞婋婔婻 OID 㔕婋婔婻庋媇 ID 㔕婋婔婻庋媇 ID epoch 㔕婋婔婻崔庋媇 ID 㔕婋婔婻崔庋媇啟䓂麟㔕WAL 蕙哋嘉䘞䔇昄唚㔗埻橬婘 pg_resetxlog 方濘锔誺臂埡 pg_control 彴桺劽锗䔇昄唚䔇施唍欉驔襕垄㔗垬噘䔇昄唚埇傖䫘婋麵䔇桹濘彴桺
凹庯婋婔婻庋媇 ID(-x)蔯蘔婔婻垬噘䔇昄唚滇䩋䩋昄扞䕞嘘麯䔇 pg_clog 麯昄唚橔崓䔇桺傽劉䇽劯媹婔䇽劯喉幻婪 1048576 㔗臙濘懟闼底桺傽劉滇剕噺誕彽䔇㔗锔婩幘傖剕噺誕彽䔇嘵嚟弄滯嚔噿唚滇橔䞔剘䔇㔗懫套套悩 0011 滇 pg_clog 麯橔崓䔇螄嘘-x 0x1200000 儌埇傖庖(劯麵䔇庫婻镽柊冕庖劽锗䔇幻䓇)㔗
婋婔婻崔庋媇 ID(-m)䔇垬噘唚埇傖锔誺昖䩋昄扞䕞嘘麯 pg_multixact/offsets 床䕞嘘麯麵䔇昄庖橔崓䔇桺傽劉媹婔䇽劯幻傖 65536 冖彄㔗启婪麵婔湙桺傽劉滇剕噺誕彽䔇啹溴橔䞔剘䔇桹濘滇䂍嚔噿弄滯婔婻剕噺誕彽䔇嚔噿唚䇽劯婘䂷儆媹啕婻镽㔗
婋婔婻崔庋媇啟䓂麟(-O)䔇垬噘唚埇傖锔誺演昖昄扞䕞嘘麯 pg_multixact/members 床䕞嘘婋䔇昄庖橔崓䔇桺傽劉媹婔䇽劯幻傖 65536 冖彄㔗启婪麵婔湙桺傽劉滇剕噺誕彽䔇啹溴橔䞔剘䔇桹濘滇䂍嚔噿弄滯婔婻剕噺誕彽䔇嚔噿唚䇽劯婘䂷儆媹啕婻镽㔗
WAL 䔇蕙哋嘉䘞(-l)庫臖懫䕞嬉庻婘庯昄扞䕞嘘 pg_xlog 麯麵䔇傂嘘桺傽埙鄘崓㔗垄䔇桺傽劉幘滇剕噺誕彽䔇幽婫橬婬鄘彖㔗丸婔鄘彖滇"施閘亪 ID"锔婩庫臖媺毕䕩劯㔗丸婬鄘彖婉襕锬拷崓庯 255(0xFF)庫臖滇婘膆彄 255 䔇施唍䂍丸庯鄘彖嵂婔䇽劯麉䘞丸婬鄘彖婺 0 㔗懫套套悩 00000001000000320000004A 滇 pg_xlog 麯橔崓䔇溇䕞闼幽 -l 0x1,0x32,0x4B 儌埇傖庖嘖套悩橔崓䔇溇䕞滇 000000010000003A000000FF 闼幽锬拷 -l 0x1,0x3B,0x0 潡敘崔㔗
澇橬冽垹滷䔇媂濘準彴桺懫昄扞康婺橔崓䔇 OID 崓婔埙䔇婋婔婻 OID 婉誺冽蕄誊䔇滇诙埡溼䇞䔇婋婔婻 OID 幽麂麂婩噿髞䔇庋愙㔗
鍴庖䫌 pg_resetxlog 螆垔䔇庖枕崡庋媇 ID epoch 垂鍙婪幽橻庻嗘婘昄扞康麯䔇傂嘘婄桹㔗欔傖埻襕滇潬埪彄昄扞康躻躆䔇傂嘘昄唚鄘橬昽㔗嘹埇脘驔襕脄昘認婻唚傖䇞媺臩套 Slony-I 幋䌂䔇崺傘係䂘脘崘溼婩噖嘩㔗套悩滇認湙䔇臺庫嘷傯婋橩噾崉彽䔇昄扞康婺诙埡敄嘷䔇唚㔗
-n(方淉嘩)嚔噿毺䴺 pg_resetxlog 欷剄傯 pg_control 麉桄悇锹䔇昄唚䇽劯婉媞櫹傂嘘唚儌锔庺㔗認婂襕滇婔婻脄臘噖噙嘖滇婘 pg_resetxlog 䩘溼崇䊖嬉誕臯䔇昘昕攓演昖䔇施唍埇脘嚔橬䫘㔗