{"kind": "tool", "major": "18", "item": {"slug": "pg-resetwal", "name": "pg_resetwal", "name_zh": "", "category": "\u670d\u52a1\u7aef\u7a0b\u5e8f", "summary": "pg_resetwal \u2014 \u91cd\u7f6e PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f", "aliases": ["pg_resetwal"], "content_hash": "b513620305cf67e7e2c2f7732d5c5589f63a4d8cdde61087c04479a5396b71ab", "versions": {"10": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_resetwal"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "10.23"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "12"}], "tables": [{"key": "options", "rows": [{"summary": "\u5982\u4e0a\u6240\u8ff0\uff0c\u5373\u4f7f pg_resetwal \u65e0\u6cd5\u786e\u5b9a pg_control \u7684\u6709\u6548\u6570\u636e\uff0c\u4e5f\u5f3a\u5236\u5176\u7ee7\u7eed\u6267\u884c\u3002", "signature": {"url": "/docs/10/app-pgresetwal.html", "text": "-f"}}, {"summary": "-n \uff08\u4e0d\u6267\u884c\u64cd\u4f5c\uff09\u9009\u9879\u6307\u793a pg_resetwal \u6253\u5370\u4ece pg_control \u91cd\u5efa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u9000\u51fa\uff0c\u4e0d\u4fee\u6539\u4efb\u4f55\u5185\u5bb9\u3002\u8fd9\u4e3b\u8981\u662f\u4e00\u4e2a\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u5141\u8bb8 pg_resetwal \u771f\u6b63\u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u4ee5\u7528\u5b83\u8fdb\u884c\u5408\u7406\u6027\u68c0\u67e5\u3002", "signature": {"url": "/docs/10/app-pgresetwal.html", "text": "-n"}}, {"summary": "\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/10/app-pgresetwal.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/10/app-pgresetwal.html", "text": "-? --help"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/10/app-pgresetwal.html", "text": "-c xid , xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002", "signature": {"url": "/docs/10/app-pgresetwal.html", "text": "-e xid_epoch"}}, {"summary": "\u624b\u52a8\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002", "signature": {"url": "/docs/10/app-pgresetwal.html", "text": "-l walfile"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/10/app-pgresetwal.html", "text": "-m mxid , mxid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002", "signature": {"url": "/docs/10/app-pgresetwal.html", "text": "-o oid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002", "signature": {"url": "/docs/10/app-pgresetwal.html", "text": "-O mxoff"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/10/app-pgresetwal.html", "text": "-u xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/10/app-pgresetwal.html", "text": "-x xid"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}], "options": [{"names": ["-f"], "summary": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above.", "signature": "-f", "source_url": "/docs/10/app-pgresetwal.html", "description": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above."}, {"names": ["-n"], "summary": "The -n (no operation) option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "signature": "-n", "source_url": "/docs/10/app-pgresetwal.html", "description": "The -n (no operation) option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "summary": "Display version information, then exit.", "signature": "-V --version", "source_url": "/docs/10/app-pgresetwal.html", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "summary": "Show help, then exit.", "signature": "-? --help", "source_url": "/docs/10/app-pgresetwal.html", "description": "Show help, then exit."}, {"names": ["-c"], "summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "signature": "-c xid , xid", "source_url": "/docs/10/app-pgresetwal.html", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e"], "summary": "Manually set the next transaction ID's epoch.", "signature": "-e xid_epoch", "source_url": "/docs/10/app-pgresetwal.html", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l"], "summary": "Manually set the WAL starting address.", "signature": "-l walfile", "source_url": "/docs/10/app-pgresetwal.html", "description": "Manually set the WAL starting address. The WAL starting address should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m"], "summary": "Manually set the next and oldest multitransaction ID.", "signature": "-m mxid , mxid", "source_url": "/docs/10/app-pgresetwal.html", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o"], "summary": "Manually set the next OID.", "signature": "-o oid", "source_url": "/docs/10/app-pgresetwal.html", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O"], "summary": "Manually set the next multitransaction offset.", "signature": "-O mxoff", "source_url": "/docs/10/app-pgresetwal.html", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["-u xid"], "summary": "Manually set the oldest unfrozen transaction ID.", "signature": "-u xid", "source_url": "/docs/10/app-pgresetwal.html", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x"], "summary": "Manually set the next transaction ID.", "signature": "-x xid", "source_url": "/docs/10/app-pgresetwal.html", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.bz2", "label": "10.23", "major": "10", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/10/postgresql-10-A4.pdf", "bytes": 12631706, "pages": 2591, "sha256": "34497ab9efb45c5bdf1bd11b9016b5451354feb462fa029cf74557a5fa5fbbc1", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/10/postgresql-10-US.pdf", "bytes": 12531684, "pages": 2724, "sha256": "429cc7133ddf4f97c560aa466dc9caea4b718721a8321e293357037cf0af4733", "built_at": "2026-09-26"}}, "tree": "10", "index": "index.html", "major": "10", "pages": 1085, "release": "10.23", "source_url": "https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.bz2", "svg_assets": 0, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9"}, "revision": "f9301feba91e2e2566038a36b8cee0e4402db68989538f88670fddd20b1f78ea", "evidence_kind": "English manual and source declarations", "source_sha256": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9"}, "sources": [{"url": "https://pg.center/docs/10/app-pgresetwal.html", "file": "app-pgresetwal.html", "label": "10.23 English manual \u00b7 app-pgresetwal.html", "anchor": "", "sha256": "a4826a13c3abe474166187a827b7881b6ed79aca9a16c8931ff7a6e63e2ab343", "language": "en", "original_url": "/docs/10/app-pgresetwal.html"}, {"url": "https://pg.center/docs/10/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "2a6043b88501763a31348758a370a42cd7f9a179c7fdf3ef0e353c82e95b33e9", "language": "en", "original_url": "/docs/10/reference-server.html"}], "sections": [], "synopsis": ["pg_resetwal [ -f ] [ -n ] [ option ...] {[ -D ] datadir }"], "signature": "pg_resetwal [ -f ] [ -n ] [ option ...] {[ -D ] datadir }", "description": ["pg_resetwal \u2014 \u91cd\u7f6e PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f"], "environment": [], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESETWAL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_resetwal</span></span></h2>\n<p lang=\"zh\">pg_resetwal \u2014 \u91cd\u7f6e <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.7.4.1\"><code class=\"command\">pg_resetwal</code> [<code class=\"option\">-f</code>] [<code class=\"option\">-n</code>] [<em class=\"replaceable\"><code>option</code></em>...] {[<code class=\"option\">-D</code>] <em class=\"replaceable\"><code>datadir</code></em>}</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PGRESETWAL-1\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4f1a\u6e05\u9664\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\uff0c\u5e76\u53ef\u9009\u62e9\u6027\u5730\u91cd\u7f6e\u5b58\u50a8\u5728 <code class=\"filename\">pg_control</code> \u6587\u4ef6\u4e2d\u7684\u67d0\u4e9b\u5176\u4ed6\u63a7\u5236\u4fe1\u606f\u3002\u5982\u679c\u8fd9\u4e9b\u6587\u4ef6\u5df2\u7ecf\u635f\u574f\uff0c\u6709\u65f6\u5c31\u9700\u8981\u4f7f\u7528\u6b64\u529f\u80fd\u3002\u53ea\u6709\u5f53\u670d\u52a1\u5668\u56e0\u8fd9\u7c7b\u635f\u574f\u800c\u65e0\u6cd5\u542f\u52a8\u65f6\uff0c\u624d\u5e94\u5c06\u5176\u4f5c\u4e3a\u6700\u540e\u624b\u6bb5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u8fd0\u884c\u6b64\u547d\u4ee4\u540e\uff0c\u670d\u52a1\u5668\u5e94\u8be5\u53ef\u4ee5\u542f\u52a8\uff1b\u4f46\u8bf7\u8bb0\u4f4f\uff0c\u7531\u4e8e\u4ec5\u90e8\u5206\u63d0\u4ea4\u7684\u4e8b\u52a1\uff0c\u6570\u636e\u5e93\u4e2d\u53ef\u80fd\u542b\u6709\u4e0d\u4e00\u81f4\u7684\u6570\u636e\u3002\u5e94\u7acb\u5373\u8f6c\u50a8\u6570\u636e\uff0c\u8fd0\u884c <code class=\"command\">initdb</code>\uff0c\u7136\u540e\u6062\u590d\u3002\u6062\u590d\u540e\uff0c\u8bf7\u68c0\u67e5\u662f\u5426\u5b58\u5728\u4e0d\u4e00\u81f4\u5e76\u6309\u9700\u4fee\u590d\u3002</p>\n<p lang=\"zh\">\u6b64\u5de5\u5177\u53ea\u80fd\u7531\u5b89\u88c5\u670d\u52a1\u5668\u7684\u7528\u6237\u8fd0\u884c\uff0c\u56e0\u4e3a\u5b83\u9700\u8981\u5bf9\u6570\u636e\u76ee\u5f55\u7684\u8bfb\u5199\u8bbf\u95ee\u6743\u9650\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002<code class=\"command\">pg_resetwal</code>\u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATA</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c <code class=\"command\">pg_resetwal</code> \u62a5\u544a\u65e0\u6cd5\u786e\u5b9a <code class=\"filename\">pg_control</code> \u7684\u6709\u6548\u6570\u636e\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u5f3a\u884c\u7ee7\u7eed\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u7f3a\u5931\u7684\u6570\u636e\u5c06\u4ee5\u770b\u4f3c\u5408\u7406\u7684\u503c\u4ee3\u66ff\u3002\u5927\u591a\u6570\u5b57\u6bb5\u9884\u8ba1\u90fd\u80fd\u5339\u914d\uff0c\u4f46\u5bf9\u4e8e\u4e0b\u4e00\u4e2a OID\u3001\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u53ca\u5176\u7eaa\u5143\u3001\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID \u53ca\u5176\u504f\u79fb\u91cf\uff0c\u4ee5\u53ca WAL \u8d77\u59cb\u4f4d\u7f6e\u5b57\u6bb5\uff0c\u53ef\u80fd\u4ecd\u9700\u8981\u4eba\u5de5\u534f\u52a9\u3002\u8fd9\u4e9b\u5b57\u6bb5\u53ef\u901a\u8fc7\u4e0b\u6587\u8ba8\u8bba\u7684\u9009\u9879\u6765\u8bbe\u7f6e\u3002\u5982\u679c\u65e0\u6cd5\u4e3a\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u786e\u5b9a\u6b63\u786e\u503c\uff0c\u4ecd\u7136\u53ef\u4ee5\u4f7f\u7528 <code class=\"option\">-f</code>\uff0c\u4f46\u6062\u590d\u5f97\u5230\u7684\u6570\u636e\u5e93\u5fc5\u987b\u6bd4\u5e73\u65f6\u66f4\u53d7\u6000\u7591\uff1a\u7acb\u5373\u8f6c\u50a8\u5e76\u6062\u590d\u52bf\u5728\u5fc5\u884c\u3002<span class=\"emphasis\"><em>\u5207\u52ff</em></span>\u5728\u5b8c\u6210\u8f6c\u50a8\u4e4b\u524d\u5bf9\u6570\u636e\u5e93\u6267\u884c\u4efb\u4f55\u4fee\u6539\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u56e0\u4e3a\u4efb\u4f55\u6b64\u7c7b\u64cd\u4f5c\u90fd\u5f88\u53ef\u80fd\u4f7f\u635f\u574f\u8fdb\u4e00\u6b65\u6076\u5316\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.7.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-f</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u4e0a\u6240\u8ff0\uff0c\u5373\u4f7f<code class=\"command\">pg_resetwal</code>\u65e0\u6cd5\u786e\u5b9a<code class=\"filename\">pg_control</code>\u7684\u6709\u6548\u6570\u636e\uff0c\u4e5f\u5f3a\u5236\u5176\u7ee7\u7eed\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"option\">-n</code>\uff08\u4e0d\u6267\u884c\u64cd\u4f5c\uff09\u9009\u9879\u6307\u793a<code class=\"command\">pg_resetwal</code>\u6253\u5370\u4ece<code class=\"filename\">pg_control</code>\u91cd\u5efa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u9000\u51fa\uff0c\u4e0d\u4fee\u6539\u4efb\u4f55\u5185\u5bb9\u3002\u8fd9\u4e3b\u8981\u662f\u4e00\u4e2a\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u5141\u8bb8<code class=\"command\">pg_resetwal</code>\u771f\u6b63\u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u4ee5\u7528\u5b83\u8fdb\u884c\u5408\u7406\u6027\u68c0\u67e5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u9009\u9879\u4ec5\u5728 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u901a\u8fc7\u8bfb\u53d6 <code class=\"filename\">pg_control</code> \u786e\u5b9a\u9002\u5f53\u503c\u65f6\u624d\u9700\u8981\u4f7f\u7528\u3002\u5b89\u5168\u503c\u53ef\u6309\u4e0b\u8ff0\u65b9\u6cd5\u786e\u5b9a\u3002\u5bf9\u4e8e\u63a5\u53d7\u6570\u5b57\u53c2\u6570\u7684\u9009\u9879\uff0c\u53ef\u4f7f\u7528\u524d\u7f00 <code class=\"literal\">0x</code> \u6307\u5b9a\u5341\u516d\u8fdb\u5236\u503c\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c</code> <em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e00\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_commit_ts</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u76f8\u53cd\uff0c\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65b0\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e8c\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u5747\u4e3a\u5341\u516d\u8fdb\u5236\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code> <em class=\"replaceable\"><code>xid_epoch</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002</p>\n<p lang=\"zh\">\u4e8b\u52a1 ID \u7eaa\u5143\u5b9e\u9645\u4e0a\u5e76\u672a\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u4efb\u4f55\u5730\u65b9\uff0c\u9664\u4e86\u7531 <code class=\"command\">pg_resetwal</code> \u8bbe\u7f6e\u7684\u8fd9\u4e2a\u5b57\u6bb5\uff0c\u56e0\u6b64\u5c31\u6570\u636e\u5e93\u672c\u8eab\u800c\u8a00\uff0c\u4efb\u4f55\u503c\u90fd\u53ef\u7528\u3002\u53ef\u80fd\u9700\u8981\u8c03\u6574\u8be5\u503c\uff0c\u4ee5\u786e\u4fdd <span class=\"application\">Slony-I</span> \u548c <span class=\"application\">Skytools</span> \u7b49\u590d\u5236\u7cfb\u7edf\u6b63\u5e38\u5de5\u4f5c \u2014 \u5982\u679c\u786e\u6709\u9700\u8981\uff0c\u5e94\u8be5\u53ef\u4ee5\u4ece\u4e0b\u6e38\u590d\u5236\u6570\u636e\u5e93\u7684\u72b6\u6001\u4e2d\u83b7\u5f97\u5408\u9002\u7684\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code> <em class=\"replaceable\"><code>walfile</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u52a8\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">WAL \u8d77\u59cb\u4f4d\u7f6e\u5e94\u5927\u4e8e\u6570\u636e\u76ee\u5f55\u4e0b<code class=\"filename\">pg_wal</code>\u76ee\u5f55\u4e2d\u5f53\u524d\u5b58\u5728\u7684\u4efb\u4f55 WAL \u6bb5\u6587\u4ef6\u540d\u3002\u8fd9\u4e9b\u540d\u79f0\u4e5f\u4ee5\u5341\u516d\u8fdb\u5236\u8868\u793a\uff0c\u5e76\u5305\u542b\u4e09\u90e8\u5206\u3002\u7b2c\u4e00\u90e8\u5206\u662f<span class=\"quote\">\u201c<span class=\"quote\">\u65f6\u95f4\u7ebf ID</span>\u201d</span>\uff0c\u901a\u5e38\u5e94\u4fdd\u6301\u4e0d\u53d8\u3002\u4f8b\u5982\uff0c\u5982\u679c<code class=\"filename\">00000001000000320000004A</code>\u662f<code class=\"filename\">pg_wal</code>\u4e2d\u7684\u6700\u5927\u6761\u76ee\uff0c\u5c31\u4f7f\u7528<code class=\"literal\">-l 00000001000000320000004B</code>\u6216\u66f4\u5927\u7684\u503c\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">pg_resetwal \u81ea\u8eab\u4f1a\u68c0\u67e5 pg_wal \u4e2d\u7684\u6587\u4ef6\uff0c\u5e76\u4e3a -l \u9009\u62e9\u4e00\u4e2a\u8d85\u8fc7\u73b0\u6709\u6700\u540e\u4e00\u4e2a\u6587\u4ef6\u540d\u7684\u9ed8\u8ba4\u503c\u3002\u56e0\u6b64\uff0c\u53ea\u6709\u5728\u786e\u5b9a\u5b58\u5728\u5f53\u524d\u4e0d\u5728 pg_wal \u4e2d\u7684 WAL \u6bb5\u6587\u4ef6\uff08\u4f8b\u5982\u79bb\u7ebf\u5f52\u6863\u4e2d\u7684\u6587\u4ef6\uff09\uff0c\u6216 pg_wal \u7684\u5185\u5bb9\u5b8c\u5168\u4e22\u5931\u65f6\uff0c\u624d\u5e94\u8be5\u9700\u8981\u624b\u52a8\u8c03\u6574 -l\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-m</code> <em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u8981\u786e\u5b9a\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID\uff08\u7b2c\u4e00\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u5728\u6570\u636e\u76ee\u5f55\u4e0b\u7684 pg_multixact/offsets \u76ee\u5f55\u4e2d\u627e\u5230\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5c06\u5176\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 65536\uff080x10000\uff09\u3002\u76f8\u5e94\u5730\uff0c\u8981\u786e\u5b9a\u6700\u65e7\u591a\u4e8b\u52a1 ID\uff08-m \u7684\u7b2c\u4e8c\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u627e\u5230\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 65536\u3002\u6587\u4ef6\u540d\u4f7f\u7528\u5341\u516d\u8fdb\u5236\uff0c\u56e0\u6b64\u6700\u7b80\u5355\u7684\u505a\u6cd5\u662f\u4ee5\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u9009\u9879\u503c\uff0c\u5e76\u5728\u672b\u5c3e\u6dfb\u52a0\u56db\u4e2a\u96f6\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o</code> <em class=\"replaceable\"><code>oid</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002</p>\n<p lang=\"zh\">\u5e76\u6ca1\u6709\u540c\u6837\u7b80\u5355\u7684\u65b9\u6cd5\u6765\u786e\u5b9a\u4e00\u4e2a\u8d85\u51fa\u6570\u636e\u5e93\u4e2d\u6700\u5927 OID \u7684\u4e0b\u4e00\u4e2a OID\uff0c\u4e0d\u8fc7\u5e78\u8fd0\u7684\u662f\uff0c\u4e0b\u4e00\u4e2a OID \u7684\u8bbe\u7f6e\u662f\u5426\u7cbe\u786e\u5e76\u4e0d\u5173\u952e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O</code> <em class=\"replaceable\"><code>mxoff</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_multixact/members</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 52352 (0xCC80) \u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u8fd9\u91cc\u6ca1\u6709\u50cf\u5176\u4ed6\u9009\u9879\u90a3\u6837\u901a\u8fc7\u8ffd\u52a0\u96f6\u5373\u53ef\u5f97\u5230\u7ed3\u679c\u7684\u7b80\u5355\u65b9\u6cd5\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-u <em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0007</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5c0f\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-u 0x700000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code> <em class=\"replaceable\"><code>xid</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0011</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-x 0x1200000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.7.7\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u670d\u52a1\u5668\u8fd0\u884c\u671f\u95f4\u4e0d\u5f97\u4f7f\u7528\u6b64\u547d\u4ee4\u3002\u5982\u679c\u5728\u6570\u636e\u76ee\u5f55\u4e2d\u53d1\u73b0\u670d\u52a1\u5668\u9501\u6587\u4ef6\uff0c<code class=\"command\">pg_resetwal</code> \u5c06\u62d2\u7edd\u542f\u52a8\u3002\u5982\u679c\u670d\u52a1\u5668\u66fe\u5d29\u6e83\uff0c\u53ef\u80fd\u9057\u7559\u9501\u6587\u4ef6\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5220\u9664\u8be5\u9501\u6587\u4ef6\u4ee5\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u8fd0\u884c\u3002\u4f46\u5728\u8fd9\u6837\u505a\u4e4b\u524d\uff0c\u52a1\u5fc5\u518d\u4e09\u786e\u8ba4\u6ca1\u6709\u4efb\u4f55\u670d\u52a1\u5668\u8fdb\u7a0b\u4ecd\u5728\u8fd0\u884c\u3002</p>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4ec5\u9002\u7528\u4e8e\u76f8\u540c\u4e3b\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.7.8\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2>\n<span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/10/app-pgcontroldata.html\" title=\"pg_controldata\"><span class=\"refentrytitle\"><span class=\"application\">pg_controldata</span></span></a></span></div>\n</div></div>", "manual_path": "app-pgresetwal.html", "localization": {"status": "complete", "sources": [{"url": "/docs/10/app-pgresetwal.html", "method": "same-major semantic node", "sha256": "528d9c27f01713174ce1ac5a933a89846e5558ca0bcf67ab5f566723977050fc", "language": "zh", "matched_nodes": ["#APP-PGRESETWAL/div[2]/p[1]", "#APP-PGRESETWAL/div[3]/h2[0]", "#APP-PGRESETWAL/div[4]/p[1]", "#APP-PGRESETWAL/div[4]/p[2]", "#APP-PGRESETWAL/div[4]/p[3]", "#APP-PGRESETWAL/div[4]/p[4]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[7]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/div[2]/h3[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[7]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[1]", "#APP-PGRESETWAL/div[5]/p[2]", "#APP-PGRESETWAL/div[6]/h2[0]", "#APP-PGRESETWAL/div[6]/p[1]", "#APP-PGRESETWAL/div[6]/p[2]", "#APP-PGRESETWAL/div[7]/h2[0]"]}], "language": "zh", "original_text": {"/versions/10/description/0": "pg_resetwal \u2014 reset the write-ahead log and other control information of a PostgreSQL database cluster", "/versions/10/facts/0/label": "Documented executable", "/versions/10/facts/1/label": "Executable version", "/versions/10/facts/2/label": "Reference inventory", "/versions/10/facts/2/value": "Server applications", "/versions/10/facts/3/label": "Option definition groups", "/versions/10/tables/0/title": "Documented options", "/versions/10/tables/0/rows/0/summary": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above.", "/versions/10/tables/0/rows/1/summary": "The -n (no operation) option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "/versions/10/tables/0/rows/2/summary": "Display version information, then exit.", "/versions/10/tables/0/rows/3/summary": "Show help, then exit.", "/versions/10/tables/0/rows/4/summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "/versions/10/tables/0/rows/5/summary": "Manually set the next transaction ID's epoch.", "/versions/10/tables/0/rows/6/summary": "Manually set the WAL starting address.", "/versions/10/tables/0/rows/7/summary": "Manually set the next and oldest multitransaction ID.", "/versions/10/tables/0/rows/8/summary": "Manually set the next OID.", "/versions/10/tables/0/rows/9/summary": "Manually set the next multitransaction offset.", "/versions/10/tables/0/columns/0/label": "Option and arguments", "/versions/10/tables/0/columns/1/label": "Description", "/versions/10/tables/0/rows/10/summary": "Manually set the oldest unfrozen transaction ID.", "/versions/10/tables/0/rows/11/summary": "Manually set the next transaction ID."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "3d171be9083353ac978ed6f092dae2b3144ab71b26cc28cba6b26002daa42225"}, "comparison_data": {"options": [{"names": ["-f"], "signature": "-f", "description": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above."}, {"names": ["-n"], "signature": "-n", "description": "The -n (no operation) option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help, then exit."}, {"names": ["-c"], "signature": "-c xid , xid", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e"], "signature": "-e xid_epoch", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l"], "signature": "-l walfile", "description": "Manually set the WAL starting address. The WAL starting address should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m"], "signature": "-m mxid , mxid", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o"], "signature": "-o oid", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O"], "signature": "-O mxoff", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["-u xid"], "signature": "-u xid", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x"], "signature": "-x xid", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}], "synopsis": ["pg_resetwal [ -f ] [ -n ] [ option ...] {[ -D ] datadir }"], "environment": []}, "comparison_hash": "87e4873e91ae8c87638ede399bedc1c8aa5f7d4790a77b11fb558a296e0fa027", "manual_language": "zh"}, "11": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_resetwal"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "11.22"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "13"}], "tables": [{"key": "options", "rows": [{"summary": "\u5982\u4e0a\u6240\u8ff0\uff0c\u5373\u4f7f pg_resetwal \u65e0\u6cd5\u786e\u5b9a pg_control \u7684\u6709\u6548\u6570\u636e\uff0c\u4e5f\u5f3a\u5236\u5176\u7ee7\u7eed\u6267\u884c\u3002", "signature": {"url": "/docs/11/app-pgresetwal.html", "text": "-f --force"}}, {"summary": "-n / --dry-run \u9009\u9879\u4f1a\u8ba9 pg_resetwal \u6253\u5370\u4ece pg_control \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 pg_resetwal \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002", "signature": {"url": "/docs/11/app-pgresetwal.html", "text": "-n --dry-run"}}, {"summary": "\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/11/app-pgresetwal.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/11/app-pgresetwal.html", "text": "-? --help"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/11/app-pgresetwal.html", "text": "-c xid , xid --commit-timestamp-ids= xid , xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002", "signature": {"url": "/docs/11/app-pgresetwal.html", "text": "-e xid_epoch --epoch= xid_epoch"}}, {"summary": "\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002", "signature": {"url": "/docs/11/app-pgresetwal.html", "text": "-l walfile --next-wal-file= walfile"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/11/app-pgresetwal.html", "text": "-m mxid , mxid --multixact-ids= mxid , mxid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002", "signature": {"url": "/docs/11/app-pgresetwal.html", "text": "-o oid --next-oid= oid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002", "signature": {"url": "/docs/11/app-pgresetwal.html", "text": "-O mxoff --multixact-offset= mxoff"}}, {"summary": "\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002", "signature": {"url": "/docs/11/app-pgresetwal.html", "text": "--wal-segsize= wal_segment_size"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/11/app-pgresetwal.html", "text": "-u xid --oldest-transaction-id= xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/11/app-pgresetwal.html", "text": "-x xid --next-transaction-id= xid"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}], "options": [{"names": ["-f", "--force"], "summary": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above.", "signature": "-f --force", "source_url": "/docs/11/app-pgresetwal.html", "description": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above."}, {"names": ["-n", "--dry-run"], "summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "signature": "-n --dry-run", "source_url": "/docs/11/app-pgresetwal.html", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "summary": "Display version information, then exit.", "signature": "-V --version", "source_url": "/docs/11/app-pgresetwal.html", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "summary": "Show help, then exit.", "signature": "-? --help", "source_url": "/docs/11/app-pgresetwal.html", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "source_url": "/docs/11/app-pgresetwal.html", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "summary": "Manually set the next transaction ID's epoch.", "signature": "-e xid_epoch --epoch= xid_epoch", "source_url": "/docs/11/app-pgresetwal.html", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "signature": "-l walfile --next-wal-file= walfile", "source_url": "/docs/11/app-pgresetwal.html", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "summary": "Manually set the next and oldest multitransaction ID.", "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "source_url": "/docs/11/app-pgresetwal.html", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "summary": "Manually set the next OID.", "signature": "-o oid --next-oid= oid", "source_url": "/docs/11/app-pgresetwal.html", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "summary": "Manually set the next multitransaction offset.", "signature": "-O mxoff --multixact-offset= mxoff", "source_url": "/docs/11/app-pgresetwal.html", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["--wal-segsize= wal_segment_size"], "summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "signature": "--wal-segsize= wal_segment_size", "source_url": "/docs/11/app-pgresetwal.html", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "summary": "Manually set the oldest unfrozen transaction ID.", "signature": "-u xid --oldest-transaction-id= xid", "source_url": "/docs/11/app-pgresetwal.html", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "summary": "Manually set the next transaction ID.", "signature": "-x xid --next-transaction-id= xid", "source_url": "/docs/11/app-pgresetwal.html", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2", "label": "11.22", "major": "11", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/11/postgresql-11-A4.pdf", "bytes": 13057499, "pages": 2732, "sha256": "41d75855e610d0d9b8802b87dc5b080bef8d7e91c7cf69401fbf8d3cf801b4b5", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/11/postgresql-11-US.pdf", "bytes": 12961189, "pages": 2883, "sha256": "6a8899ef36935a5b7ed2b436207564a567a4ef1eb1c2200195876b8de4d4fa30", "built_at": "2026-09-26"}}, "tree": "11", "index": "index.html", "major": "11", "pages": 1125, "release": "11.22", "source_url": "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2", "svg_assets": 0, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0"}, "revision": "53315ddaf3b3f9e6669fd1edc096bbb2cd4a65ea3e836c89e542b43af9ba3a7f", "evidence_kind": "English manual and source declarations", "source_sha256": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0"}, "sources": [{"url": "https://pg.center/docs/11/app-pgresetwal.html", "file": "app-pgresetwal.html", "label": "11.22 English manual \u00b7 app-pgresetwal.html", "anchor": "", "sha256": "2d28b058764b1790c167f4839e20e0905714928c06cda8da1493a79564d2f8a6", "language": "en", "original_url": "/docs/11/app-pgresetwal.html"}, {"url": "https://pg.center/docs/11/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "e940a8505b6742c717a1683d19bf8f759aad245633a59db9e83a345ae7c5709a", "language": "en", "original_url": "/docs/11/reference-server.html"}], "sections": [], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "signature": "pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir", "description": ["pg_resetwal \u2014 \u91cd\u7f6e PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f"], "environment": [], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESETWAL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_resetwal</span></span></h2>\n<p lang=\"zh\">pg_resetwal \u2014 \u91cd\u7f6e <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.7.4.1\"><code class=\"command\">pg_resetwal</code> [ <code class=\"option\">-f</code> | <code class=\"option\">--force</code> ] [ <code class=\"option\">-n</code> | <code class=\"option\">--dry-run</code> ] [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">-D</code> | <code class=\"option\">--pgdata</code> ]<em class=\"replaceable\"><code>datadir</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PGRESETWAL-1\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4f1a\u6e05\u9664\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\uff0c\u5e76\u53ef\u9009\u62e9\u6027\u5730\u91cd\u7f6e\u5b58\u50a8\u5728 <code class=\"filename\">pg_control</code> \u6587\u4ef6\u4e2d\u7684\u67d0\u4e9b\u5176\u4ed6\u63a7\u5236\u4fe1\u606f\u3002\u5982\u679c\u8fd9\u4e9b\u6587\u4ef6\u5df2\u7ecf\u635f\u574f\uff0c\u6709\u65f6\u5c31\u9700\u8981\u4f7f\u7528\u6b64\u529f\u80fd\u3002\u53ea\u6709\u5f53\u670d\u52a1\u5668\u56e0\u8fd9\u7c7b\u635f\u574f\u800c\u65e0\u6cd5\u542f\u52a8\u65f6\uff0c\u624d\u5e94\u5c06\u5176\u4f5c\u4e3a\u6700\u540e\u624b\u6bb5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u8fd0\u884c\u6b64\u547d\u4ee4\u540e\uff0c\u670d\u52a1\u5668\u5e94\u8be5\u53ef\u4ee5\u542f\u52a8\uff1b\u4f46\u8bf7\u8bb0\u4f4f\uff0c\u7531\u4e8e\u4ec5\u90e8\u5206\u63d0\u4ea4\u7684\u4e8b\u52a1\uff0c\u6570\u636e\u5e93\u4e2d\u53ef\u80fd\u542b\u6709\u4e0d\u4e00\u81f4\u7684\u6570\u636e\u3002\u5e94\u7acb\u5373\u8f6c\u50a8\u6570\u636e\uff0c\u8fd0\u884c <code class=\"command\">initdb</code>\uff0c\u7136\u540e\u6062\u590d\u3002\u6062\u590d\u540e\uff0c\u8bf7\u68c0\u67e5\u662f\u5426\u5b58\u5728\u4e0d\u4e00\u81f4\u5e76\u6309\u9700\u4fee\u590d\u3002</p>\n<p lang=\"zh\">\u6b64\u5de5\u5177\u53ea\u80fd\u7531\u5b89\u88c5\u670d\u52a1\u5668\u7684\u7528\u6237\u8fd0\u884c\uff0c\u56e0\u4e3a\u5b83\u9700\u8981\u5bf9\u6570\u636e\u76ee\u5f55\u7684\u8bfb\u5199\u8bbf\u95ee\u6743\u9650\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002<code class=\"command\">pg_resetwal</code>\u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATA</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c <code class=\"command\">pg_resetwal</code> \u62a5\u544a\u65e0\u6cd5\u786e\u5b9a <code class=\"filename\">pg_control</code> \u7684\u6709\u6548\u6570\u636e\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u5f3a\u884c\u7ee7\u7eed\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u7f3a\u5931\u7684\u6570\u636e\u5c06\u4ee5\u770b\u4f3c\u5408\u7406\u7684\u503c\u4ee3\u66ff\u3002\u5927\u591a\u6570\u5b57\u6bb5\u9884\u8ba1\u90fd\u80fd\u5339\u914d\uff0c\u4f46\u5bf9\u4e8e\u4e0b\u4e00\u4e2a OID\u3001\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u53ca\u5176\u7eaa\u5143\u3001\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID \u53ca\u5176\u504f\u79fb\u91cf\uff0c\u4ee5\u53ca WAL \u8d77\u59cb\u4f4d\u7f6e\u5b57\u6bb5\uff0c\u53ef\u80fd\u4ecd\u9700\u8981\u4eba\u5de5\u534f\u52a9\u3002\u8fd9\u4e9b\u5b57\u6bb5\u53ef\u901a\u8fc7\u4e0b\u6587\u8ba8\u8bba\u7684\u9009\u9879\u6765\u8bbe\u7f6e\u3002\u5982\u679c\u65e0\u6cd5\u4e3a\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u786e\u5b9a\u6b63\u786e\u503c\uff0c\u4ecd\u7136\u53ef\u4ee5\u4f7f\u7528 <code class=\"option\">-f</code>\uff0c\u4f46\u6062\u590d\u5f97\u5230\u7684\u6570\u636e\u5e93\u5fc5\u987b\u6bd4\u5e73\u65f6\u66f4\u53d7\u6000\u7591\uff1a\u7acb\u5373\u8f6c\u50a8\u5e76\u6062\u590d\u52bf\u5728\u5fc5\u884c\u3002<span class=\"emphasis\"><em>\u5207\u52ff</em></span>\u5728\u5b8c\u6210\u8f6c\u50a8\u4e4b\u524d\u5bf9\u6570\u636e\u5e93\u6267\u884c\u4efb\u4f55\u4fee\u6539\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u56e0\u4e3a\u4efb\u4f55\u6b64\u7c7b\u64cd\u4f5c\u90fd\u5f88\u53ef\u80fd\u4f7f\u635f\u574f\u8fdb\u4e00\u6b65\u6076\u5316\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.7.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-f</code><br/></span><span class=\"term\"><code class=\"option\">--force</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u4e0a\u6240\u8ff0\uff0c\u5373\u4f7f<code class=\"command\">pg_resetwal</code>\u65e0\u6cd5\u786e\u5b9a<code class=\"filename\">pg_control</code>\u7684\u6709\u6548\u6570\u636e\uff0c\u4e5f\u5f3a\u5236\u5176\u7ee7\u7eed\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--dry-run</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"option\">-n</code>/<code class=\"option\">--dry-run</code> \u9009\u9879\u4f1a\u8ba9 <code class=\"command\">pg_resetwal</code> \u6253\u5370\u4ece <code class=\"filename\">pg_control</code> \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u9009\u9879\u4ec5\u5728 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u901a\u8fc7\u8bfb\u53d6 <code class=\"filename\">pg_control</code> \u786e\u5b9a\u9002\u5f53\u503c\u65f6\u624d\u9700\u8981\u4f7f\u7528\u3002\u5b89\u5168\u503c\u53ef\u6309\u4e0b\u8ff0\u65b9\u6cd5\u786e\u5b9a\u3002\u5bf9\u4e8e\u63a5\u53d7\u6570\u5b57\u53c2\u6570\u7684\u9009\u9879\uff0c\u53ef\u4f7f\u7528\u524d\u7f00 <code class=\"literal\">0x</code> \u6307\u5b9a\u5341\u516d\u8fdb\u5236\u503c\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--commit-timestamp-ids=<em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e00\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_commit_ts</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u76f8\u53cd\uff0c\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65b0\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e8c\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u5747\u4e3a\u5341\u516d\u8fdb\u5236\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e <em class=\"replaceable\"><code>xid_epoch</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--epoch=<em class=\"replaceable\"><code>xid_epoch</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002</p>\n<p lang=\"zh\">\u4e8b\u52a1 ID \u7eaa\u5143\u5b9e\u9645\u4e0a\u5e76\u672a\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u4efb\u4f55\u5730\u65b9\uff0c\u9664\u4e86\u7531 <code class=\"command\">pg_resetwal</code> \u8bbe\u7f6e\u7684\u8fd9\u4e2a\u5b57\u6bb5\uff0c\u56e0\u6b64\u5c31\u6570\u636e\u5e93\u672c\u8eab\u800c\u8a00\uff0c\u4efb\u4f55\u503c\u90fd\u53ef\u7528\u3002\u53ef\u80fd\u9700\u8981\u8c03\u6574\u8be5\u503c\uff0c\u4ee5\u786e\u4fdd <span class=\"application\">Slony-I</span> \u548c <span class=\"application\">Skytools</span> \u7b49\u590d\u5236\u7cfb\u7edf\u6b63\u5e38\u5de5\u4f5c \u2014 \u5982\u679c\u786e\u6709\u9700\u8981\uff0c\u5e94\u8be5\u53ef\u4ee5\u4ece\u4e0b\u6e38\u590d\u5236\u6570\u636e\u5e93\u7684\u72b6\u6001\u4e2d\u83b7\u5f97\u5408\u9002\u7684\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>walfile</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-wal-file=<em class=\"replaceable\"><code>walfile</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\u5e94\u5927\u4e8e\u5f53\u524d\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_wal</code> \u76ee\u5f55\u4e2d\u73b0\u5b58\u7684\u4efb\u610f WAL \u6bb5\u6587\u4ef6\u540d\u3002\u8fd9\u4e9b\u540d\u79f0\u540c\u6837\u91c7\u7528\u5341\u516d\u8fdb\u5236\uff0c\u5e76\u7531\u4e09\u4e2a\u90e8\u5206\u7ec4\u6210\u3002\u7b2c\u4e00\u90e8\u5206\u662f<span class=\"quote\">\u201c<span class=\"quote\">\u65f6\u95f4\u7ebf ID</span>\u201d</span>\uff0c\u901a\u5e38\u5e94\u4fdd\u6301\u4e0d\u53d8\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">00000001000000320000004A</code> \u662f <code class=\"filename\">pg_wal</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u5219\u5e94\u4f7f\u7528 <code class=\"literal\">-l 00000001000000320000004B</code> \u6216\u66f4\u5927\u7684\u503c\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u5728\u4f7f\u7528\u975e\u9ed8\u8ba4 WAL \u6bb5\u5927\u5c0f\u65f6\uff0cWAL \u6587\u4ef6\u540d\u4e2d\u7684\u6570\u5b57\u4e0e\u7cfb\u7edf\u51fd\u6570\u548c\u7cfb\u7edf\u89c6\u56fe\u62a5\u544a\u7684 LSN \u4e0d\u540c\u3002\u8be5\u9009\u9879\u63a5\u53d7\u7684\u662f WAL \u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f LSN\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">pg_resetwal \u81ea\u8eab\u4f1a\u68c0\u67e5 pg_wal \u4e2d\u7684\u6587\u4ef6\uff0c\u5e76\u4e3a -l \u9009\u62e9\u4e00\u4e2a\u8d85\u8fc7\u73b0\u6709\u6700\u540e\u4e00\u4e2a\u6587\u4ef6\u540d\u7684\u9ed8\u8ba4\u503c\u3002\u56e0\u6b64\uff0c\u53ea\u6709\u5728\u786e\u5b9a\u5b58\u5728\u5f53\u524d\u4e0d\u5728 pg_wal \u4e2d\u7684 WAL \u6bb5\u6587\u4ef6\uff08\u4f8b\u5982\u79bb\u7ebf\u5f52\u6863\u4e2d\u7684\u6587\u4ef6\uff09\uff0c\u6216 pg_wal \u7684\u5185\u5bb9\u5b8c\u5168\u4e22\u5931\u65f6\uff0c\u624d\u5e94\u8be5\u9700\u8981\u624b\u52a8\u8c03\u6574 -l\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-m <em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-ids=<em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u8981\u786e\u5b9a\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID\uff08\u7b2c\u4e00\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u5728\u6570\u636e\u76ee\u5f55\u4e0b\u7684 pg_multixact/offsets \u76ee\u5f55\u4e2d\u627e\u5230\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5c06\u5176\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 65536\uff080x10000\uff09\u3002\u76f8\u5e94\u5730\uff0c\u8981\u786e\u5b9a\u6700\u65e7\u591a\u4e8b\u52a1 ID\uff08-m \u7684\u7b2c\u4e8c\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u627e\u5230\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 65536\u3002\u6587\u4ef6\u540d\u4f7f\u7528\u5341\u516d\u8fdb\u5236\uff0c\u56e0\u6b64\u6700\u7b80\u5355\u7684\u505a\u6cd5\u662f\u4ee5\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u9009\u9879\u503c\uff0c\u5e76\u5728\u672b\u5c3e\u6dfb\u52a0\u56db\u4e2a\u96f6\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>oid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-oid=<em class=\"replaceable\"><code>oid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002</p>\n<p lang=\"zh\">\u5e76\u6ca1\u6709\u540c\u6837\u7b80\u5355\u7684\u65b9\u6cd5\u6765\u786e\u5b9a\u4e00\u4e2a\u8d85\u51fa\u6570\u636e\u5e93\u4e2d\u6700\u5927 OID \u7684\u4e0b\u4e00\u4e2a OID\uff0c\u4e0d\u8fc7\u5e78\u8fd0\u7684\u662f\uff0c\u4e0b\u4e00\u4e2a OID \u7684\u8bbe\u7f6e\u662f\u5426\u7cbe\u786e\u5e76\u4e0d\u5173\u952e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O <em class=\"replaceable\"><code>mxoff</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-offset=<em class=\"replaceable\"><code>mxoff</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_multixact/members</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 52352 (0xCC80) \u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u8fd9\u91cc\u6ca1\u6709\u50cf\u5176\u4ed6\u9009\u9879\u90a3\u6837\u901a\u8fc7\u8ffd\u52a0\u96f6\u5373\u53ef\u5f97\u5230\u7ed3\u679c\u7684\u7b80\u5355\u65b9\u6cd5\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>wal_segment_size</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u867d\u7136 <code class=\"command\">pg_resetwal</code> \u4f1a\u628a WAL \u8d77\u59cb\u4f4d\u7f6e\u8bbe\u7f6e\u5230\u8d85\u51fa\u73b0\u6709\u6700\u65b0 WAL \u6bb5\u6587\u4ef6\u7684\u4f4d\u7f6e\uff0c\u4f46\u67d0\u4e9b\u6bb5\u5927\u5c0f\u53d8\u66f4\u53ef\u80fd\u5bfc\u81f4\u65e7 WAL \u6587\u4ef6\u540d\u88ab\u91cd\u65b0\u4f7f\u7528\u3002\u5982\u679c WAL \u6587\u4ef6\u540d\u91cd\u53e0\u4f1a\u7ed9\u5f52\u6863\u7b56\u7565\u5e26\u6765\u95ee\u9898\uff0c\u5efa\u8bae\u5c06 <code class=\"option\">-l</code> \u4e0e\u6b64\u9009\u9879\u914d\u5408\u4f7f\u7528\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-u <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--oldest-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0007</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5c0f\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-u 0x700000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0011</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-x 0x1200000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.7.7\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u670d\u52a1\u5668\u8fd0\u884c\u671f\u95f4\u4e0d\u5f97\u4f7f\u7528\u6b64\u547d\u4ee4\u3002\u5982\u679c\u5728\u6570\u636e\u76ee\u5f55\u4e2d\u53d1\u73b0\u670d\u52a1\u5668\u9501\u6587\u4ef6\uff0c<code class=\"command\">pg_resetwal</code> \u5c06\u62d2\u7edd\u542f\u52a8\u3002\u5982\u679c\u670d\u52a1\u5668\u66fe\u5d29\u6e83\uff0c\u53ef\u80fd\u9057\u7559\u9501\u6587\u4ef6\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5220\u9664\u8be5\u9501\u6587\u4ef6\u4ee5\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u8fd0\u884c\u3002\u4f46\u5728\u8fd9\u6837\u505a\u4e4b\u524d\uff0c\u52a1\u5fc5\u518d\u4e09\u786e\u8ba4\u6ca1\u6709\u4efb\u4f55\u670d\u52a1\u5668\u8fdb\u7a0b\u4ecd\u5728\u8fd0\u884c\u3002</p>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4ec5\u9002\u7528\u4e8e\u76f8\u540c\u4e3b\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.7.8\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/11/app-pgcontroldata.html\" title=\"pg_controldata\"><span class=\"refentrytitle\"><span class=\"application\">pg_controldata</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgresetwal.html", "localization": {"status": "complete", "sources": [{"url": "/docs/11/app-pgresetwal.html", "method": "same-major semantic node", "sha256": "190b3aea28db8a9e6ec71a9a83e30d21e62a5a4323e0cc328099a2fcbc27e949", "language": "zh", "matched_nodes": ["#APP-PGRESETWAL/div[2]/p[1]", "#APP-PGRESETWAL/div[3]/h2[0]", "#APP-PGRESETWAL/div[4]/p[1]", "#APP-PGRESETWAL/div[4]/p[2]", "#APP-PGRESETWAL/div[4]/p[3]", "#APP-PGRESETWAL/div[4]/p[4]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[7]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/div[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/div[3]/h3[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[2]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[7]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[1]", "#APP-PGRESETWAL/div[5]/p[2]", "#APP-PGRESETWAL/div[6]/h2[0]", "#APP-PGRESETWAL/div[6]/p[1]", "#APP-PGRESETWAL/div[6]/p[2]", "#APP-PGRESETWAL/div[7]/h2[0]"]}], "language": "zh", "original_text": {"/versions/11/description/0": "pg_resetwal \u2014 reset the write-ahead log and other control information of a PostgreSQL database cluster", "/versions/11/facts/0/label": "Documented executable", "/versions/11/facts/1/label": "Executable version", "/versions/11/facts/2/label": "Reference inventory", "/versions/11/facts/2/value": "Server applications", "/versions/11/facts/3/label": "Option definition groups", "/versions/11/tables/0/title": "Documented options", "/versions/11/tables/0/rows/0/summary": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above.", "/versions/11/tables/0/rows/1/summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "/versions/11/tables/0/rows/2/summary": "Display version information, then exit.", "/versions/11/tables/0/rows/3/summary": "Show help, then exit.", "/versions/11/tables/0/rows/4/summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "/versions/11/tables/0/rows/5/summary": "Manually set the next transaction ID's epoch.", "/versions/11/tables/0/rows/6/summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "/versions/11/tables/0/rows/7/summary": "Manually set the next and oldest multitransaction ID.", "/versions/11/tables/0/rows/8/summary": "Manually set the next OID.", "/versions/11/tables/0/rows/9/summary": "Manually set the next multitransaction offset.", "/versions/11/tables/0/columns/0/label": "Option and arguments", "/versions/11/tables/0/columns/1/label": "Description", "/versions/11/tables/0/rows/10/summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "/versions/11/tables/0/rows/11/summary": "Manually set the oldest unfrozen transaction ID.", "/versions/11/tables/0/rows/12/summary": "Manually set the next transaction ID."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "72b53aba6154a33cebdd6221170c6412b9285dadfcb070db90f22e86d1b4d01e"}, "comparison_data": {"options": [{"names": ["-f", "--force"], "signature": "-f --force", "description": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above."}, {"names": ["-n", "--dry-run"], "signature": "-n --dry-run", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "signature": "-e xid_epoch --epoch= xid_epoch", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "signature": "-l walfile --next-wal-file= walfile", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "signature": "-o oid --next-oid= oid", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "signature": "-O mxoff --multixact-offset= mxoff", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["--wal-segsize= wal_segment_size"], "signature": "--wal-segsize= wal_segment_size", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "signature": "-u xid --oldest-transaction-id= xid", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "signature": "-x xid --next-transaction-id= xid", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "environment": []}, "comparison_hash": "07b0ba07ad755ac0fe1b497421822181b385113adaa7e17e28f93987bccfa350", "manual_language": "zh"}, "12": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_resetwal"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "12.22"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "13"}], "tables": [{"key": "options", "rows": [{"summary": "\u5982\u4e0a\u6240\u8ff0\uff0c\u5373\u4f7f pg_resetwal \u65e0\u6cd5\u786e\u5b9a pg_control \u7684\u6709\u6548\u6570\u636e\uff0c\u4e5f\u5f3a\u5236\u5176\u7ee7\u7eed\u6267\u884c\u3002", "signature": {"url": "/docs/12/app-pgresetwal.html", "text": "-f --force"}}, {"summary": "-n / --dry-run \u9009\u9879\u4f1a\u8ba9 pg_resetwal \u6253\u5370\u4ece pg_control \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 pg_resetwal \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002", "signature": {"url": "/docs/12/app-pgresetwal.html", "text": "-n --dry-run"}}, {"summary": "\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/12/app-pgresetwal.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/12/app-pgresetwal.html", "text": "-? --help"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/12/app-pgresetwal.html", "text": "-c xid , xid --commit-timestamp-ids= xid , xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002", "signature": {"url": "/docs/12/app-pgresetwal.html", "text": "-e xid_epoch --epoch= xid_epoch"}}, {"summary": "\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002", "signature": {"url": "/docs/12/app-pgresetwal.html", "text": "-l walfile --next-wal-file= walfile"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/12/app-pgresetwal.html", "text": "-m mxid , mxid --multixact-ids= mxid , mxid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002", "signature": {"url": "/docs/12/app-pgresetwal.html", "text": "-o oid --next-oid= oid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002", "signature": {"url": "/docs/12/app-pgresetwal.html", "text": "-O mxoff --multixact-offset= mxoff"}}, {"summary": "\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002", "signature": {"url": "/docs/12/app-pgresetwal.html", "text": "--wal-segsize= wal_segment_size"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/12/app-pgresetwal.html", "text": "-u xid --oldest-transaction-id= xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/12/app-pgresetwal.html", "text": "-x xid --next-transaction-id= xid"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-f", "--force"], "summary": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above.", "signature": "-f --force", "source_url": "/docs/12/app-pgresetwal.html", "description": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above."}, {"names": ["-n", "--dry-run"], "summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "signature": "-n --dry-run", "source_url": "/docs/12/app-pgresetwal.html", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "summary": "Display version information, then exit.", "signature": "-V --version", "source_url": "/docs/12/app-pgresetwal.html", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "summary": "Show help, then exit.", "signature": "-? --help", "source_url": "/docs/12/app-pgresetwal.html", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "source_url": "/docs/12/app-pgresetwal.html", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "summary": "Manually set the next transaction ID's epoch.", "signature": "-e xid_epoch --epoch= xid_epoch", "source_url": "/docs/12/app-pgresetwal.html", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "signature": "-l walfile --next-wal-file= walfile", "source_url": "/docs/12/app-pgresetwal.html", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "summary": "Manually set the next and oldest multitransaction ID.", "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "source_url": "/docs/12/app-pgresetwal.html", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "summary": "Manually set the next OID.", "signature": "-o oid --next-oid= oid", "source_url": "/docs/12/app-pgresetwal.html", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "summary": "Manually set the next multitransaction offset.", "signature": "-O mxoff --multixact-offset= mxoff", "source_url": "/docs/12/app-pgresetwal.html", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["--wal-segsize= wal_segment_size"], "summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "signature": "--wal-segsize= wal_segment_size", "source_url": "/docs/12/app-pgresetwal.html", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "summary": "Manually set the oldest unfrozen transaction ID.", "signature": "-u xid --oldest-transaction-id= xid", "source_url": "/docs/12/app-pgresetwal.html", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "summary": "Manually set the next transaction ID.", "signature": "-x xid --next-transaction-id= xid", "source_url": "/docs/12/app-pgresetwal.html", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v12.22/postgresql-12.22.tar.bz2", "label": "12.22", "major": "12", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/12/postgresql-12-A4.pdf", "bytes": 13424351, "pages": 2803, "sha256": "7422cf53fd1939e7a3d2925231a88b0330e468afa5393627cac0ff86158a0621", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/12/postgresql-12-US.pdf", "bytes": 13322565, "pages": 2958, "sha256": "51f3b04e72907fc38512685946223452ea65f84419c60c66241dfa3396035e77", "built_at": "2026-09-26"}}, "tree": "12", "index": "index.html", "major": "12", "pages": 1131, "release": "12.22", "source_url": "https://ftp.postgresql.org/pub/source/v12.22/postgresql-12.22.tar.bz2", "svg_assets": 2, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b"}, "revision": "7a827e97cbfacd7febff75f34443e2043e40723de5b6d8c9d81a9430b65a37e4", "evidence_kind": "English manual and source declarations", "source_sha256": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b"}, "sources": [{"url": "https://pg.center/docs/12/app-pgresetwal.html", "file": "app-pgresetwal.html", "label": "12.22 English manual \u00b7 app-pgresetwal.html", "anchor": "", "sha256": "d3de187c3203452690b25de22ee7627607fe41265d88d2b00549a0cd3d3675c1", "language": "en", "original_url": "/docs/12/app-pgresetwal.html"}, {"url": "https://pg.center/docs/12/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "7f6ae1fadc1b0bffa606551460e62aacdc2508a3fb66566ddae861928ca6080b", "language": "en", "original_url": "/docs/12/reference-server.html"}], "sections": [], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "signature": "pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir", "description": ["pg_resetwal \u2014 \u91cd\u7f6e PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESETWAL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_resetwal</span></span></h2>\n<p lang=\"zh\">pg_resetwal \u2014 \u91cd\u7f6e <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.8.4.1\"><code class=\"command\">pg_resetwal</code> [ <code class=\"option\">-f</code> | <code class=\"option\">--force</code> ] [ <code class=\"option\">-n</code> | <code class=\"option\">--dry-run</code> ] [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">-D</code> | <code class=\"option\">--pgdata</code> ]<em class=\"replaceable\"><code>datadir</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PGRESETWAL-1\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4f1a\u6e05\u9664\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\uff0c\u5e76\u53ef\u9009\u62e9\u6027\u5730\u91cd\u7f6e\u5b58\u50a8\u5728 <code class=\"filename\">pg_control</code> \u6587\u4ef6\u4e2d\u7684\u67d0\u4e9b\u5176\u4ed6\u63a7\u5236\u4fe1\u606f\u3002\u5982\u679c\u8fd9\u4e9b\u6587\u4ef6\u5df2\u7ecf\u635f\u574f\uff0c\u6709\u65f6\u5c31\u9700\u8981\u4f7f\u7528\u6b64\u529f\u80fd\u3002\u53ea\u6709\u5f53\u670d\u52a1\u5668\u56e0\u8fd9\u7c7b\u635f\u574f\u800c\u65e0\u6cd5\u542f\u52a8\u65f6\uff0c\u624d\u5e94\u5c06\u5176\u4f5c\u4e3a\u6700\u540e\u624b\u6bb5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u8fd0\u884c\u6b64\u547d\u4ee4\u540e\uff0c\u670d\u52a1\u5668\u5e94\u8be5\u53ef\u4ee5\u542f\u52a8\uff1b\u4f46\u8bf7\u8bb0\u4f4f\uff0c\u7531\u4e8e\u4ec5\u90e8\u5206\u63d0\u4ea4\u7684\u4e8b\u52a1\uff0c\u6570\u636e\u5e93\u4e2d\u53ef\u80fd\u542b\u6709\u4e0d\u4e00\u81f4\u7684\u6570\u636e\u3002\u5e94\u7acb\u5373\u8f6c\u50a8\u6570\u636e\uff0c\u8fd0\u884c <code class=\"command\">initdb</code>\uff0c\u7136\u540e\u6062\u590d\u3002\u6062\u590d\u540e\uff0c\u8bf7\u68c0\u67e5\u662f\u5426\u5b58\u5728\u4e0d\u4e00\u81f4\u5e76\u6309\u9700\u4fee\u590d\u3002</p>\n<p lang=\"zh\">\u6b64\u5de5\u5177\u53ea\u80fd\u7531\u5b89\u88c5\u670d\u52a1\u5668\u7684\u7528\u6237\u8fd0\u884c\uff0c\u56e0\u4e3a\u5b83\u9700\u8981\u5bf9\u6570\u636e\u76ee\u5f55\u7684\u8bfb\u5199\u8bbf\u95ee\u6743\u9650\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002<code class=\"command\">pg_resetwal</code>\u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATA</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c <code class=\"command\">pg_resetwal</code> \u62a5\u544a\u65e0\u6cd5\u786e\u5b9a <code class=\"filename\">pg_control</code> \u7684\u6709\u6548\u6570\u636e\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u5f3a\u884c\u7ee7\u7eed\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u7f3a\u5931\u7684\u6570\u636e\u5c06\u4ee5\u770b\u4f3c\u5408\u7406\u7684\u503c\u4ee3\u66ff\u3002\u5927\u591a\u6570\u5b57\u6bb5\u9884\u8ba1\u90fd\u80fd\u5339\u914d\uff0c\u4f46\u5bf9\u4e8e\u4e0b\u4e00\u4e2a OID\u3001\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u53ca\u5176\u7eaa\u5143\u3001\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID \u53ca\u5176\u504f\u79fb\u91cf\uff0c\u4ee5\u53ca WAL \u8d77\u59cb\u4f4d\u7f6e\u5b57\u6bb5\uff0c\u53ef\u80fd\u4ecd\u9700\u8981\u4eba\u5de5\u534f\u52a9\u3002\u8fd9\u4e9b\u5b57\u6bb5\u53ef\u901a\u8fc7\u4e0b\u6587\u8ba8\u8bba\u7684\u9009\u9879\u6765\u8bbe\u7f6e\u3002\u5982\u679c\u65e0\u6cd5\u4e3a\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u786e\u5b9a\u6b63\u786e\u503c\uff0c\u4ecd\u7136\u53ef\u4ee5\u4f7f\u7528 <code class=\"option\">-f</code>\uff0c\u4f46\u6062\u590d\u5f97\u5230\u7684\u6570\u636e\u5e93\u5fc5\u987b\u6bd4\u5e73\u65f6\u66f4\u53d7\u6000\u7591\uff1a\u7acb\u5373\u8f6c\u50a8\u5e76\u6062\u590d\u52bf\u5728\u5fc5\u884c\u3002<span class=\"emphasis\"><em>\u5207\u52ff</em></span>\u5728\u5b8c\u6210\u8f6c\u50a8\u4e4b\u524d\u5bf9\u6570\u636e\u5e93\u6267\u884c\u4efb\u4f55\u4fee\u6539\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u56e0\u4e3a\u4efb\u4f55\u6b64\u7c7b\u64cd\u4f5c\u90fd\u5f88\u53ef\u80fd\u4f7f\u635f\u574f\u8fdb\u4e00\u6b65\u6076\u5316\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-f</code><br/></span><span class=\"term\"><code class=\"option\">--force</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u4e0a\u6240\u8ff0\uff0c\u5373\u4f7f<code class=\"command\">pg_resetwal</code>\u65e0\u6cd5\u786e\u5b9a<code class=\"filename\">pg_control</code>\u7684\u6709\u6548\u6570\u636e\uff0c\u4e5f\u5f3a\u5236\u5176\u7ee7\u7eed\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--dry-run</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"option\">-n</code>/<code class=\"option\">--dry-run</code> \u9009\u9879\u4f1a\u8ba9 <code class=\"command\">pg_resetwal</code> \u6253\u5370\u4ece <code class=\"filename\">pg_control</code> \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u9009\u9879\u4ec5\u5728 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u901a\u8fc7\u8bfb\u53d6 <code class=\"filename\">pg_control</code> \u786e\u5b9a\u9002\u5f53\u503c\u65f6\u624d\u9700\u8981\u4f7f\u7528\u3002\u5b89\u5168\u503c\u53ef\u6309\u4e0b\u8ff0\u65b9\u6cd5\u786e\u5b9a\u3002\u5bf9\u4e8e\u63a5\u53d7\u6570\u5b57\u53c2\u6570\u7684\u9009\u9879\uff0c\u53ef\u4f7f\u7528\u524d\u7f00 <code class=\"literal\">0x</code> \u6307\u5b9a\u5341\u516d\u8fdb\u5236\u503c\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--commit-timestamp-ids=<em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e00\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_commit_ts</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u76f8\u53cd\uff0c\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65b0\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e8c\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u5747\u4e3a\u5341\u516d\u8fdb\u5236\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e <em class=\"replaceable\"><code>xid_epoch</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--epoch=<em class=\"replaceable\"><code>xid_epoch</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002</p>\n<p lang=\"zh\">\u4e8b\u52a1 ID \u7eaa\u5143\u5b9e\u9645\u4e0a\u5e76\u672a\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u4efb\u4f55\u5730\u65b9\uff0c\u9664\u4e86\u7531 <code class=\"command\">pg_resetwal</code> \u8bbe\u7f6e\u7684\u8fd9\u4e2a\u5b57\u6bb5\uff0c\u56e0\u6b64\u5c31\u6570\u636e\u5e93\u672c\u8eab\u800c\u8a00\uff0c\u4efb\u4f55\u503c\u90fd\u53ef\u7528\u3002\u53ef\u80fd\u9700\u8981\u8c03\u6574\u8be5\u503c\uff0c\u4ee5\u786e\u4fdd <span class=\"application\">Slony-I</span> \u548c <span class=\"application\">Skytools</span> \u7b49\u590d\u5236\u7cfb\u7edf\u6b63\u5e38\u5de5\u4f5c \u2014 \u5982\u679c\u786e\u6709\u9700\u8981\uff0c\u5e94\u8be5\u53ef\u4ee5\u4ece\u4e0b\u6e38\u590d\u5236\u6570\u636e\u5e93\u7684\u72b6\u6001\u4e2d\u83b7\u5f97\u5408\u9002\u7684\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>walfile</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-wal-file=<em class=\"replaceable\"><code>walfile</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\u5e94\u5927\u4e8e\u5f53\u524d\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_wal</code> \u76ee\u5f55\u4e2d\u73b0\u5b58\u7684\u4efb\u610f WAL \u6bb5\u6587\u4ef6\u540d\u3002\u8fd9\u4e9b\u540d\u79f0\u540c\u6837\u91c7\u7528\u5341\u516d\u8fdb\u5236\uff0c\u5e76\u7531\u4e09\u4e2a\u90e8\u5206\u7ec4\u6210\u3002\u7b2c\u4e00\u90e8\u5206\u662f<span class=\"quote\">\u201c<span class=\"quote\">\u65f6\u95f4\u7ebf ID</span>\u201d</span>\uff0c\u901a\u5e38\u5e94\u4fdd\u6301\u4e0d\u53d8\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">00000001000000320000004A</code> \u662f <code class=\"filename\">pg_wal</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u5219\u5e94\u4f7f\u7528 <code class=\"literal\">-l 00000001000000320000004B</code> \u6216\u66f4\u5927\u7684\u503c\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u5728\u4f7f\u7528\u975e\u9ed8\u8ba4 WAL \u6bb5\u5927\u5c0f\u65f6\uff0cWAL \u6587\u4ef6\u540d\u4e2d\u7684\u6570\u5b57\u4e0e\u7cfb\u7edf\u51fd\u6570\u548c\u7cfb\u7edf\u89c6\u56fe\u62a5\u544a\u7684 LSN \u4e0d\u540c\u3002\u8be5\u9009\u9879\u63a5\u53d7\u7684\u662f WAL \u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f LSN\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">pg_resetwal \u81ea\u8eab\u4f1a\u68c0\u67e5 pg_wal \u4e2d\u7684\u6587\u4ef6\uff0c\u5e76\u4e3a -l \u9009\u62e9\u4e00\u4e2a\u8d85\u8fc7\u73b0\u6709\u6700\u540e\u4e00\u4e2a\u6587\u4ef6\u540d\u7684\u9ed8\u8ba4\u503c\u3002\u56e0\u6b64\uff0c\u53ea\u6709\u5728\u786e\u5b9a\u5b58\u5728\u5f53\u524d\u4e0d\u5728 pg_wal \u4e2d\u7684 WAL \u6bb5\u6587\u4ef6\uff08\u4f8b\u5982\u79bb\u7ebf\u5f52\u6863\u4e2d\u7684\u6587\u4ef6\uff09\uff0c\u6216 pg_wal \u7684\u5185\u5bb9\u5b8c\u5168\u4e22\u5931\u65f6\uff0c\u624d\u5e94\u8be5\u9700\u8981\u624b\u52a8\u8c03\u6574 -l\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-m <em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-ids=<em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u8981\u786e\u5b9a\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID\uff08\u7b2c\u4e00\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u5728\u6570\u636e\u76ee\u5f55\u4e0b\u7684 pg_multixact/offsets \u76ee\u5f55\u4e2d\u627e\u5230\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5c06\u5176\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 65536\uff080x10000\uff09\u3002\u76f8\u5e94\u5730\uff0c\u8981\u786e\u5b9a\u6700\u65e7\u591a\u4e8b\u52a1 ID\uff08-m \u7684\u7b2c\u4e8c\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u627e\u5230\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 65536\u3002\u6587\u4ef6\u540d\u4f7f\u7528\u5341\u516d\u8fdb\u5236\uff0c\u56e0\u6b64\u6700\u7b80\u5355\u7684\u505a\u6cd5\u662f\u4ee5\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u9009\u9879\u503c\uff0c\u5e76\u5728\u672b\u5c3e\u6dfb\u52a0\u56db\u4e2a\u96f6\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>oid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-oid=<em class=\"replaceable\"><code>oid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002</p>\n<p lang=\"zh\">\u5e76\u6ca1\u6709\u540c\u6837\u7b80\u5355\u7684\u65b9\u6cd5\u6765\u786e\u5b9a\u4e00\u4e2a\u8d85\u51fa\u6570\u636e\u5e93\u4e2d\u6700\u5927 OID \u7684\u4e0b\u4e00\u4e2a OID\uff0c\u4e0d\u8fc7\u5e78\u8fd0\u7684\u662f\uff0c\u4e0b\u4e00\u4e2a OID \u7684\u8bbe\u7f6e\u662f\u5426\u7cbe\u786e\u5e76\u4e0d\u5173\u952e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O <em class=\"replaceable\"><code>mxoff</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-offset=<em class=\"replaceable\"><code>mxoff</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_multixact/members</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 52352 (0xCC80) \u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u8fd9\u91cc\u6ca1\u6709\u50cf\u5176\u4ed6\u9009\u9879\u90a3\u6837\u901a\u8fc7\u8ffd\u52a0\u96f6\u5373\u53ef\u5f97\u5230\u7ed3\u679c\u7684\u7b80\u5355\u65b9\u6cd5\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>wal_segment_size</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u867d\u7136 <code class=\"command\">pg_resetwal</code> \u4f1a\u628a WAL \u8d77\u59cb\u4f4d\u7f6e\u8bbe\u7f6e\u5230\u8d85\u51fa\u73b0\u6709\u6700\u65b0 WAL \u6bb5\u6587\u4ef6\u7684\u4f4d\u7f6e\uff0c\u4f46\u67d0\u4e9b\u6bb5\u5927\u5c0f\u53d8\u66f4\u53ef\u80fd\u5bfc\u81f4\u65e7 WAL \u6587\u4ef6\u540d\u88ab\u91cd\u65b0\u4f7f\u7528\u3002\u5982\u679c WAL \u6587\u4ef6\u540d\u91cd\u53e0\u4f1a\u7ed9\u5f52\u6863\u7b56\u7565\u5e26\u6765\u95ee\u9898\uff0c\u5efa\u8bae\u5c06 <code class=\"option\">-l</code> \u4e0e\u6b64\u9009\u9879\u914d\u5408\u4f7f\u7528\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-u <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--oldest-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0007</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5c0f\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-u 0x700000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0011</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-x 0x1200000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u670d\u52a1\u5668\u8fd0\u884c\u671f\u95f4\u4e0d\u5f97\u4f7f\u7528\u6b64\u547d\u4ee4\u3002\u5982\u679c\u5728\u6570\u636e\u76ee\u5f55\u4e2d\u53d1\u73b0\u670d\u52a1\u5668\u9501\u6587\u4ef6\uff0c<code class=\"command\">pg_resetwal</code> \u5c06\u62d2\u7edd\u542f\u52a8\u3002\u5982\u679c\u670d\u52a1\u5668\u66fe\u5d29\u6e83\uff0c\u53ef\u80fd\u9057\u7559\u9501\u6587\u4ef6\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5220\u9664\u8be5\u9501\u6587\u4ef6\u4ee5\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u8fd0\u884c\u3002\u4f46\u5728\u8fd9\u6837\u505a\u4e4b\u524d\uff0c\u52a1\u5fc5\u518d\u4e09\u786e\u8ba4\u6ca1\u6709\u4efb\u4f55\u670d\u52a1\u5668\u8fdb\u7a0b\u4ecd\u5728\u8fd0\u884c\u3002</p>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4ec5\u9002\u7528\u4e8e\u76f8\u540c\u4e3b\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/12/app-pgcontroldata.html\" title=\"pg_controldata\"><span class=\"refentrytitle\"><span class=\"application\">pg_controldata</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgresetwal.html", "localization": {"status": "complete", "sources": [{"url": "/docs/12/app-pgresetwal.html", "method": "same-major semantic node", "sha256": "07aaafa4ac155faf440b29e758c99e1b71f66038d5dd4af18cf38284afaaefd7", "language": "zh", "matched_nodes": ["#APP-PGRESETWAL/div[2]/p[1]", "#APP-PGRESETWAL/div[3]/h2[0]", "#APP-PGRESETWAL/div[4]/p[1]", "#APP-PGRESETWAL/div[4]/p[2]", "#APP-PGRESETWAL/div[4]/p[3]", "#APP-PGRESETWAL/div[4]/p[4]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[7]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/div[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/div[3]/h3[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[2]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[7]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[1]", "#APP-PGRESETWAL/div[5]/p[2]", "#APP-PGRESETWAL/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[6]/h2[0]", "#APP-PGRESETWAL/div[7]/h2[0]", "#APP-PGRESETWAL/div[7]/p[1]", "#APP-PGRESETWAL/div[7]/p[2]", "#APP-PGRESETWAL/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/12/description/0": "pg_resetwal \u2014 reset the write-ahead log and other control information of a PostgreSQL database cluster", "/versions/12/facts/0/label": "Documented executable", "/versions/12/facts/1/label": "Executable version", "/versions/12/facts/2/label": "Reference inventory", "/versions/12/facts/2/value": "Server applications", "/versions/12/facts/3/label": "Option definition groups", "/versions/12/tables/0/title": "Documented options", "/versions/12/tables/1/title": "Environment variables", "/versions/12/tables/0/rows/0/summary": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above.", "/versions/12/tables/0/rows/1/summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "/versions/12/tables/0/rows/2/summary": "Display version information, then exit.", "/versions/12/tables/0/rows/3/summary": "Show help, then exit.", "/versions/12/tables/0/rows/4/summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "/versions/12/tables/0/rows/5/summary": "Manually set the next transaction ID's epoch.", "/versions/12/tables/0/rows/6/summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "/versions/12/tables/0/rows/7/summary": "Manually set the next and oldest multitransaction ID.", "/versions/12/tables/0/rows/8/summary": "Manually set the next OID.", "/versions/12/tables/0/rows/9/summary": "Manually set the next multitransaction offset.", "/versions/12/tables/0/columns/0/label": "Option and arguments", "/versions/12/tables/0/columns/1/label": "Description", "/versions/12/tables/0/rows/10/summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "/versions/12/tables/0/rows/11/summary": "Manually set the oldest unfrozen transaction ID.", "/versions/12/tables/0/rows/12/summary": "Manually set the next transaction ID.", "/versions/12/tables/1/columns/0/label": "Variable", "/versions/12/tables/1/columns/1/label": "Meaning", "/versions/12/tables/1/rows/0/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "4cafc71117455a2dc821f0b8ce5ad2e06f2ec07928a8443c6bf172da7a081c3a"}, "comparison_data": {"options": [{"names": ["-f", "--force"], "signature": "-f --force", "description": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above."}, {"names": ["-n", "--dry-run"], "signature": "-n --dry-run", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "signature": "-e xid_epoch --epoch= xid_epoch", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "signature": "-l walfile --next-wal-file= walfile", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "signature": "-o oid --next-oid= oid", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "signature": "-O mxoff --multixact-offset= mxoff", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["--wal-segsize= wal_segment_size"], "signature": "--wal-segsize= wal_segment_size", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "signature": "-u xid --oldest-transaction-id= xid", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "signature": "-x xid --next-transaction-id= xid", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "2e75a1fb3e22e5af38c29ab81b14d4bdbfd53bd0d273146c3a3372d6c8d19a7a", "manual_language": "zh"}, "13": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_resetwal"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "13.23"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "13"}], "tables": [{"key": "options", "rows": [{"summary": "\u5982\u4e0a\u6240\u8ff0\uff0c\u5373\u4f7f pg_resetwal \u65e0\u6cd5\u786e\u5b9a pg_control \u7684\u6709\u6548\u6570\u636e\uff0c\u4e5f\u5f3a\u5236\u5176\u7ee7\u7eed\u6267\u884c\u3002", "signature": {"url": "/docs/13/app-pgresetwal.html", "text": "-f --force"}}, {"summary": "-n / --dry-run \u9009\u9879\u4f1a\u8ba9 pg_resetwal \u6253\u5370\u4ece pg_control \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 pg_resetwal \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002", "signature": {"url": "/docs/13/app-pgresetwal.html", "text": "-n --dry-run"}}, {"summary": "\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/13/app-pgresetwal.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/13/app-pgresetwal.html", "text": "-? --help"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/13/app-pgresetwal.html", "text": "-c xid , xid --commit-timestamp-ids= xid , xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002", "signature": {"url": "/docs/13/app-pgresetwal.html", "text": "-e xid_epoch --epoch= xid_epoch"}}, {"summary": "\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002", "signature": {"url": "/docs/13/app-pgresetwal.html", "text": "-l walfile --next-wal-file= walfile"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/13/app-pgresetwal.html", "text": "-m mxid , mxid --multixact-ids= mxid , mxid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002", "signature": {"url": "/docs/13/app-pgresetwal.html", "text": "-o oid --next-oid= oid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002", "signature": {"url": "/docs/13/app-pgresetwal.html", "text": "-O mxoff --multixact-offset= mxoff"}}, {"summary": "\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002", "signature": {"url": "/docs/13/app-pgresetwal.html", "text": "--wal-segsize= wal_segment_size"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/13/app-pgresetwal.html", "text": "-u xid --oldest-transaction-id= xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/13/app-pgresetwal.html", "text": "-x xid --next-transaction-id= xid"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-f", "--force"], "summary": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above.", "signature": "-f --force", "source_url": "/docs/13/app-pgresetwal.html", "description": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above."}, {"names": ["-n", "--dry-run"], "summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "signature": "-n --dry-run", "source_url": "/docs/13/app-pgresetwal.html", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "summary": "Display version information, then exit.", "signature": "-V --version", "source_url": "/docs/13/app-pgresetwal.html", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "summary": "Show help, then exit.", "signature": "-? --help", "source_url": "/docs/13/app-pgresetwal.html", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "source_url": "/docs/13/app-pgresetwal.html", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "summary": "Manually set the next transaction ID's epoch.", "signature": "-e xid_epoch --epoch= xid_epoch", "source_url": "/docs/13/app-pgresetwal.html", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "signature": "-l walfile --next-wal-file= walfile", "source_url": "/docs/13/app-pgresetwal.html", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "summary": "Manually set the next and oldest multitransaction ID.", "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "source_url": "/docs/13/app-pgresetwal.html", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "summary": "Manually set the next OID.", "signature": "-o oid --next-oid= oid", "source_url": "/docs/13/app-pgresetwal.html", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "summary": "Manually set the next multitransaction offset.", "signature": "-O mxoff --multixact-offset= mxoff", "source_url": "/docs/13/app-pgresetwal.html", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["--wal-segsize= wal_segment_size"], "summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "signature": "--wal-segsize= wal_segment_size", "source_url": "/docs/13/app-pgresetwal.html", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "summary": "Manually set the oldest unfrozen transaction ID.", "signature": "-u xid --oldest-transaction-id= xid", "source_url": "/docs/13/app-pgresetwal.html", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "summary": "Manually set the next transaction ID.", "signature": "-x xid --next-transaction-id= xid", "source_url": "/docs/13/app-pgresetwal.html", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v13.23/postgresql-13.23.tar.bz2", "label": "13.23", "major": "13", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/13/postgresql-13-A4.pdf", "bytes": 13843239, "pages": 2826, "sha256": "171cc09f90936dbc1cbd503a98ff07ae72ea58ab9771ff051313f1217737799c", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/13/postgresql-13-US.pdf", "bytes": 13739572, "pages": 2984, "sha256": "48d09c6e197d9db4220f41afe83efe848a8661b1b168d3b89419751ecaf6c24d", "built_at": "2026-09-26"}}, "tree": "13", "index": "index.html", "major": "13", "pages": 1139, "release": "13.23", "source_url": "https://ftp.postgresql.org/pub/source/v13.23/postgresql-13.23.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6"}, "revision": "614ee3133270254e476c118cdf6f72af78d4e4b8bbd9b28ed9ab1e14e4e9c0f6", "evidence_kind": "English manual and source declarations", "source_sha256": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6"}, "sources": [{"url": "https://pg.center/docs/13/app-pgresetwal.html", "file": "app-pgresetwal.html", "label": "13.23 English manual \u00b7 app-pgresetwal.html", "anchor": "", "sha256": "27e7cee86054c4d788d97bf5b3bed2c180363b9215419e43379061bb434e071a", "language": "en", "original_url": "/docs/13/app-pgresetwal.html"}, {"url": "https://pg.center/docs/13/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "074ef8577fd368272a2360309e1226e2d0b1e570a3e1da62dfcca63ac9ee5539", "language": "en", "original_url": "/docs/13/reference-server.html"}], "sections": [], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "signature": "pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir", "description": ["pg_resetwal \u2014 \u91cd\u7f6e PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESETWAL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_resetwal</span></span></h2>\n<p lang=\"zh\">pg_resetwal \u2014 \u91cd\u7f6e <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.8.4.1\"><code class=\"command\">pg_resetwal</code> [ <code class=\"option\">-f</code> | <code class=\"option\">--force</code> ] [ <code class=\"option\">-n</code> | <code class=\"option\">--dry-run</code> ] [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">-D</code> | <code class=\"option\">--pgdata</code> ]<em class=\"replaceable\"><code>datadir</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PGRESETWAL-1\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4f1a\u6e05\u9664\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\uff0c\u5e76\u53ef\u9009\u62e9\u6027\u5730\u91cd\u7f6e\u5b58\u50a8\u5728 <code class=\"filename\">pg_control</code> \u6587\u4ef6\u4e2d\u7684\u67d0\u4e9b\u5176\u4ed6\u63a7\u5236\u4fe1\u606f\u3002\u5982\u679c\u8fd9\u4e9b\u6587\u4ef6\u5df2\u7ecf\u635f\u574f\uff0c\u6709\u65f6\u5c31\u9700\u8981\u4f7f\u7528\u6b64\u529f\u80fd\u3002\u53ea\u6709\u5f53\u670d\u52a1\u5668\u56e0\u8fd9\u7c7b\u635f\u574f\u800c\u65e0\u6cd5\u542f\u52a8\u65f6\uff0c\u624d\u5e94\u5c06\u5176\u4f5c\u4e3a\u6700\u540e\u624b\u6bb5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u8fd0\u884c\u6b64\u547d\u4ee4\u540e\uff0c\u670d\u52a1\u5668\u5e94\u8be5\u53ef\u4ee5\u542f\u52a8\uff1b\u4f46\u8bf7\u8bb0\u4f4f\uff0c\u7531\u4e8e\u4ec5\u90e8\u5206\u63d0\u4ea4\u7684\u4e8b\u52a1\uff0c\u6570\u636e\u5e93\u4e2d\u53ef\u80fd\u542b\u6709\u4e0d\u4e00\u81f4\u7684\u6570\u636e\u3002\u5e94\u7acb\u5373\u8f6c\u50a8\u6570\u636e\uff0c\u8fd0\u884c <code class=\"command\">initdb</code>\uff0c\u7136\u540e\u6062\u590d\u3002\u6062\u590d\u540e\uff0c\u8bf7\u68c0\u67e5\u662f\u5426\u5b58\u5728\u4e0d\u4e00\u81f4\u5e76\u6309\u9700\u4fee\u590d\u3002</p>\n<p lang=\"zh\">\u6b64\u5de5\u5177\u53ea\u80fd\u7531\u5b89\u88c5\u670d\u52a1\u5668\u7684\u7528\u6237\u8fd0\u884c\uff0c\u56e0\u4e3a\u5b83\u9700\u8981\u5bf9\u6570\u636e\u76ee\u5f55\u7684\u8bfb\u5199\u8bbf\u95ee\u6743\u9650\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002<code class=\"command\">pg_resetwal</code>\u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATA</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c <code class=\"command\">pg_resetwal</code> \u62a5\u544a\u65e0\u6cd5\u786e\u5b9a <code class=\"filename\">pg_control</code> \u7684\u6709\u6548\u6570\u636e\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u5f3a\u884c\u7ee7\u7eed\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u7f3a\u5931\u7684\u6570\u636e\u5c06\u4ee5\u770b\u4f3c\u5408\u7406\u7684\u503c\u4ee3\u66ff\u3002\u5927\u591a\u6570\u5b57\u6bb5\u9884\u8ba1\u90fd\u80fd\u5339\u914d\uff0c\u4f46\u5bf9\u4e8e\u4e0b\u4e00\u4e2a OID\u3001\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u53ca\u5176\u7eaa\u5143\u3001\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID \u53ca\u5176\u504f\u79fb\u91cf\uff0c\u4ee5\u53ca WAL \u8d77\u59cb\u4f4d\u7f6e\u5b57\u6bb5\uff0c\u53ef\u80fd\u4ecd\u9700\u8981\u4eba\u5de5\u534f\u52a9\u3002\u8fd9\u4e9b\u5b57\u6bb5\u53ef\u901a\u8fc7\u4e0b\u6587\u8ba8\u8bba\u7684\u9009\u9879\u6765\u8bbe\u7f6e\u3002\u5982\u679c\u65e0\u6cd5\u4e3a\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u786e\u5b9a\u6b63\u786e\u503c\uff0c\u4ecd\u7136\u53ef\u4ee5\u4f7f\u7528 <code class=\"option\">-f</code>\uff0c\u4f46\u6062\u590d\u5f97\u5230\u7684\u6570\u636e\u5e93\u5fc5\u987b\u6bd4\u5e73\u65f6\u66f4\u53d7\u6000\u7591\uff1a\u7acb\u5373\u8f6c\u50a8\u5e76\u6062\u590d\u52bf\u5728\u5fc5\u884c\u3002<span class=\"emphasis\"><em>\u5207\u52ff</em></span>\u5728\u5b8c\u6210\u8f6c\u50a8\u4e4b\u524d\u5bf9\u6570\u636e\u5e93\u6267\u884c\u4efb\u4f55\u4fee\u6539\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u56e0\u4e3a\u4efb\u4f55\u6b64\u7c7b\u64cd\u4f5c\u90fd\u5f88\u53ef\u80fd\u4f7f\u635f\u574f\u8fdb\u4e00\u6b65\u6076\u5316\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-f</code><br/></span><span class=\"term\"><code class=\"option\">--force</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u4e0a\u6240\u8ff0\uff0c\u5373\u4f7f<code class=\"command\">pg_resetwal</code>\u65e0\u6cd5\u786e\u5b9a<code class=\"filename\">pg_control</code>\u7684\u6709\u6548\u6570\u636e\uff0c\u4e5f\u5f3a\u5236\u5176\u7ee7\u7eed\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--dry-run</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"option\">-n</code>/<code class=\"option\">--dry-run</code> \u9009\u9879\u4f1a\u8ba9 <code class=\"command\">pg_resetwal</code> \u6253\u5370\u4ece <code class=\"filename\">pg_control</code> \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u9009\u9879\u4ec5\u5728 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u901a\u8fc7\u8bfb\u53d6 <code class=\"filename\">pg_control</code> \u786e\u5b9a\u9002\u5f53\u503c\u65f6\u624d\u9700\u8981\u4f7f\u7528\u3002\u5b89\u5168\u503c\u53ef\u6309\u4e0b\u8ff0\u65b9\u6cd5\u786e\u5b9a\u3002\u5bf9\u4e8e\u63a5\u53d7\u6570\u5b57\u53c2\u6570\u7684\u9009\u9879\uff0c\u53ef\u4f7f\u7528\u524d\u7f00 <code class=\"literal\">0x</code> \u6307\u5b9a\u5341\u516d\u8fdb\u5236\u503c\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--commit-timestamp-ids=<em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e00\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_commit_ts</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u76f8\u53cd\uff0c\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65b0\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e8c\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u5747\u4e3a\u5341\u516d\u8fdb\u5236\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e <em class=\"replaceable\"><code>xid_epoch</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--epoch=<em class=\"replaceable\"><code>xid_epoch</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002</p>\n<p lang=\"zh\">\u4e8b\u52a1 ID \u7eaa\u5143\u5b9e\u9645\u4e0a\u5e76\u672a\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u4efb\u4f55\u5730\u65b9\uff0c\u9664\u4e86\u7531 <code class=\"command\">pg_resetwal</code> \u8bbe\u7f6e\u7684\u8fd9\u4e2a\u5b57\u6bb5\uff0c\u56e0\u6b64\u5c31\u6570\u636e\u5e93\u672c\u8eab\u800c\u8a00\uff0c\u4efb\u4f55\u503c\u90fd\u53ef\u7528\u3002\u53ef\u80fd\u9700\u8981\u8c03\u6574\u8be5\u503c\uff0c\u4ee5\u786e\u4fdd <span class=\"application\">Slony-I</span> \u548c <span class=\"application\">Skytools</span> \u7b49\u590d\u5236\u7cfb\u7edf\u6b63\u5e38\u5de5\u4f5c \u2014 \u5982\u679c\u786e\u6709\u9700\u8981\uff0c\u5e94\u8be5\u53ef\u4ee5\u4ece\u4e0b\u6e38\u590d\u5236\u6570\u636e\u5e93\u7684\u72b6\u6001\u4e2d\u83b7\u5f97\u5408\u9002\u7684\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>walfile</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-wal-file=<em class=\"replaceable\"><code>walfile</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\u5e94\u5927\u4e8e\u5f53\u524d\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_wal</code> \u76ee\u5f55\u4e2d\u73b0\u5b58\u7684\u4efb\u610f WAL \u6bb5\u6587\u4ef6\u540d\u3002\u8fd9\u4e9b\u540d\u79f0\u540c\u6837\u91c7\u7528\u5341\u516d\u8fdb\u5236\uff0c\u5e76\u7531\u4e09\u4e2a\u90e8\u5206\u7ec4\u6210\u3002\u7b2c\u4e00\u90e8\u5206\u662f<span class=\"quote\">\u201c<span class=\"quote\">\u65f6\u95f4\u7ebf ID</span>\u201d</span>\uff0c\u901a\u5e38\u5e94\u4fdd\u6301\u4e0d\u53d8\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">00000001000000320000004A</code> \u662f <code class=\"filename\">pg_wal</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u5219\u5e94\u4f7f\u7528 <code class=\"literal\">-l 00000001000000320000004B</code> \u6216\u66f4\u5927\u7684\u503c\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u5728\u4f7f\u7528\u975e\u9ed8\u8ba4 WAL \u6bb5\u5927\u5c0f\u65f6\uff0cWAL \u6587\u4ef6\u540d\u4e2d\u7684\u6570\u5b57\u4e0e\u7cfb\u7edf\u51fd\u6570\u548c\u7cfb\u7edf\u89c6\u56fe\u62a5\u544a\u7684 LSN \u4e0d\u540c\u3002\u8be5\u9009\u9879\u63a5\u53d7\u7684\u662f WAL \u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f LSN\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">pg_resetwal \u81ea\u8eab\u4f1a\u68c0\u67e5 pg_wal \u4e2d\u7684\u6587\u4ef6\uff0c\u5e76\u4e3a -l \u9009\u62e9\u4e00\u4e2a\u8d85\u8fc7\u73b0\u6709\u6700\u540e\u4e00\u4e2a\u6587\u4ef6\u540d\u7684\u9ed8\u8ba4\u503c\u3002\u56e0\u6b64\uff0c\u53ea\u6709\u5728\u786e\u5b9a\u5b58\u5728\u5f53\u524d\u4e0d\u5728 pg_wal \u4e2d\u7684 WAL \u6bb5\u6587\u4ef6\uff08\u4f8b\u5982\u79bb\u7ebf\u5f52\u6863\u4e2d\u7684\u6587\u4ef6\uff09\uff0c\u6216 pg_wal \u7684\u5185\u5bb9\u5b8c\u5168\u4e22\u5931\u65f6\uff0c\u624d\u5e94\u8be5\u9700\u8981\u624b\u52a8\u8c03\u6574 -l\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-m <em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-ids=<em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u8981\u786e\u5b9a\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID\uff08\u7b2c\u4e00\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u5728\u6570\u636e\u76ee\u5f55\u4e0b\u7684 pg_multixact/offsets \u76ee\u5f55\u4e2d\u627e\u5230\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5c06\u5176\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 65536\uff080x10000\uff09\u3002\u76f8\u5e94\u5730\uff0c\u8981\u786e\u5b9a\u6700\u65e7\u591a\u4e8b\u52a1 ID\uff08-m \u7684\u7b2c\u4e8c\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u627e\u5230\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 65536\u3002\u6587\u4ef6\u540d\u4f7f\u7528\u5341\u516d\u8fdb\u5236\uff0c\u56e0\u6b64\u6700\u7b80\u5355\u7684\u505a\u6cd5\u662f\u4ee5\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u9009\u9879\u503c\uff0c\u5e76\u5728\u672b\u5c3e\u6dfb\u52a0\u56db\u4e2a\u96f6\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>oid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-oid=<em class=\"replaceable\"><code>oid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002</p>\n<p lang=\"zh\">\u5e76\u6ca1\u6709\u540c\u6837\u7b80\u5355\u7684\u65b9\u6cd5\u6765\u786e\u5b9a\u4e00\u4e2a\u8d85\u51fa\u6570\u636e\u5e93\u4e2d\u6700\u5927 OID \u7684\u4e0b\u4e00\u4e2a OID\uff0c\u4e0d\u8fc7\u5e78\u8fd0\u7684\u662f\uff0c\u4e0b\u4e00\u4e2a OID \u7684\u8bbe\u7f6e\u662f\u5426\u7cbe\u786e\u5e76\u4e0d\u5173\u952e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O <em class=\"replaceable\"><code>mxoff</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-offset=<em class=\"replaceable\"><code>mxoff</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_multixact/members</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 52352 (0xCC80) \u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u8fd9\u91cc\u6ca1\u6709\u50cf\u5176\u4ed6\u9009\u9879\u90a3\u6837\u901a\u8fc7\u8ffd\u52a0\u96f6\u5373\u53ef\u5f97\u5230\u7ed3\u679c\u7684\u7b80\u5355\u65b9\u6cd5\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>wal_segment_size</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u867d\u7136 <code class=\"command\">pg_resetwal</code> \u4f1a\u628a WAL \u8d77\u59cb\u4f4d\u7f6e\u8bbe\u7f6e\u5230\u8d85\u51fa\u73b0\u6709\u6700\u65b0 WAL \u6bb5\u6587\u4ef6\u7684\u4f4d\u7f6e\uff0c\u4f46\u67d0\u4e9b\u6bb5\u5927\u5c0f\u53d8\u66f4\u53ef\u80fd\u5bfc\u81f4\u65e7 WAL \u6587\u4ef6\u540d\u88ab\u91cd\u65b0\u4f7f\u7528\u3002\u5982\u679c WAL \u6587\u4ef6\u540d\u91cd\u53e0\u4f1a\u7ed9\u5f52\u6863\u7b56\u7565\u5e26\u6765\u95ee\u9898\uff0c\u5efa\u8bae\u5c06 <code class=\"option\">-l</code> \u4e0e\u6b64\u9009\u9879\u914d\u5408\u4f7f\u7528\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-u <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--oldest-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0007</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5c0f\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-u 0x700000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0011</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-x 0x1200000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u670d\u52a1\u5668\u8fd0\u884c\u671f\u95f4\u4e0d\u5f97\u4f7f\u7528\u6b64\u547d\u4ee4\u3002\u5982\u679c\u5728\u6570\u636e\u76ee\u5f55\u4e2d\u53d1\u73b0\u670d\u52a1\u5668\u9501\u6587\u4ef6\uff0c<code class=\"command\">pg_resetwal</code> \u5c06\u62d2\u7edd\u542f\u52a8\u3002\u5982\u679c\u670d\u52a1\u5668\u66fe\u5d29\u6e83\uff0c\u53ef\u80fd\u9057\u7559\u9501\u6587\u4ef6\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5220\u9664\u8be5\u9501\u6587\u4ef6\u4ee5\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u8fd0\u884c\u3002\u4f46\u5728\u8fd9\u6837\u505a\u4e4b\u524d\uff0c\u52a1\u5fc5\u518d\u4e09\u786e\u8ba4\u6ca1\u6709\u4efb\u4f55\u670d\u52a1\u5668\u8fdb\u7a0b\u4ecd\u5728\u8fd0\u884c\u3002</p>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4ec5\u9002\u7528\u4e8e\u76f8\u540c\u4e3b\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/13/app-pgcontroldata.html\" title=\"pg_controldata\"><span class=\"refentrytitle\"><span class=\"application\">pg_controldata</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgresetwal.html", "localization": {"status": "complete", "sources": [{"url": "/docs/13/app-pgresetwal.html", "method": "same-major semantic node", "sha256": "eba084cf0b1cac82dbd7d831a115f2024da344979c03ad1d9e72365b578e7abd", "language": "zh", "matched_nodes": ["#APP-PGRESETWAL/div[2]/p[1]", "#APP-PGRESETWAL/div[3]/h2[0]", "#APP-PGRESETWAL/div[4]/p[1]", "#APP-PGRESETWAL/div[4]/p[2]", "#APP-PGRESETWAL/div[4]/p[3]", "#APP-PGRESETWAL/div[4]/p[4]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[7]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/div[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/div[3]/h3[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[2]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[7]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[1]", "#APP-PGRESETWAL/div[5]/p[2]", "#APP-PGRESETWAL/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[6]/h2[0]", "#APP-PGRESETWAL/div[7]/h2[0]", "#APP-PGRESETWAL/div[7]/p[1]", "#APP-PGRESETWAL/div[7]/p[2]", "#APP-PGRESETWAL/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/13/description/0": "pg_resetwal \u2014 reset the write-ahead log and other control information of a PostgreSQL database cluster", "/versions/13/facts/0/label": "Documented executable", "/versions/13/facts/1/label": "Executable version", "/versions/13/facts/2/label": "Reference inventory", "/versions/13/facts/2/value": "Server applications", "/versions/13/facts/3/label": "Option definition groups", "/versions/13/tables/0/title": "Documented options", "/versions/13/tables/1/title": "Environment variables", "/versions/13/tables/0/rows/0/summary": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above.", "/versions/13/tables/0/rows/1/summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "/versions/13/tables/0/rows/2/summary": "Display version information, then exit.", "/versions/13/tables/0/rows/3/summary": "Show help, then exit.", "/versions/13/tables/0/rows/4/summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "/versions/13/tables/0/rows/5/summary": "Manually set the next transaction ID's epoch.", "/versions/13/tables/0/rows/6/summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "/versions/13/tables/0/rows/7/summary": "Manually set the next and oldest multitransaction ID.", "/versions/13/tables/0/rows/8/summary": "Manually set the next OID.", "/versions/13/tables/0/rows/9/summary": "Manually set the next multitransaction offset.", "/versions/13/tables/0/columns/0/label": "Option and arguments", "/versions/13/tables/0/columns/1/label": "Description", "/versions/13/tables/0/rows/10/summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "/versions/13/tables/0/rows/11/summary": "Manually set the oldest unfrozen transaction ID.", "/versions/13/tables/0/rows/12/summary": "Manually set the next transaction ID.", "/versions/13/tables/1/columns/0/label": "Variable", "/versions/13/tables/1/columns/1/label": "Meaning", "/versions/13/tables/1/rows/0/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "e03a28ff74712110c99d1166eb80a8963b8278db417b5fd60a495519a71d37be"}, "comparison_data": {"options": [{"names": ["-f", "--force"], "signature": "-f --force", "description": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above."}, {"names": ["-n", "--dry-run"], "signature": "-n --dry-run", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "signature": "-e xid_epoch --epoch= xid_epoch", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "signature": "-l walfile --next-wal-file= walfile", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "signature": "-o oid --next-oid= oid", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "signature": "-O mxoff --multixact-offset= mxoff", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["--wal-segsize= wal_segment_size"], "signature": "--wal-segsize= wal_segment_size", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "signature": "-u xid --oldest-transaction-id= xid", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "signature": "-x xid --next-transaction-id= xid", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "2e75a1fb3e22e5af38c29ab81b14d4bdbfd53bd0d273146c3a3372d6c8d19a7a", "manual_language": "zh"}, "14": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_resetwal"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "14.24"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "13"}], "tables": [{"key": "options", "rows": [{"summary": "\u5982\u4e0a\u6240\u8ff0\uff0c\u5373\u4f7f pg_resetwal \u65e0\u6cd5\u786e\u5b9a pg_control \u7684\u6709\u6548\u6570\u636e\uff0c\u4e5f\u5f3a\u5236\u5176\u7ee7\u7eed\u6267\u884c\u3002", "signature": {"url": "/docs/14/app-pgresetwal.html", "text": "-f --force"}}, {"summary": "-n / --dry-run \u9009\u9879\u4f1a\u8ba9 pg_resetwal \u6253\u5370\u4ece pg_control \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 pg_resetwal \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002", "signature": {"url": "/docs/14/app-pgresetwal.html", "text": "-n --dry-run"}}, {"summary": "\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/14/app-pgresetwal.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/14/app-pgresetwal.html", "text": "-? --help"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/14/app-pgresetwal.html", "text": "-c xid , xid --commit-timestamp-ids= xid , xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002", "signature": {"url": "/docs/14/app-pgresetwal.html", "text": "-e xid_epoch --epoch= xid_epoch"}}, {"summary": "\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002", "signature": {"url": "/docs/14/app-pgresetwal.html", "text": "-l walfile --next-wal-file= walfile"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/14/app-pgresetwal.html", "text": "-m mxid , mxid --multixact-ids= mxid , mxid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002", "signature": {"url": "/docs/14/app-pgresetwal.html", "text": "-o oid --next-oid= oid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002", "signature": {"url": "/docs/14/app-pgresetwal.html", "text": "-O mxoff --multixact-offset= mxoff"}}, {"summary": "\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002", "signature": {"url": "/docs/14/app-pgresetwal.html", "text": "--wal-segsize= wal_segment_size"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/14/app-pgresetwal.html", "text": "-u xid --oldest-transaction-id= xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/14/app-pgresetwal.html", "text": "-x xid --next-transaction-id= xid"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-f", "--force"], "summary": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above.", "signature": "-f --force", "source_url": "/docs/14/app-pgresetwal.html", "description": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above."}, {"names": ["-n", "--dry-run"], "summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "signature": "-n --dry-run", "source_url": "/docs/14/app-pgresetwal.html", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "summary": "Display version information, then exit.", "signature": "-V --version", "source_url": "/docs/14/app-pgresetwal.html", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "summary": "Show help, then exit.", "signature": "-? --help", "source_url": "/docs/14/app-pgresetwal.html", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "source_url": "/docs/14/app-pgresetwal.html", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "summary": "Manually set the next transaction ID's epoch.", "signature": "-e xid_epoch --epoch= xid_epoch", "source_url": "/docs/14/app-pgresetwal.html", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "signature": "-l walfile --next-wal-file= walfile", "source_url": "/docs/14/app-pgresetwal.html", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "summary": "Manually set the next and oldest multitransaction ID.", "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "source_url": "/docs/14/app-pgresetwal.html", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "summary": "Manually set the next OID.", "signature": "-o oid --next-oid= oid", "source_url": "/docs/14/app-pgresetwal.html", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "summary": "Manually set the next multitransaction offset.", "signature": "-O mxoff --multixact-offset= mxoff", "source_url": "/docs/14/app-pgresetwal.html", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["--wal-segsize= wal_segment_size"], "summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "signature": "--wal-segsize= wal_segment_size", "source_url": "/docs/14/app-pgresetwal.html", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "summary": "Manually set the oldest unfrozen transaction ID.", "signature": "-u xid --oldest-transaction-id= xid", "source_url": "/docs/14/app-pgresetwal.html", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "summary": "Manually set the next transaction ID.", "signature": "-x xid --next-transaction-id= xid", "source_url": "/docs/14/app-pgresetwal.html", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v14.24/postgresql-14.24.tar.bz2", "label": "14.24", "major": "14", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/14/postgresql-14-A4.pdf", "bytes": 14354704, "pages": 2944, "sha256": "8bc6b9dd7b246888bb77f0a5e8c39a2eae52e9926569832669c7d1600becb27c", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/14/postgresql-14-US.pdf", "bytes": 14242178, "pages": 3102, "sha256": "b7ecb5a5f62d8b9f73a69e25a7d26ba285373bc53168a553bff7b77955506db4", "built_at": "2026-09-26"}}, "tree": "14", "index": "index.html", "major": "14", "pages": 1158, "release": "14.24", "source_url": "https://ftp.postgresql.org/pub/source/v14.24/postgresql-14.24.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897"}, "revision": "588700d46356d8837c77c7c0a4e71e645fe6535983b8f1830aa8f2e4e41c40ae", "evidence_kind": "English manual and source declarations", "source_sha256": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897"}, "sources": [{"url": "https://pg.center/docs/14/app-pgresetwal.html", "file": "app-pgresetwal.html", "label": "14.24 English manual \u00b7 app-pgresetwal.html", "anchor": "", "sha256": "cb4f0e87edc1e763699c3e62e9e9e17b6913576111bfd2dee78d5311113df1b8", "language": "en", "original_url": "/docs/14/app-pgresetwal.html"}, {"url": "https://pg.center/docs/14/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "db0cdccaa8d3c65ad3b2a07d4956eb5a783a18505bfa0f9d9626eef4ab94fe44", "language": "en", "original_url": "/docs/14/reference-server.html"}], "sections": [], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "signature": "pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir", "description": ["pg_resetwal \u2014 \u91cd\u7f6e PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESETWAL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_resetwal</span></span></h2>\n<p lang=\"zh\">pg_resetwal \u2014 \u91cd\u7f6e <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.8.4.1\"><code class=\"command\">pg_resetwal</code> [ <code class=\"option\">-f</code> | <code class=\"option\">--force</code> ] [ <code class=\"option\">-n</code> | <code class=\"option\">--dry-run</code> ] [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">-D</code> | <code class=\"option\">--pgdata</code> ]<em class=\"replaceable\"><code>datadir</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PGRESETWAL-1\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4f1a\u6e05\u9664\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\uff0c\u5e76\u53ef\u9009\u62e9\u6027\u5730\u91cd\u7f6e\u5b58\u50a8\u5728 <code class=\"filename\">pg_control</code> \u6587\u4ef6\u4e2d\u7684\u67d0\u4e9b\u5176\u4ed6\u63a7\u5236\u4fe1\u606f\u3002\u5982\u679c\u8fd9\u4e9b\u6587\u4ef6\u5df2\u7ecf\u635f\u574f\uff0c\u6709\u65f6\u5c31\u9700\u8981\u4f7f\u7528\u6b64\u529f\u80fd\u3002\u53ea\u6709\u5f53\u670d\u52a1\u5668\u56e0\u8fd9\u7c7b\u635f\u574f\u800c\u65e0\u6cd5\u542f\u52a8\u65f6\uff0c\u624d\u5e94\u5c06\u5176\u4f5c\u4e3a\u6700\u540e\u624b\u6bb5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u8fd0\u884c\u6b64\u547d\u4ee4\u540e\uff0c\u670d\u52a1\u5668\u5e94\u8be5\u53ef\u4ee5\u542f\u52a8\uff1b\u4f46\u8bf7\u8bb0\u4f4f\uff0c\u7531\u4e8e\u4ec5\u90e8\u5206\u63d0\u4ea4\u7684\u4e8b\u52a1\uff0c\u6570\u636e\u5e93\u4e2d\u53ef\u80fd\u542b\u6709\u4e0d\u4e00\u81f4\u7684\u6570\u636e\u3002\u5e94\u7acb\u5373\u8f6c\u50a8\u6570\u636e\uff0c\u8fd0\u884c <code class=\"command\">initdb</code>\uff0c\u7136\u540e\u6062\u590d\u3002\u6062\u590d\u540e\uff0c\u8bf7\u68c0\u67e5\u662f\u5426\u5b58\u5728\u4e0d\u4e00\u81f4\u5e76\u6309\u9700\u4fee\u590d\u3002</p>\n<p lang=\"zh\">\u8be5\u5de5\u5177\u53ea\u80fd\u7531\u5b89\u88c5\u8be5\u670d\u52a1\u5668\u7684\u7528\u6237\u8fd0\u884c\uff0c\u56e0\u4e3a\u5b83\u9700\u8981\u5bf9\u6570\u636e\u76ee\u5f55\u5177\u6709\u8bfb\u5199\u8bbf\u95ee\u6743\u9650\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002<code class=\"command\">pg_resetwal</code> \u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf <code class=\"envar\">PGDATA</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c <code class=\"command\">pg_resetwal</code> \u62a5\u544a\u65e0\u6cd5\u786e\u5b9a <code class=\"filename\">pg_control</code> \u7684\u6709\u6548\u6570\u636e\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u5f3a\u884c\u7ee7\u7eed\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u7f3a\u5931\u7684\u6570\u636e\u5c06\u4ee5\u770b\u4f3c\u5408\u7406\u7684\u503c\u4ee3\u66ff\u3002\u5927\u591a\u6570\u5b57\u6bb5\u9884\u8ba1\u90fd\u80fd\u5339\u914d\uff0c\u4f46\u5bf9\u4e8e\u4e0b\u4e00\u4e2a OID\u3001\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u53ca\u5176\u7eaa\u5143\u3001\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID \u53ca\u5176\u504f\u79fb\u91cf\uff0c\u4ee5\u53ca WAL \u8d77\u59cb\u4f4d\u7f6e\u5b57\u6bb5\uff0c\u53ef\u80fd\u4ecd\u9700\u8981\u4eba\u5de5\u534f\u52a9\u3002\u8fd9\u4e9b\u5b57\u6bb5\u53ef\u901a\u8fc7\u4e0b\u6587\u8ba8\u8bba\u7684\u9009\u9879\u6765\u8bbe\u7f6e\u3002\u5982\u679c\u65e0\u6cd5\u4e3a\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u786e\u5b9a\u6b63\u786e\u503c\uff0c\u4ecd\u7136\u53ef\u4ee5\u4f7f\u7528 <code class=\"option\">-f</code>\uff0c\u4f46\u6062\u590d\u5f97\u5230\u7684\u6570\u636e\u5e93\u5fc5\u987b\u6bd4\u5e73\u65f6\u66f4\u53d7\u6000\u7591\uff1a\u7acb\u5373\u8f6c\u50a8\u5e76\u6062\u590d\u52bf\u5728\u5fc5\u884c\u3002<span class=\"emphasis\"><em>\u5207\u52ff</em></span>\u5728\u5b8c\u6210\u8f6c\u50a8\u4e4b\u524d\u5bf9\u6570\u636e\u5e93\u6267\u884c\u4efb\u4f55\u4fee\u6539\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u56e0\u4e3a\u4efb\u4f55\u6b64\u7c7b\u64cd\u4f5c\u90fd\u5f88\u53ef\u80fd\u4f7f\u635f\u574f\u8fdb\u4e00\u6b65\u6076\u5316\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-f</code><br/></span><span class=\"term\"><code class=\"option\">--force</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u4e0a\u6240\u8ff0\uff0c\u5373\u4f7f <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u786e\u5b9a <code class=\"filename\">pg_control</code> \u7684\u6709\u6548\u6570\u636e\uff0c\u4e5f\u5f3a\u5236\u5176\u7ee7\u7eed\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--dry-run</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"option\">-n</code>/<code class=\"option\">--dry-run</code> \u9009\u9879\u4f1a\u8ba9 <code class=\"command\">pg_resetwal</code> \u6253\u5370\u4ece <code class=\"filename\">pg_control</code> \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u9009\u9879\u4ec5\u5728 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u901a\u8fc7\u8bfb\u53d6 <code class=\"filename\">pg_control</code> \u786e\u5b9a\u9002\u5f53\u503c\u65f6\u624d\u9700\u8981\u4f7f\u7528\u3002\u5b89\u5168\u503c\u53ef\u6309\u4e0b\u8ff0\u65b9\u6cd5\u786e\u5b9a\u3002\u5bf9\u4e8e\u63a5\u53d7\u6570\u5b57\u53c2\u6570\u7684\u9009\u9879\uff0c\u53ef\u4f7f\u7528\u524d\u7f00 <code class=\"literal\">0x</code> \u6307\u5b9a\u5341\u516d\u8fdb\u5236\u503c\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--commit-timestamp-ids=<em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e00\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_commit_ts</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u76f8\u53cd\uff0c\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65b0\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e8c\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u5747\u4e3a\u5341\u516d\u8fdb\u5236\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e <em class=\"replaceable\"><code>xid_epoch</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--epoch=<em class=\"replaceable\"><code>xid_epoch</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002</p>\n<p lang=\"zh\">\u4e8b\u52a1 ID \u7eaa\u5143\u5b9e\u9645\u4e0a\u5e76\u672a\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u4efb\u4f55\u5730\u65b9\uff0c\u9664\u4e86\u7531 <code class=\"command\">pg_resetwal</code> \u8bbe\u7f6e\u7684\u8fd9\u4e2a\u5b57\u6bb5\uff0c\u56e0\u6b64\u5c31\u6570\u636e\u5e93\u672c\u8eab\u800c\u8a00\uff0c\u4efb\u4f55\u503c\u90fd\u53ef\u7528\u3002\u53ef\u80fd\u9700\u8981\u8c03\u6574\u8be5\u503c\uff0c\u4ee5\u786e\u4fdd <span class=\"application\">Slony-I</span> \u548c <span class=\"application\">Skytools</span> \u7b49\u590d\u5236\u7cfb\u7edf\u6b63\u5e38\u5de5\u4f5c \u2014 \u5982\u679c\u786e\u6709\u9700\u8981\uff0c\u5e94\u8be5\u53ef\u4ee5\u4ece\u4e0b\u6e38\u590d\u5236\u6570\u636e\u5e93\u7684\u72b6\u6001\u4e2d\u83b7\u5f97\u5408\u9002\u7684\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>walfile</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-wal-file=<em class=\"replaceable\"><code>walfile</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\u5e94\u5927\u4e8e\u5f53\u524d\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_wal</code> \u76ee\u5f55\u4e2d\u73b0\u5b58\u7684\u4efb\u610f WAL \u6bb5\u6587\u4ef6\u540d\u3002\u8fd9\u4e9b\u540d\u79f0\u540c\u6837\u91c7\u7528\u5341\u516d\u8fdb\u5236\uff0c\u5e76\u7531\u4e09\u4e2a\u90e8\u5206\u7ec4\u6210\u3002\u7b2c\u4e00\u90e8\u5206\u662f<span class=\"quote\">\u201c<span class=\"quote\">\u65f6\u95f4\u7ebf ID</span>\u201d</span>\uff0c\u901a\u5e38\u5e94\u4fdd\u6301\u4e0d\u53d8\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">00000001000000320000004A</code> \u662f <code class=\"filename\">pg_wal</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u5219\u5e94\u4f7f\u7528 <code class=\"literal\">-l 00000001000000320000004B</code> \u6216\u66f4\u5927\u7684\u503c\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u5728\u4f7f\u7528\u975e\u9ed8\u8ba4 WAL \u6bb5\u5927\u5c0f\u65f6\uff0cWAL \u6587\u4ef6\u540d\u4e2d\u7684\u6570\u5b57\u4e0e\u7cfb\u7edf\u51fd\u6570\u548c\u7cfb\u7edf\u89c6\u56fe\u62a5\u544a\u7684 LSN \u4e0d\u540c\u3002\u8be5\u9009\u9879\u63a5\u53d7\u7684\u662f WAL \u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f LSN\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">pg_resetwal \u81ea\u8eab\u4f1a\u68c0\u67e5 pg_wal \u4e2d\u7684\u6587\u4ef6\uff0c\u5e76\u4e3a -l \u9009\u62e9\u4e00\u4e2a\u8d85\u8fc7\u73b0\u6709\u6700\u540e\u4e00\u4e2a\u6587\u4ef6\u540d\u7684\u9ed8\u8ba4\u503c\u3002\u56e0\u6b64\uff0c\u53ea\u6709\u5728\u786e\u5b9a\u5b58\u5728\u5f53\u524d\u4e0d\u5728 pg_wal \u4e2d\u7684 WAL \u6bb5\u6587\u4ef6\uff08\u4f8b\u5982\u79bb\u7ebf\u5f52\u6863\u4e2d\u7684\u6587\u4ef6\uff09\uff0c\u6216 pg_wal \u7684\u5185\u5bb9\u5b8c\u5168\u4e22\u5931\u65f6\uff0c\u624d\u5e94\u8be5\u9700\u8981\u624b\u52a8\u8c03\u6574 -l\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-m <em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-ids=<em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u8981\u786e\u5b9a\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID\uff08\u7b2c\u4e00\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u5728\u6570\u636e\u76ee\u5f55\u4e0b\u7684 pg_multixact/offsets \u76ee\u5f55\u4e2d\u627e\u5230\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5c06\u5176\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 65536\uff080x10000\uff09\u3002\u76f8\u5e94\u5730\uff0c\u8981\u786e\u5b9a\u6700\u65e7\u591a\u4e8b\u52a1 ID\uff08-m \u7684\u7b2c\u4e8c\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u627e\u5230\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 65536\u3002\u6587\u4ef6\u540d\u4f7f\u7528\u5341\u516d\u8fdb\u5236\uff0c\u56e0\u6b64\u6700\u7b80\u5355\u7684\u505a\u6cd5\u662f\u4ee5\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u9009\u9879\u503c\uff0c\u5e76\u5728\u672b\u5c3e\u6dfb\u52a0\u56db\u4e2a\u96f6\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>oid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-oid=<em class=\"replaceable\"><code>oid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002</p>\n<p lang=\"zh\">\u5e76\u6ca1\u6709\u540c\u6837\u7b80\u5355\u7684\u65b9\u6cd5\u6765\u786e\u5b9a\u4e00\u4e2a\u8d85\u51fa\u6570\u636e\u5e93\u4e2d\u6700\u5927 OID \u7684\u4e0b\u4e00\u4e2a OID\uff0c\u4e0d\u8fc7\u5e78\u8fd0\u7684\u662f\uff0c\u4e0b\u4e00\u4e2a OID \u7684\u8bbe\u7f6e\u662f\u5426\u7cbe\u786e\u5e76\u4e0d\u5173\u952e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O <em class=\"replaceable\"><code>mxoff</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-offset=<em class=\"replaceable\"><code>mxoff</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_multixact/members</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 52352 (0xCC80) \u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u8fd9\u91cc\u6ca1\u6709\u50cf\u5176\u4ed6\u9009\u9879\u90a3\u6837\u901a\u8fc7\u8ffd\u52a0\u96f6\u5373\u53ef\u5f97\u5230\u7ed3\u679c\u7684\u7b80\u5355\u65b9\u6cd5\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>wal_segment_size</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u867d\u7136 <code class=\"command\">pg_resetwal</code> \u4f1a\u628a WAL \u8d77\u59cb\u4f4d\u7f6e\u8bbe\u7f6e\u5230\u8d85\u51fa\u73b0\u6709\u6700\u65b0 WAL \u6bb5\u6587\u4ef6\u7684\u4f4d\u7f6e\uff0c\u4f46\u67d0\u4e9b\u6bb5\u5927\u5c0f\u53d8\u66f4\u53ef\u80fd\u5bfc\u81f4\u65e7 WAL \u6587\u4ef6\u540d\u88ab\u91cd\u65b0\u4f7f\u7528\u3002\u5982\u679c WAL \u6587\u4ef6\u540d\u91cd\u53e0\u4f1a\u7ed9\u5f52\u6863\u7b56\u7565\u5e26\u6765\u95ee\u9898\uff0c\u5efa\u8bae\u5c06 <code class=\"option\">-l</code> \u4e0e\u6b64\u9009\u9879\u914d\u5408\u4f7f\u7528\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-u <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--oldest-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0007</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5c0f\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-u 0x700000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0011</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-x 0x1200000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u670d\u52a1\u5668\u8fd0\u884c\u671f\u95f4\u4e0d\u5f97\u4f7f\u7528\u6b64\u547d\u4ee4\u3002\u5982\u679c\u5728\u6570\u636e\u76ee\u5f55\u4e2d\u53d1\u73b0\u670d\u52a1\u5668\u9501\u6587\u4ef6\uff0c<code class=\"command\">pg_resetwal</code> \u5c06\u62d2\u7edd\u542f\u52a8\u3002\u5982\u679c\u670d\u52a1\u5668\u66fe\u5d29\u6e83\uff0c\u53ef\u80fd\u9057\u7559\u9501\u6587\u4ef6\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5220\u9664\u8be5\u9501\u6587\u4ef6\u4ee5\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u8fd0\u884c\u3002\u4f46\u5728\u8fd9\u6837\u505a\u4e4b\u524d\uff0c\u52a1\u5fc5\u518d\u4e09\u786e\u8ba4\u6ca1\u6709\u4efb\u4f55\u670d\u52a1\u5668\u8fdb\u7a0b\u4ecd\u5728\u8fd0\u884c\u3002</p>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4ec5\u9002\u7528\u4e8e\u76f8\u540c\u4e3b\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/14/app-pgcontroldata.html\" title=\"pg_controldata\"><span class=\"refentrytitle\"><span class=\"application\">pg_controldata</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgresetwal.html", "localization": {"status": "complete", "sources": [{"url": "/docs/14/app-pgresetwal.html", "method": "same-major semantic node", "sha256": "0e922f5c12fec36a9d86d607f2ab070591fe6b0e4561a8eec90722280a10a110", "language": "zh", "matched_nodes": ["#APP-PGRESETWAL/div[2]/p[1]", "#APP-PGRESETWAL/div[3]/h2[0]", "#APP-PGRESETWAL/div[4]/p[1]", "#APP-PGRESETWAL/div[4]/p[2]", "#APP-PGRESETWAL/div[4]/p[3]", "#APP-PGRESETWAL/div[4]/p[4]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[7]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/div[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/div[3]/h3[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[2]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[7]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[1]", "#APP-PGRESETWAL/div[5]/p[2]", "#APP-PGRESETWAL/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[6]/h2[0]", "#APP-PGRESETWAL/div[7]/h2[0]", "#APP-PGRESETWAL/div[7]/p[1]", "#APP-PGRESETWAL/div[7]/p[2]", "#APP-PGRESETWAL/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/14/description/0": "pg_resetwal \u2014 reset the write-ahead log and other control information of a PostgreSQL database cluster", "/versions/14/facts/0/label": "Documented executable", "/versions/14/facts/1/label": "Executable version", "/versions/14/facts/2/label": "Reference inventory", "/versions/14/facts/2/value": "Server applications", "/versions/14/facts/3/label": "Option definition groups", "/versions/14/tables/0/title": "Documented options", "/versions/14/tables/1/title": "Environment variables", "/versions/14/tables/0/rows/0/summary": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above.", "/versions/14/tables/0/rows/1/summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "/versions/14/tables/0/rows/2/summary": "Display version information, then exit.", "/versions/14/tables/0/rows/3/summary": "Show help, then exit.", "/versions/14/tables/0/rows/4/summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "/versions/14/tables/0/rows/5/summary": "Manually set the next transaction ID's epoch.", "/versions/14/tables/0/rows/6/summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "/versions/14/tables/0/rows/7/summary": "Manually set the next and oldest multitransaction ID.", "/versions/14/tables/0/rows/8/summary": "Manually set the next OID.", "/versions/14/tables/0/rows/9/summary": "Manually set the next multitransaction offset.", "/versions/14/tables/0/columns/0/label": "Option and arguments", "/versions/14/tables/0/columns/1/label": "Description", "/versions/14/tables/0/rows/10/summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "/versions/14/tables/0/rows/11/summary": "Manually set the oldest unfrozen transaction ID.", "/versions/14/tables/0/rows/12/summary": "Manually set the next transaction ID.", "/versions/14/tables/1/columns/0/label": "Variable", "/versions/14/tables/1/columns/1/label": "Meaning", "/versions/14/tables/1/rows/0/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "93fa1a717cc81ffbed777ed377963bb2143051c91f16cf66ab675a3f882a9377"}, "comparison_data": {"options": [{"names": ["-f", "--force"], "signature": "-f --force", "description": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above."}, {"names": ["-n", "--dry-run"], "signature": "-n --dry-run", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "signature": "-e xid_epoch --epoch= xid_epoch", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "signature": "-l walfile --next-wal-file= walfile", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "signature": "-o oid --next-oid= oid", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "signature": "-O mxoff --multixact-offset= mxoff", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["--wal-segsize= wal_segment_size"], "signature": "--wal-segsize= wal_segment_size", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "signature": "-u xid --oldest-transaction-id= xid", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "signature": "-x xid --next-transaction-id= xid", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "2e75a1fb3e22e5af38c29ab81b14d4bdbfd53bd0d273146c3a3372d6c8d19a7a", "manual_language": "zh"}, "15": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_resetwal"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "15.19"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "13"}], "tables": [{"key": "options", "rows": [{"summary": "\u5982\u4e0a\u6240\u8ff0\uff0c\u5373\u4f7f pg_resetwal \u65e0\u6cd5\u786e\u5b9a pg_control \u7684\u6709\u6548\u6570\u636e\uff0c\u4e5f\u5f3a\u5236\u5176\u7ee7\u7eed\u6267\u884c\u3002", "signature": {"url": "/docs/15/app-pgresetwal.html", "text": "-f --force"}}, {"summary": "-n / --dry-run \u9009\u9879\u4f1a\u8ba9 pg_resetwal \u6253\u5370\u4ece pg_control \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 pg_resetwal \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002", "signature": {"url": "/docs/15/app-pgresetwal.html", "text": "-n --dry-run"}}, {"summary": "\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/15/app-pgresetwal.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/15/app-pgresetwal.html", "text": "-? --help"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/15/app-pgresetwal.html", "text": "-c xid , xid --commit-timestamp-ids= xid , xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002", "signature": {"url": "/docs/15/app-pgresetwal.html", "text": "-e xid_epoch --epoch= xid_epoch"}}, {"summary": "\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002", "signature": {"url": "/docs/15/app-pgresetwal.html", "text": "-l walfile --next-wal-file= walfile"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/15/app-pgresetwal.html", "text": "-m mxid , mxid --multixact-ids= mxid , mxid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002", "signature": {"url": "/docs/15/app-pgresetwal.html", "text": "-o oid --next-oid= oid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002", "signature": {"url": "/docs/15/app-pgresetwal.html", "text": "-O mxoff --multixact-offset= mxoff"}}, {"summary": "\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002", "signature": {"url": "/docs/15/app-pgresetwal.html", "text": "--wal-segsize= wal_segment_size"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/15/app-pgresetwal.html", "text": "-u xid --oldest-transaction-id= xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/15/app-pgresetwal.html", "text": "-x xid --next-transaction-id= xid"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-f", "--force"], "summary": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above.", "signature": "-f --force", "source_url": "/docs/15/app-pgresetwal.html", "description": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above."}, {"names": ["-n", "--dry-run"], "summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "signature": "-n --dry-run", "source_url": "/docs/15/app-pgresetwal.html", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "summary": "Display version information, then exit.", "signature": "-V --version", "source_url": "/docs/15/app-pgresetwal.html", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "summary": "Show help, then exit.", "signature": "-? --help", "source_url": "/docs/15/app-pgresetwal.html", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "source_url": "/docs/15/app-pgresetwal.html", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "summary": "Manually set the next transaction ID's epoch.", "signature": "-e xid_epoch --epoch= xid_epoch", "source_url": "/docs/15/app-pgresetwal.html", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "signature": "-l walfile --next-wal-file= walfile", "source_url": "/docs/15/app-pgresetwal.html", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "summary": "Manually set the next and oldest multitransaction ID.", "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "source_url": "/docs/15/app-pgresetwal.html", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "summary": "Manually set the next OID.", "signature": "-o oid --next-oid= oid", "source_url": "/docs/15/app-pgresetwal.html", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "summary": "Manually set the next multitransaction offset.", "signature": "-O mxoff --multixact-offset= mxoff", "source_url": "/docs/15/app-pgresetwal.html", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["--wal-segsize= wal_segment_size"], "summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "signature": "--wal-segsize= wal_segment_size", "source_url": "/docs/15/app-pgresetwal.html", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "summary": "Manually set the oldest unfrozen transaction ID.", "signature": "-u xid --oldest-transaction-id= xid", "source_url": "/docs/15/app-pgresetwal.html", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "summary": "Manually set the next transaction ID.", "signature": "-x xid --next-transaction-id= xid", "source_url": "/docs/15/app-pgresetwal.html", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v15.19/postgresql-15.19.tar.bz2", "label": "15.19", "major": "15", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/15/postgresql-15-A4.pdf", "bytes": 14609140, "pages": 2987, "sha256": "66228564a4d16efb47d6a914085716ecfe22ca1566db56bc7c3d82f790646d72", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/15/postgresql-15-US.pdf", "bytes": 14495690, "pages": 3153, "sha256": "645a498c2390d47a6223ec74770631185807a19c484edb0fc5a295d9f460bc02", "built_at": "2026-09-26"}}, "tree": "15", "index": "index.html", "major": "15", "pages": 1168, "release": "15.19", "source_url": "https://ftp.postgresql.org/pub/source/v15.19/postgresql-15.19.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89"}, "revision": "6af958c6520151fc7697d56e0616b03fb00522c4568158674d452ae0644ba545", "evidence_kind": "English manual and source declarations", "source_sha256": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89"}, "sources": [{"url": "https://pg.center/docs/15/app-pgresetwal.html", "file": "app-pgresetwal.html", "label": "15.19 English manual \u00b7 app-pgresetwal.html", "anchor": "", "sha256": "1c31ec3fe40af133804565a66d8f4f81fc02b72b16b7154553b1f6ffff6486bc", "language": "en", "original_url": "/docs/15/app-pgresetwal.html"}, {"url": "https://pg.center/docs/15/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "1240cfbb13ebfd22aac8d5ae40c62a9015b246f7774bcf0bce97355ce06350a0", "language": "en", "original_url": "/docs/15/reference-server.html"}], "sections": [], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "signature": "pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir", "description": ["pg_resetwal \u2014 \u91cd\u7f6e PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESETWAL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_resetwal</span></span></h2>\n<p lang=\"zh\">pg_resetwal \u2014 \u91cd\u7f6e <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.8.4.1\"><code class=\"command\">pg_resetwal</code> [ <code class=\"option\">-f</code> | <code class=\"option\">--force</code> ] [ <code class=\"option\">-n</code> | <code class=\"option\">--dry-run</code> ] [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">-D</code> | <code class=\"option\">--pgdata</code> ]<em class=\"replaceable\"><code>datadir</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PGRESETWAL-1\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4f1a\u6e05\u9664\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\uff0c\u5e76\u53ef\u9009\u62e9\u6027\u5730\u91cd\u7f6e\u5b58\u50a8\u5728 <code class=\"filename\">pg_control</code> \u6587\u4ef6\u4e2d\u7684\u67d0\u4e9b\u5176\u4ed6\u63a7\u5236\u4fe1\u606f\u3002\u5982\u679c\u8fd9\u4e9b\u6587\u4ef6\u5df2\u7ecf\u635f\u574f\uff0c\u6709\u65f6\u5c31\u9700\u8981\u4f7f\u7528\u6b64\u529f\u80fd\u3002\u53ea\u6709\u5f53\u670d\u52a1\u5668\u56e0\u8fd9\u7c7b\u635f\u574f\u800c\u65e0\u6cd5\u542f\u52a8\u65f6\uff0c\u624d\u5e94\u5c06\u5176\u4f5c\u4e3a\u6700\u540e\u624b\u6bb5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u8fd0\u884c\u6b64\u547d\u4ee4\u540e\uff0c\u670d\u52a1\u5668\u5e94\u8be5\u53ef\u4ee5\u542f\u52a8\uff1b\u4f46\u8bf7\u8bb0\u4f4f\uff0c\u7531\u4e8e\u4ec5\u90e8\u5206\u63d0\u4ea4\u7684\u4e8b\u52a1\uff0c\u6570\u636e\u5e93\u4e2d\u53ef\u80fd\u542b\u6709\u4e0d\u4e00\u81f4\u7684\u6570\u636e\u3002\u5e94\u7acb\u5373\u8f6c\u50a8\u6570\u636e\uff0c\u8fd0\u884c <code class=\"command\">initdb</code>\uff0c\u7136\u540e\u6062\u590d\u3002\u6062\u590d\u540e\uff0c\u8bf7\u68c0\u67e5\u662f\u5426\u5b58\u5728\u4e0d\u4e00\u81f4\u5e76\u6309\u9700\u4fee\u590d\u3002</p>\n<p lang=\"zh\">\u8be5\u5de5\u5177\u53ea\u80fd\u7531\u5b89\u88c5\u8be5\u670d\u52a1\u5668\u7684\u7528\u6237\u8fd0\u884c\uff0c\u56e0\u4e3a\u5b83\u9700\u8981\u5bf9\u6570\u636e\u76ee\u5f55\u5177\u6709\u8bfb\u5199\u8bbf\u95ee\u6743\u9650\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002<code class=\"command\">pg_resetwal</code> \u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf <code class=\"envar\">PGDATA</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c <code class=\"command\">pg_resetwal</code> \u62a5\u544a\u65e0\u6cd5\u786e\u5b9a <code class=\"filename\">pg_control</code> \u7684\u6709\u6548\u6570\u636e\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u5f3a\u884c\u7ee7\u7eed\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u7f3a\u5931\u7684\u6570\u636e\u5c06\u4ee5\u770b\u4f3c\u5408\u7406\u7684\u503c\u4ee3\u66ff\u3002\u5927\u591a\u6570\u5b57\u6bb5\u9884\u8ba1\u90fd\u80fd\u5339\u914d\uff0c\u4f46\u5bf9\u4e8e\u4e0b\u4e00\u4e2a OID\u3001\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u53ca\u5176\u7eaa\u5143\u3001\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID \u53ca\u5176\u504f\u79fb\u91cf\uff0c\u4ee5\u53ca WAL \u8d77\u59cb\u4f4d\u7f6e\u5b57\u6bb5\uff0c\u53ef\u80fd\u4ecd\u9700\u8981\u4eba\u5de5\u534f\u52a9\u3002\u8fd9\u4e9b\u5b57\u6bb5\u53ef\u901a\u8fc7\u4e0b\u6587\u8ba8\u8bba\u7684\u9009\u9879\u6765\u8bbe\u7f6e\u3002\u5982\u679c\u65e0\u6cd5\u4e3a\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u786e\u5b9a\u6b63\u786e\u503c\uff0c\u4ecd\u7136\u53ef\u4ee5\u4f7f\u7528 <code class=\"option\">-f</code>\uff0c\u4f46\u6062\u590d\u5f97\u5230\u7684\u6570\u636e\u5e93\u5fc5\u987b\u6bd4\u5e73\u65f6\u66f4\u53d7\u6000\u7591\uff1a\u7acb\u5373\u8f6c\u50a8\u5e76\u6062\u590d\u52bf\u5728\u5fc5\u884c\u3002<span class=\"emphasis\"><em>\u5207\u52ff</em></span>\u5728\u5b8c\u6210\u8f6c\u50a8\u4e4b\u524d\u5bf9\u6570\u636e\u5e93\u6267\u884c\u4efb\u4f55\u4fee\u6539\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u56e0\u4e3a\u4efb\u4f55\u6b64\u7c7b\u64cd\u4f5c\u90fd\u5f88\u53ef\u80fd\u4f7f\u635f\u574f\u8fdb\u4e00\u6b65\u6076\u5316\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-f</code><br/></span><span class=\"term\"><code class=\"option\">--force</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u4e0a\u6240\u8ff0\uff0c\u5373\u4f7f <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u786e\u5b9a <code class=\"filename\">pg_control</code> \u7684\u6709\u6548\u6570\u636e\uff0c\u4e5f\u5f3a\u5236\u5176\u7ee7\u7eed\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--dry-run</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"option\">-n</code>/<code class=\"option\">--dry-run</code> \u9009\u9879\u4f1a\u8ba9 <code class=\"command\">pg_resetwal</code> \u6253\u5370\u4ece <code class=\"filename\">pg_control</code> \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u9009\u9879\u4ec5\u5728 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u901a\u8fc7\u8bfb\u53d6 <code class=\"filename\">pg_control</code> \u786e\u5b9a\u9002\u5f53\u503c\u65f6\u624d\u9700\u8981\u4f7f\u7528\u3002\u5b89\u5168\u503c\u53ef\u6309\u4e0b\u8ff0\u65b9\u6cd5\u786e\u5b9a\u3002\u5bf9\u4e8e\u63a5\u53d7\u6570\u5b57\u53c2\u6570\u7684\u9009\u9879\uff0c\u53ef\u4f7f\u7528\u524d\u7f00 <code class=\"literal\">0x</code> \u6307\u5b9a\u5341\u516d\u8fdb\u5236\u503c\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--commit-timestamp-ids=<em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e00\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_commit_ts</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u76f8\u53cd\uff0c\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65b0\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e8c\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u5747\u4e3a\u5341\u516d\u8fdb\u5236\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e <em class=\"replaceable\"><code>xid_epoch</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--epoch=<em class=\"replaceable\"><code>xid_epoch</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002</p>\n<p lang=\"zh\">\u4e8b\u52a1 ID \u7eaa\u5143\u5b9e\u9645\u4e0a\u5e76\u672a\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u4efb\u4f55\u5730\u65b9\uff0c\u9664\u4e86\u7531 <code class=\"command\">pg_resetwal</code> \u8bbe\u7f6e\u7684\u8fd9\u4e2a\u5b57\u6bb5\uff0c\u56e0\u6b64\u5c31\u6570\u636e\u5e93\u672c\u8eab\u800c\u8a00\uff0c\u4efb\u4f55\u503c\u90fd\u53ef\u7528\u3002\u53ef\u80fd\u9700\u8981\u8c03\u6574\u8be5\u503c\uff0c\u4ee5\u786e\u4fdd <span class=\"application\">Slony-I</span> \u548c <span class=\"application\">Skytools</span> \u7b49\u590d\u5236\u7cfb\u7edf\u6b63\u5e38\u5de5\u4f5c \u2014 \u5982\u679c\u786e\u6709\u9700\u8981\uff0c\u5e94\u8be5\u53ef\u4ee5\u4ece\u4e0b\u6e38\u590d\u5236\u6570\u636e\u5e93\u7684\u72b6\u6001\u4e2d\u83b7\u5f97\u5408\u9002\u7684\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>walfile</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-wal-file=<em class=\"replaceable\"><code>walfile</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\u5e94\u5927\u4e8e\u5f53\u524d\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_wal</code> \u76ee\u5f55\u4e2d\u73b0\u5b58\u7684\u4efb\u610f WAL \u6bb5\u6587\u4ef6\u540d\u3002\u8fd9\u4e9b\u540d\u79f0\u540c\u6837\u91c7\u7528\u5341\u516d\u8fdb\u5236\uff0c\u5e76\u7531\u4e09\u4e2a\u90e8\u5206\u7ec4\u6210\u3002\u7b2c\u4e00\u90e8\u5206\u662f<span class=\"quote\">\u201c<span class=\"quote\">\u65f6\u95f4\u7ebf ID</span>\u201d</span>\uff0c\u901a\u5e38\u5e94\u4fdd\u6301\u4e0d\u53d8\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">00000001000000320000004A</code> \u662f <code class=\"filename\">pg_wal</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u5219\u5e94\u4f7f\u7528 <code class=\"literal\">-l 00000001000000320000004B</code> \u6216\u66f4\u5927\u7684\u503c\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u5728\u4f7f\u7528\u975e\u9ed8\u8ba4 WAL \u6bb5\u5927\u5c0f\u65f6\uff0cWAL \u6587\u4ef6\u540d\u4e2d\u7684\u6570\u5b57\u4e0e\u7cfb\u7edf\u51fd\u6570\u548c\u7cfb\u7edf\u89c6\u56fe\u62a5\u544a\u7684 LSN \u4e0d\u540c\u3002\u8be5\u9009\u9879\u63a5\u53d7\u7684\u662f WAL \u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f LSN\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">pg_resetwal \u81ea\u8eab\u4f1a\u68c0\u67e5 pg_wal \u4e2d\u7684\u6587\u4ef6\uff0c\u5e76\u4e3a -l \u9009\u62e9\u4e00\u4e2a\u8d85\u8fc7\u73b0\u6709\u6700\u540e\u4e00\u4e2a\u6587\u4ef6\u540d\u7684\u9ed8\u8ba4\u503c\u3002\u56e0\u6b64\uff0c\u53ea\u6709\u5728\u786e\u5b9a\u5b58\u5728\u5f53\u524d\u4e0d\u5728 pg_wal \u4e2d\u7684 WAL \u6bb5\u6587\u4ef6\uff08\u4f8b\u5982\u79bb\u7ebf\u5f52\u6863\u4e2d\u7684\u6587\u4ef6\uff09\uff0c\u6216 pg_wal \u7684\u5185\u5bb9\u5b8c\u5168\u4e22\u5931\u65f6\uff0c\u624d\u5e94\u8be5\u9700\u8981\u624b\u52a8\u8c03\u6574 -l\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-m <em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-ids=<em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u8981\u786e\u5b9a\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID\uff08\u7b2c\u4e00\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u5728\u6570\u636e\u76ee\u5f55\u4e0b\u7684 pg_multixact/offsets \u76ee\u5f55\u4e2d\u627e\u5230\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5c06\u5176\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 65536\uff080x10000\uff09\u3002\u76f8\u5e94\u5730\uff0c\u8981\u786e\u5b9a\u6700\u65e7\u591a\u4e8b\u52a1 ID\uff08-m \u7684\u7b2c\u4e8c\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u627e\u5230\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 65536\u3002\u6587\u4ef6\u540d\u4f7f\u7528\u5341\u516d\u8fdb\u5236\uff0c\u56e0\u6b64\u6700\u7b80\u5355\u7684\u505a\u6cd5\u662f\u4ee5\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u9009\u9879\u503c\uff0c\u5e76\u5728\u672b\u5c3e\u6dfb\u52a0\u56db\u4e2a\u96f6\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>oid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-oid=<em class=\"replaceable\"><code>oid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002</p>\n<p lang=\"zh\">\u5e76\u6ca1\u6709\u540c\u6837\u7b80\u5355\u7684\u65b9\u6cd5\u6765\u786e\u5b9a\u4e00\u4e2a\u8d85\u51fa\u6570\u636e\u5e93\u4e2d\u6700\u5927 OID \u7684\u4e0b\u4e00\u4e2a OID\uff0c\u4e0d\u8fc7\u5e78\u8fd0\u7684\u662f\uff0c\u4e0b\u4e00\u4e2a OID \u7684\u8bbe\u7f6e\u662f\u5426\u7cbe\u786e\u5e76\u4e0d\u5173\u952e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O <em class=\"replaceable\"><code>mxoff</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-offset=<em class=\"replaceable\"><code>mxoff</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_multixact/members</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 52352 (0xCC80) \u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u8fd9\u91cc\u6ca1\u6709\u50cf\u5176\u4ed6\u9009\u9879\u90a3\u6837\u901a\u8fc7\u8ffd\u52a0\u96f6\u5373\u53ef\u5f97\u5230\u7ed3\u679c\u7684\u7b80\u5355\u65b9\u6cd5\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>wal_segment_size</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u867d\u7136 <code class=\"command\">pg_resetwal</code> \u4f1a\u628a WAL \u8d77\u59cb\u4f4d\u7f6e\u8bbe\u7f6e\u5230\u8d85\u51fa\u73b0\u6709\u6700\u65b0 WAL \u6bb5\u6587\u4ef6\u7684\u4f4d\u7f6e\uff0c\u4f46\u67d0\u4e9b\u6bb5\u5927\u5c0f\u53d8\u66f4\u53ef\u80fd\u5bfc\u81f4\u65e7 WAL \u6587\u4ef6\u540d\u88ab\u91cd\u65b0\u4f7f\u7528\u3002\u5982\u679c WAL \u6587\u4ef6\u540d\u91cd\u53e0\u4f1a\u7ed9\u5f52\u6863\u7b56\u7565\u5e26\u6765\u95ee\u9898\uff0c\u5efa\u8bae\u5c06 <code class=\"option\">-l</code> \u4e0e\u6b64\u9009\u9879\u914d\u5408\u4f7f\u7528\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-u <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--oldest-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0007</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5c0f\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-u 0x700000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0011</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-x 0x1200000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u670d\u52a1\u5668\u8fd0\u884c\u671f\u95f4\u4e0d\u5f97\u4f7f\u7528\u6b64\u547d\u4ee4\u3002\u5982\u679c\u5728\u6570\u636e\u76ee\u5f55\u4e2d\u53d1\u73b0\u670d\u52a1\u5668\u9501\u6587\u4ef6\uff0c<code class=\"command\">pg_resetwal</code> \u5c06\u62d2\u7edd\u542f\u52a8\u3002\u5982\u679c\u670d\u52a1\u5668\u66fe\u5d29\u6e83\uff0c\u53ef\u80fd\u9057\u7559\u9501\u6587\u4ef6\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5220\u9664\u8be5\u9501\u6587\u4ef6\u4ee5\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u8fd0\u884c\u3002\u4f46\u5728\u8fd9\u6837\u505a\u4e4b\u524d\uff0c\u52a1\u5fc5\u518d\u4e09\u786e\u8ba4\u6ca1\u6709\u4efb\u4f55\u670d\u52a1\u5668\u8fdb\u7a0b\u4ecd\u5728\u8fd0\u884c\u3002</p>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4ec5\u9002\u7528\u4e8e\u76f8\u540c\u4e3b\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/15/app-pgcontroldata.html\" title=\"pg_controldata\"><span class=\"refentrytitle\"><span class=\"application\">pg_controldata</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgresetwal.html", "localization": {"status": "complete", "sources": [{"url": "/docs/15/app-pgresetwal.html", "method": "same-major semantic node", "sha256": "930b093d0de6ce38e38cf6b0014b78f19d148defa6381ba6ce14ec29577bc9b9", "language": "zh", "matched_nodes": ["#APP-PGRESETWAL/div[2]/p[1]", "#APP-PGRESETWAL/div[3]/h2[0]", "#APP-PGRESETWAL/div[4]/p[1]", "#APP-PGRESETWAL/div[4]/p[2]", "#APP-PGRESETWAL/div[4]/p[3]", "#APP-PGRESETWAL/div[4]/p[4]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[7]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/div[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/div[3]/h3[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[2]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[7]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[1]", "#APP-PGRESETWAL/div[5]/p[2]", "#APP-PGRESETWAL/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[6]/h2[0]", "#APP-PGRESETWAL/div[7]/h2[0]", "#APP-PGRESETWAL/div[7]/p[1]", "#APP-PGRESETWAL/div[7]/p[2]", "#APP-PGRESETWAL/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/15/description/0": "pg_resetwal \u2014 reset the write-ahead log and other control information of a PostgreSQL database cluster", "/versions/15/facts/0/label": "Documented executable", "/versions/15/facts/1/label": "Executable version", "/versions/15/facts/2/label": "Reference inventory", "/versions/15/facts/2/value": "Server applications", "/versions/15/facts/3/label": "Option definition groups", "/versions/15/tables/0/title": "Documented options", "/versions/15/tables/1/title": "Environment variables", "/versions/15/tables/0/rows/0/summary": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above.", "/versions/15/tables/0/rows/1/summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "/versions/15/tables/0/rows/2/summary": "Display version information, then exit.", "/versions/15/tables/0/rows/3/summary": "Show help, then exit.", "/versions/15/tables/0/rows/4/summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "/versions/15/tables/0/rows/5/summary": "Manually set the next transaction ID's epoch.", "/versions/15/tables/0/rows/6/summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "/versions/15/tables/0/rows/7/summary": "Manually set the next and oldest multitransaction ID.", "/versions/15/tables/0/rows/8/summary": "Manually set the next OID.", "/versions/15/tables/0/rows/9/summary": "Manually set the next multitransaction offset.", "/versions/15/tables/0/columns/0/label": "Option and arguments", "/versions/15/tables/0/columns/1/label": "Description", "/versions/15/tables/0/rows/10/summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "/versions/15/tables/0/rows/11/summary": "Manually set the oldest unfrozen transaction ID.", "/versions/15/tables/0/rows/12/summary": "Manually set the next transaction ID.", "/versions/15/tables/1/columns/0/label": "Variable", "/versions/15/tables/1/columns/1/label": "Meaning", "/versions/15/tables/1/rows/0/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "51a024b80cbd356de2d8e96f1a58ffd4279035b8da479a9231b39fe197ae0874"}, "comparison_data": {"options": [{"names": ["-f", "--force"], "signature": "-f --force", "description": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above."}, {"names": ["-n", "--dry-run"], "signature": "-n --dry-run", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "signature": "-e xid_epoch --epoch= xid_epoch", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "signature": "-l walfile --next-wal-file= walfile", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "signature": "-o oid --next-oid= oid", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "signature": "-O mxoff --multixact-offset= mxoff", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["--wal-segsize= wal_segment_size"], "signature": "--wal-segsize= wal_segment_size", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "signature": "-u xid --oldest-transaction-id= xid", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "signature": "-x xid --next-transaction-id= xid", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "2e75a1fb3e22e5af38c29ab81b14d4bdbfd53bd0d273146c3a3372d6c8d19a7a", "manual_language": "zh"}, "16": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_resetwal"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "16.15"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "13"}], "tables": [{"key": "options", "rows": [{"summary": "\u5982\u4e0a\u6240\u8ff0\uff0c\u5373\u4f7f pg_resetwal \u65e0\u6cd5\u786e\u5b9a pg_control \u7684\u6709\u6548\u6570\u636e\uff0c\u4e5f\u5f3a\u5236\u5176\u7ee7\u7eed\u6267\u884c\u3002", "signature": {"url": "/docs/16/app-pgresetwal.html", "text": "-f --force"}}, {"summary": "-n / --dry-run \u9009\u9879\u4f1a\u8ba9 pg_resetwal \u6253\u5370\u4ece pg_control \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 pg_resetwal \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002", "signature": {"url": "/docs/16/app-pgresetwal.html", "text": "-n --dry-run"}}, {"summary": "\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/16/app-pgresetwal.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/16/app-pgresetwal.html", "text": "-? --help"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/16/app-pgresetwal.html", "text": "-c xid , xid --commit-timestamp-ids= xid , xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002", "signature": {"url": "/docs/16/app-pgresetwal.html", "text": "-e xid_epoch --epoch= xid_epoch"}}, {"summary": "\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002", "signature": {"url": "/docs/16/app-pgresetwal.html", "text": "-l walfile --next-wal-file= walfile"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/16/app-pgresetwal.html", "text": "-m mxid , mxid --multixact-ids= mxid , mxid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002", "signature": {"url": "/docs/16/app-pgresetwal.html", "text": "-o oid --next-oid= oid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002", "signature": {"url": "/docs/16/app-pgresetwal.html", "text": "-O mxoff --multixact-offset= mxoff"}}, {"summary": "\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002", "signature": {"url": "/docs/16/app-pgresetwal.html", "text": "--wal-segsize= wal_segment_size"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/16/app-pgresetwal.html", "text": "-u xid --oldest-transaction-id= xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/16/app-pgresetwal.html", "text": "-x xid --next-transaction-id= xid"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-f", "--force"], "summary": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above.", "signature": "-f --force", "source_url": "/docs/16/app-pgresetwal.html", "description": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above."}, {"names": ["-n", "--dry-run"], "summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "signature": "-n --dry-run", "source_url": "/docs/16/app-pgresetwal.html", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "summary": "Display version information, then exit.", "signature": "-V --version", "source_url": "/docs/16/app-pgresetwal.html", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "summary": "Show help, then exit.", "signature": "-? --help", "source_url": "/docs/16/app-pgresetwal.html", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "source_url": "/docs/16/app-pgresetwal.html", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "summary": "Manually set the next transaction ID's epoch.", "signature": "-e xid_epoch --epoch= xid_epoch", "source_url": "/docs/16/app-pgresetwal.html", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "signature": "-l walfile --next-wal-file= walfile", "source_url": "/docs/16/app-pgresetwal.html", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "summary": "Manually set the next and oldest multitransaction ID.", "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "source_url": "/docs/16/app-pgresetwal.html", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "summary": "Manually set the next OID.", "signature": "-o oid --next-oid= oid", "source_url": "/docs/16/app-pgresetwal.html", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "summary": "Manually set the next multitransaction offset.", "signature": "-O mxoff --multixact-offset= mxoff", "source_url": "/docs/16/app-pgresetwal.html", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["--wal-segsize= wal_segment_size"], "summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "signature": "--wal-segsize= wal_segment_size", "source_url": "/docs/16/app-pgresetwal.html", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "summary": "Manually set the oldest unfrozen transaction ID.", "signature": "-u xid --oldest-transaction-id= xid", "source_url": "/docs/16/app-pgresetwal.html", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "summary": "Manually set the next transaction ID.", "signature": "-x xid --next-transaction-id= xid", "source_url": "/docs/16/app-pgresetwal.html", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v16.15/postgresql-16.15.tar.bz2", "label": "16.15", "major": "16", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/16/postgresql-16-A4.pdf", "bytes": 15282337, "pages": 3055, "sha256": "4bb6c1f63deedac98736d8c4c7bc0fad0ac24e85b07e21ee10411872f06afd06", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/16/postgresql-16-US.pdf", "bytes": 15164148, "pages": 3220, "sha256": "5b6b6166c89991199e144bb0ae34c17a5f29826251dbf19db1abc0df3a3e771b", "built_at": "2026-09-26"}}, "tree": "16", "index": "index.html", "major": "16", "pages": 1169, "release": "16.15", "source_url": "https://ftp.postgresql.org/pub/source/v16.15/postgresql-16.15.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed"}, "revision": "3c21e58b35318021716440e67bb8bafd392b6a2b965a244d90e9e33c99e0bdef", "evidence_kind": "English manual and source declarations", "source_sha256": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed"}, "sources": [{"url": "https://pg.center/docs/16/app-pgresetwal.html", "file": "app-pgresetwal.html", "label": "16.15 English manual \u00b7 app-pgresetwal.html", "anchor": "", "sha256": "780ee88eccc1cd549ae28e5d6f5ee403300d3cd6836febade42cc9c25e33afb9", "language": "en", "original_url": "/docs/16/app-pgresetwal.html"}, {"url": "https://pg.center/docs/16/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "8aaa4422eece8f26d84715f855d9d0f7f87b200f8b82898c73c865ee42c2c70f", "language": "en", "original_url": "/docs/16/reference-server.html"}], "sections": [], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "signature": "pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir", "description": ["pg_resetwal \u2014 \u91cd\u7f6e PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESETWAL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_resetwal</span></span></h2>\n<p lang=\"zh\">pg_resetwal \u2014 \u91cd\u7f6e <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.8.4.1\"><code class=\"command\">pg_resetwal</code> [ <code class=\"option\">-f</code> | <code class=\"option\">--force</code> ] [ <code class=\"option\">-n</code> | <code class=\"option\">--dry-run</code> ] [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">-D</code> | <code class=\"option\">--pgdata</code> ]<em class=\"replaceable\"><code>datadir</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PGRESETWAL-1\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4f1a\u6e05\u9664\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\uff0c\u5e76\u53ef\u9009\u62e9\u6027\u5730\u91cd\u7f6e\u5b58\u50a8\u5728 <code class=\"filename\">pg_control</code> \u6587\u4ef6\u4e2d\u7684\u67d0\u4e9b\u5176\u4ed6\u63a7\u5236\u4fe1\u606f\u3002\u5982\u679c\u8fd9\u4e9b\u6587\u4ef6\u5df2\u7ecf\u635f\u574f\uff0c\u6709\u65f6\u5c31\u9700\u8981\u4f7f\u7528\u6b64\u529f\u80fd\u3002\u53ea\u6709\u5f53\u670d\u52a1\u5668\u56e0\u8fd9\u7c7b\u635f\u574f\u800c\u65e0\u6cd5\u542f\u52a8\u65f6\uff0c\u624d\u5e94\u5c06\u5176\u4f5c\u4e3a\u6700\u540e\u624b\u6bb5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u8fd0\u884c\u6b64\u547d\u4ee4\u540e\uff0c\u670d\u52a1\u5668\u5e94\u8be5\u53ef\u4ee5\u542f\u52a8\uff1b\u4f46\u8bf7\u8bb0\u4f4f\uff0c\u7531\u4e8e\u4ec5\u90e8\u5206\u63d0\u4ea4\u7684\u4e8b\u52a1\uff0c\u6570\u636e\u5e93\u4e2d\u53ef\u80fd\u542b\u6709\u4e0d\u4e00\u81f4\u7684\u6570\u636e\u3002\u5e94\u7acb\u5373\u8f6c\u50a8\u6570\u636e\uff0c\u8fd0\u884c <code class=\"command\">initdb</code>\uff0c\u7136\u540e\u6062\u590d\u3002\u6062\u590d\u540e\uff0c\u8bf7\u68c0\u67e5\u662f\u5426\u5b58\u5728\u4e0d\u4e00\u81f4\u5e76\u6309\u9700\u4fee\u590d\u3002</p>\n<p lang=\"zh\">\u8be5\u5de5\u5177\u53ea\u80fd\u7531\u5b89\u88c5\u8be5\u670d\u52a1\u5668\u7684\u7528\u6237\u8fd0\u884c\uff0c\u56e0\u4e3a\u5b83\u9700\u8981\u5bf9\u6570\u636e\u76ee\u5f55\u5177\u6709\u8bfb\u5199\u8bbf\u95ee\u6743\u9650\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002<code class=\"command\">pg_resetwal</code> \u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf <code class=\"envar\">PGDATA</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c <code class=\"command\">pg_resetwal</code> \u62a5\u544a\u65e0\u6cd5\u786e\u5b9a <code class=\"filename\">pg_control</code> \u7684\u6709\u6548\u6570\u636e\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u5f3a\u884c\u7ee7\u7eed\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u7f3a\u5931\u7684\u6570\u636e\u5c06\u4ee5\u770b\u4f3c\u5408\u7406\u7684\u503c\u4ee3\u66ff\u3002\u5927\u591a\u6570\u5b57\u6bb5\u9884\u8ba1\u90fd\u80fd\u5339\u914d\uff0c\u4f46\u5bf9\u4e8e\u4e0b\u4e00\u4e2a OID\u3001\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u53ca\u5176\u7eaa\u5143\u3001\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID \u53ca\u5176\u504f\u79fb\u91cf\uff0c\u4ee5\u53ca WAL \u8d77\u59cb\u4f4d\u7f6e\u5b57\u6bb5\uff0c\u53ef\u80fd\u4ecd\u9700\u8981\u4eba\u5de5\u534f\u52a9\u3002\u8fd9\u4e9b\u5b57\u6bb5\u53ef\u901a\u8fc7\u4e0b\u6587\u8ba8\u8bba\u7684\u9009\u9879\u6765\u8bbe\u7f6e\u3002\u5982\u679c\u65e0\u6cd5\u4e3a\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u786e\u5b9a\u6b63\u786e\u503c\uff0c\u4ecd\u7136\u53ef\u4ee5\u4f7f\u7528 <code class=\"option\">-f</code>\uff0c\u4f46\u6062\u590d\u5f97\u5230\u7684\u6570\u636e\u5e93\u5fc5\u987b\u6bd4\u5e73\u65f6\u66f4\u53d7\u6000\u7591\uff1a\u7acb\u5373\u8f6c\u50a8\u5e76\u6062\u590d\u52bf\u5728\u5fc5\u884c\u3002<span class=\"emphasis\"><em>\u5207\u52ff</em></span>\u5728\u5b8c\u6210\u8f6c\u50a8\u4e4b\u524d\u5bf9\u6570\u636e\u5e93\u6267\u884c\u4efb\u4f55\u4fee\u6539\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u56e0\u4e3a\u4efb\u4f55\u6b64\u7c7b\u64cd\u4f5c\u90fd\u5f88\u53ef\u80fd\u4f7f\u635f\u574f\u8fdb\u4e00\u6b65\u6076\u5316\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-f</code><br/></span><span class=\"term\"><code class=\"option\">--force</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u4e0a\u6240\u8ff0\uff0c\u5373\u4f7f <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u786e\u5b9a <code class=\"filename\">pg_control</code> \u7684\u6709\u6548\u6570\u636e\uff0c\u4e5f\u5f3a\u5236\u5176\u7ee7\u7eed\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--dry-run</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"option\">-n</code>/<code class=\"option\">--dry-run</code> \u9009\u9879\u4f1a\u8ba9 <code class=\"command\">pg_resetwal</code> \u6253\u5370\u4ece <code class=\"filename\">pg_control</code> \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u9009\u9879\u4ec5\u5728 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u901a\u8fc7\u8bfb\u53d6 <code class=\"filename\">pg_control</code> \u786e\u5b9a\u9002\u5f53\u503c\u65f6\u624d\u9700\u8981\u4f7f\u7528\u3002\u5b89\u5168\u503c\u53ef\u6309\u4e0b\u8ff0\u65b9\u6cd5\u786e\u5b9a\u3002\u5bf9\u4e8e\u63a5\u53d7\u6570\u5b57\u53c2\u6570\u7684\u9009\u9879\uff0c\u53ef\u4f7f\u7528\u524d\u7f00 <code class=\"literal\">0x</code> \u6307\u5b9a\u5341\u516d\u8fdb\u5236\u503c\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--commit-timestamp-ids=<em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e00\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_commit_ts</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u76f8\u53cd\uff0c\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65b0\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e8c\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u5747\u4e3a\u5341\u516d\u8fdb\u5236\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e <em class=\"replaceable\"><code>xid_epoch</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--epoch=<em class=\"replaceable\"><code>xid_epoch</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002</p>\n<p lang=\"zh\">\u4e8b\u52a1 ID \u7eaa\u5143\u5b9e\u9645\u4e0a\u5e76\u672a\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u4efb\u4f55\u5730\u65b9\uff0c\u9664\u4e86\u7531 <code class=\"command\">pg_resetwal</code> \u8bbe\u7f6e\u7684\u8fd9\u4e2a\u5b57\u6bb5\uff0c\u56e0\u6b64\u5c31\u6570\u636e\u5e93\u672c\u8eab\u800c\u8a00\uff0c\u4efb\u4f55\u503c\u90fd\u53ef\u7528\u3002\u53ef\u80fd\u9700\u8981\u8c03\u6574\u8be5\u503c\uff0c\u4ee5\u786e\u4fdd <span class=\"application\">Slony-I</span> \u548c <span class=\"application\">Skytools</span> \u7b49\u590d\u5236\u7cfb\u7edf\u6b63\u5e38\u5de5\u4f5c \u2014 \u5982\u679c\u786e\u6709\u9700\u8981\uff0c\u5e94\u8be5\u53ef\u4ee5\u4ece\u4e0b\u6e38\u590d\u5236\u6570\u636e\u5e93\u7684\u72b6\u6001\u4e2d\u83b7\u5f97\u5408\u9002\u7684\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>walfile</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-wal-file=<em class=\"replaceable\"><code>walfile</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\u5e94\u5927\u4e8e\u5f53\u524d\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_wal</code> \u76ee\u5f55\u4e2d\u73b0\u5b58\u7684\u4efb\u610f WAL \u6bb5\u6587\u4ef6\u540d\u3002\u8fd9\u4e9b\u540d\u79f0\u540c\u6837\u91c7\u7528\u5341\u516d\u8fdb\u5236\uff0c\u5e76\u7531\u4e09\u4e2a\u90e8\u5206\u7ec4\u6210\u3002\u7b2c\u4e00\u90e8\u5206\u662f<span class=\"quote\">\u201c<span class=\"quote\">\u65f6\u95f4\u7ebf ID</span>\u201d</span>\uff0c\u901a\u5e38\u5e94\u4fdd\u6301\u4e0d\u53d8\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">00000001000000320000004A</code> \u662f <code class=\"filename\">pg_wal</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u5219\u5e94\u4f7f\u7528 <code class=\"literal\">-l 00000001000000320000004B</code> \u6216\u66f4\u5927\u7684\u503c\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u5728\u4f7f\u7528\u975e\u9ed8\u8ba4 WAL \u6bb5\u5927\u5c0f\u65f6\uff0cWAL \u6587\u4ef6\u540d\u4e2d\u7684\u6570\u5b57\u4e0e\u7cfb\u7edf\u51fd\u6570\u548c\u7cfb\u7edf\u89c6\u56fe\u62a5\u544a\u7684 LSN \u4e0d\u540c\u3002\u8be5\u9009\u9879\u63a5\u53d7\u7684\u662f WAL \u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f LSN\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">pg_resetwal \u81ea\u8eab\u4f1a\u68c0\u67e5 pg_wal \u4e2d\u7684\u6587\u4ef6\uff0c\u5e76\u4e3a -l \u9009\u62e9\u4e00\u4e2a\u8d85\u8fc7\u73b0\u6709\u6700\u540e\u4e00\u4e2a\u6587\u4ef6\u540d\u7684\u9ed8\u8ba4\u503c\u3002\u56e0\u6b64\uff0c\u53ea\u6709\u5728\u786e\u5b9a\u5b58\u5728\u5f53\u524d\u4e0d\u5728 pg_wal \u4e2d\u7684 WAL \u6bb5\u6587\u4ef6\uff08\u4f8b\u5982\u79bb\u7ebf\u5f52\u6863\u4e2d\u7684\u6587\u4ef6\uff09\uff0c\u6216 pg_wal \u7684\u5185\u5bb9\u5b8c\u5168\u4e22\u5931\u65f6\uff0c\u624d\u5e94\u8be5\u9700\u8981\u624b\u52a8\u8c03\u6574 -l\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-m <em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-ids=<em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u8981\u786e\u5b9a\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID\uff08\u7b2c\u4e00\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u5728\u6570\u636e\u76ee\u5f55\u4e0b\u7684 pg_multixact/offsets \u76ee\u5f55\u4e2d\u627e\u5230\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5c06\u5176\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 65536\uff080x10000\uff09\u3002\u76f8\u5e94\u5730\uff0c\u8981\u786e\u5b9a\u6700\u65e7\u591a\u4e8b\u52a1 ID\uff08-m \u7684\u7b2c\u4e8c\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u627e\u5230\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 65536\u3002\u6587\u4ef6\u540d\u4f7f\u7528\u5341\u516d\u8fdb\u5236\uff0c\u56e0\u6b64\u6700\u7b80\u5355\u7684\u505a\u6cd5\u662f\u4ee5\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u9009\u9879\u503c\uff0c\u5e76\u5728\u672b\u5c3e\u6dfb\u52a0\u56db\u4e2a\u96f6\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>oid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-oid=<em class=\"replaceable\"><code>oid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002</p>\n<p lang=\"zh\">\u5e76\u6ca1\u6709\u540c\u6837\u7b80\u5355\u7684\u65b9\u6cd5\u6765\u786e\u5b9a\u4e00\u4e2a\u8d85\u51fa\u6570\u636e\u5e93\u4e2d\u6700\u5927 OID \u7684\u4e0b\u4e00\u4e2a OID\uff0c\u4e0d\u8fc7\u5e78\u8fd0\u7684\u662f\uff0c\u4e0b\u4e00\u4e2a OID \u7684\u8bbe\u7f6e\u662f\u5426\u7cbe\u786e\u5e76\u4e0d\u5173\u952e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O <em class=\"replaceable\"><code>mxoff</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-offset=<em class=\"replaceable\"><code>mxoff</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_multixact/members</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 52352 (0xCC80) \u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u8fd9\u91cc\u6ca1\u6709\u50cf\u5176\u4ed6\u9009\u9879\u90a3\u6837\u901a\u8fc7\u8ffd\u52a0\u96f6\u5373\u53ef\u5f97\u5230\u7ed3\u679c\u7684\u7b80\u5355\u65b9\u6cd5\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>wal_segment_size</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u867d\u7136 <code class=\"command\">pg_resetwal</code> \u4f1a\u628a WAL \u8d77\u59cb\u4f4d\u7f6e\u8bbe\u7f6e\u5230\u8d85\u51fa\u73b0\u6709\u6700\u65b0 WAL \u6bb5\u6587\u4ef6\u7684\u4f4d\u7f6e\uff0c\u4f46\u67d0\u4e9b\u6bb5\u5927\u5c0f\u53d8\u66f4\u53ef\u80fd\u5bfc\u81f4\u65e7 WAL \u6587\u4ef6\u540d\u88ab\u91cd\u65b0\u4f7f\u7528\u3002\u5982\u679c WAL \u6587\u4ef6\u540d\u91cd\u53e0\u4f1a\u7ed9\u5f52\u6863\u7b56\u7565\u5e26\u6765\u95ee\u9898\uff0c\u5efa\u8bae\u5c06 <code class=\"option\">-l</code> \u4e0e\u6b64\u9009\u9879\u914d\u5408\u4f7f\u7528\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-u <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--oldest-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0007</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5c0f\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-u 0x700000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0011</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-x 0x1200000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u670d\u52a1\u5668\u8fd0\u884c\u671f\u95f4\u4e0d\u5f97\u4f7f\u7528\u6b64\u547d\u4ee4\u3002\u5982\u679c\u5728\u6570\u636e\u76ee\u5f55\u4e2d\u53d1\u73b0\u670d\u52a1\u5668\u9501\u6587\u4ef6\uff0c<code class=\"command\">pg_resetwal</code> \u5c06\u62d2\u7edd\u542f\u52a8\u3002\u5982\u679c\u670d\u52a1\u5668\u66fe\u5d29\u6e83\uff0c\u53ef\u80fd\u9057\u7559\u9501\u6587\u4ef6\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5220\u9664\u8be5\u9501\u6587\u4ef6\u4ee5\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u8fd0\u884c\u3002\u4f46\u5728\u8fd9\u6837\u505a\u4e4b\u524d\uff0c\u52a1\u5fc5\u518d\u4e09\u786e\u8ba4\u6ca1\u6709\u4efb\u4f55\u670d\u52a1\u5668\u8fdb\u7a0b\u4ecd\u5728\u8fd0\u884c\u3002</p>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4ec5\u9002\u7528\u4e8e\u76f8\u540c\u4e3b\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.8.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/16/app-pgcontroldata.html\" title=\"pg_controldata\"><span class=\"refentrytitle\"><span class=\"application\">pg_controldata</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgresetwal.html", "localization": {"status": "complete", "sources": [{"url": "/docs/16/app-pgresetwal.html", "method": "same-major semantic node", "sha256": "63aadc58a4430b2dd44840317b89db49a94358d56277bc6229a7f880822ea81c", "language": "zh", "matched_nodes": ["#APP-PGRESETWAL/div[2]/p[1]", "#APP-PGRESETWAL/div[3]/h2[0]", "#APP-PGRESETWAL/div[4]/p[1]", "#APP-PGRESETWAL/div[4]/p[2]", "#APP-PGRESETWAL/div[4]/p[3]", "#APP-PGRESETWAL/div[4]/p[4]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[7]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/div[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/div[3]/h3[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[2]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[7]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[1]", "#APP-PGRESETWAL/div[5]/p[2]", "#APP-PGRESETWAL/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[6]/h2[0]", "#APP-PGRESETWAL/div[7]/h2[0]", "#APP-PGRESETWAL/div[7]/p[1]", "#APP-PGRESETWAL/div[7]/p[2]", "#APP-PGRESETWAL/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/16/description/0": "pg_resetwal \u2014 reset the write-ahead log and other control information of a PostgreSQL database cluster", "/versions/16/facts/0/label": "Documented executable", "/versions/16/facts/1/label": "Executable version", "/versions/16/facts/2/label": "Reference inventory", "/versions/16/facts/2/value": "Server applications", "/versions/16/facts/3/label": "Option definition groups", "/versions/16/tables/0/title": "Documented options", "/versions/16/tables/1/title": "Environment variables", "/versions/16/tables/0/rows/0/summary": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above.", "/versions/16/tables/0/rows/1/summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "/versions/16/tables/0/rows/2/summary": "Display version information, then exit.", "/versions/16/tables/0/rows/3/summary": "Show help, then exit.", "/versions/16/tables/0/rows/4/summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "/versions/16/tables/0/rows/5/summary": "Manually set the next transaction ID's epoch.", "/versions/16/tables/0/rows/6/summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "/versions/16/tables/0/rows/7/summary": "Manually set the next and oldest multitransaction ID.", "/versions/16/tables/0/rows/8/summary": "Manually set the next OID.", "/versions/16/tables/0/rows/9/summary": "Manually set the next multitransaction offset.", "/versions/16/tables/0/columns/0/label": "Option and arguments", "/versions/16/tables/0/columns/1/label": "Description", "/versions/16/tables/0/rows/10/summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "/versions/16/tables/0/rows/11/summary": "Manually set the oldest unfrozen transaction ID.", "/versions/16/tables/0/rows/12/summary": "Manually set the next transaction ID.", "/versions/16/tables/1/columns/0/label": "Variable", "/versions/16/tables/1/columns/1/label": "Meaning", "/versions/16/tables/1/rows/0/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "555e63cd816f045010c39b3ff7af4040540f7cdc2d29e634d54863cd6afbcc73"}, "comparison_data": {"options": [{"names": ["-f", "--force"], "signature": "-f --force", "description": "Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above."}, {"names": ["-n", "--dry-run"], "signature": "-n --dry-run", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "signature": "-e xid_epoch --epoch= xid_epoch", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "signature": "-l walfile --next-wal-file= walfile", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "signature": "-o oid --next-oid= oid", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "signature": "-O mxoff --multixact-offset= mxoff", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["--wal-segsize= wal_segment_size"], "signature": "--wal-segsize= wal_segment_size", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "signature": "-u xid --oldest-transaction-id= xid", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "signature": "-x xid --next-transaction-id= xid", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "2e75a1fb3e22e5af38c29ab81b14d4bdbfd53bd0d273146c3a3372d6c8d19a7a", "manual_language": "zh"}, "17": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_resetwal"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "17.11"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "14"}], "tables": [{"key": "options", "rows": [{"summary": "\u6307\u5b9a\u6570\u636e\u5e93\u76ee\u5f55\u7684\u4f4d\u7f6e\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002 pg_resetwal \u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf PGDATA \u3002", "signature": {"url": "/docs/17/app-pgresetwal.html", "text": "datadir -D datadir --pgdata= datadir"}}, {"summary": "\u5373\u4f7f\u5728\u53ef\u80fd\u6709\u5371\u9669\u7684\u60c5\u51b5\u4e0b\uff0c\u4e5f\u5f3a\u5236 pg_resetwal \u7ee7\u7eed\u6267\u884c\uff0c\u5982\u4e0a\u6587\u6240\u8ff0\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5982\u679c\u670d\u52a1\u5668\u672a\u88ab\u5e72\u51c0\u5173\u95ed\uff0c\u6216\u8005 pg_resetwal \u65e0\u6cd5\u4e3a pg_control \u786e\u5b9a\u6709\u6548\u6570\u636e\uff0c\u5219\u5fc5\u987b\u6307\u5b9a\u8be5\u9009\u9879\u3002", "signature": {"url": "/docs/17/app-pgresetwal.html", "text": "-f --force"}}, {"summary": "-n / --dry-run \u9009\u9879\u4f1a\u8ba9 pg_resetwal \u6253\u5370\u4ece pg_control \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 pg_resetwal \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002", "signature": {"url": "/docs/17/app-pgresetwal.html", "text": "-n --dry-run"}}, {"summary": "\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/17/app-pgresetwal.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/17/app-pgresetwal.html", "text": "-? --help"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/17/app-pgresetwal.html", "text": "-c xid , xid --commit-timestamp-ids= xid , xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002", "signature": {"url": "/docs/17/app-pgresetwal.html", "text": "-e xid_epoch --epoch= xid_epoch"}}, {"summary": "\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002", "signature": {"url": "/docs/17/app-pgresetwal.html", "text": "-l walfile --next-wal-file= walfile"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/17/app-pgresetwal.html", "text": "-m mxid , mxid --multixact-ids= mxid , mxid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002", "signature": {"url": "/docs/17/app-pgresetwal.html", "text": "-o oid --next-oid= oid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002", "signature": {"url": "/docs/17/app-pgresetwal.html", "text": "-O mxoff --multixact-offset= mxoff"}}, {"summary": "\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002", "signature": {"url": "/docs/17/app-pgresetwal.html", "text": "--wal-segsize= wal_segment_size"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/17/app-pgresetwal.html", "text": "-u xid --oldest-transaction-id= xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/17/app-pgresetwal.html", "text": "-x xid --next-transaction-id= xid"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-D datadir", "--pgdata= datadir"], "summary": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA .", "signature": "datadir -D datadir --pgdata= datadir", "source_url": "/docs/17/app-pgresetwal.html", "description": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA ."}, {"names": ["-f", "--force"], "summary": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control .", "signature": "-f --force", "source_url": "/docs/17/app-pgresetwal.html", "description": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control ."}, {"names": ["-n", "--dry-run"], "summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "signature": "-n --dry-run", "source_url": "/docs/17/app-pgresetwal.html", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "summary": "Display version information, then exit.", "signature": "-V --version", "source_url": "/docs/17/app-pgresetwal.html", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "summary": "Show help, then exit.", "signature": "-? --help", "source_url": "/docs/17/app-pgresetwal.html", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "source_url": "/docs/17/app-pgresetwal.html", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "summary": "Manually set the next transaction ID's epoch.", "signature": "-e xid_epoch --epoch= xid_epoch", "source_url": "/docs/17/app-pgresetwal.html", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "signature": "-l walfile --next-wal-file= walfile", "source_url": "/docs/17/app-pgresetwal.html", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "summary": "Manually set the next and oldest multitransaction ID.", "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "source_url": "/docs/17/app-pgresetwal.html", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "summary": "Manually set the next OID.", "signature": "-o oid --next-oid= oid", "source_url": "/docs/17/app-pgresetwal.html", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "summary": "Manually set the next multitransaction offset.", "signature": "-O mxoff --multixact-offset= mxoff", "source_url": "/docs/17/app-pgresetwal.html", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["--wal-segsize= wal_segment_size"], "summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "signature": "--wal-segsize= wal_segment_size", "source_url": "/docs/17/app-pgresetwal.html", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. This option can also be used to change the WAL segment size of an existing database cluster, avoiding the need to re- initdb . Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "summary": "Manually set the oldest unfrozen transaction ID.", "signature": "-u xid --oldest-transaction-id= xid", "source_url": "/docs/17/app-pgresetwal.html", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "summary": "Manually set the next transaction ID.", "signature": "-x xid --next-transaction-id= xid", "source_url": "/docs/17/app-pgresetwal.html", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v17.11/postgresql-17.11.tar.bz2", "label": "17.11", "major": "17", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/17/postgresql-17-A4.pdf", "bytes": 15521293, "pages": 3099, "sha256": "1991354df0dc89e70ec39328c28988ef8b19c6a93671dab3893650b63e9f4e36", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/17/postgresql-17-US.pdf", "bytes": 15398150, "pages": 3270, "sha256": "07696c8f38abf31babf22d2db337093936e7c472d2af36d050b000c49bbcf52c", "built_at": "2026-09-26"}}, "tree": "17", "index": "index.html", "major": "17", "pages": 1143, "release": "17.11", "source_url": "https://ftp.postgresql.org/pub/source/v17.11/postgresql-17.11.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979"}, "revision": "58419c9b0dd42cb34c8d53695bb025a7e582edf55ccd4c5bcb1c2c7c71a37487", "evidence_kind": "English manual and source declarations", "source_sha256": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979"}, "sources": [{"url": "https://pg.center/docs/17/app-pgresetwal.html", "file": "app-pgresetwal.html", "label": "17.11 English manual \u00b7 app-pgresetwal.html", "anchor": "", "sha256": "ecae222148704f0d9c3112d3aaa5501bee1d4ae49d0b05113753850abfe08852", "language": "en", "original_url": "/docs/17/app-pgresetwal.html"}, {"url": "https://pg.center/docs/17/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "01f07993ff020684f4c290d17cdafa26fb17ea5c1d476bc3a5efc68bf8ddd9b9", "language": "en", "original_url": "/docs/17/reference-server.html"}], "sections": [], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "signature": "pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir", "description": ["pg_resetwal \u2014 \u91cd\u7f6e PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESETWAL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_resetwal</span></span></h2>\n<p lang=\"zh\">pg_resetwal \u2014 \u91cd\u7f6e <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.9.4.1\"><code class=\"command\">pg_resetwal</code> [ <code class=\"option\">-f</code> | <code class=\"option\">--force</code> ] [ <code class=\"option\">-n</code> | <code class=\"option\">--dry-run</code> ] [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">-D</code> | <code class=\"option\">--pgdata</code> ]<em class=\"replaceable\"><code>datadir</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PGRESETWAL-1\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4f1a\u6e05\u9664\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\uff0c\u5e76\u53ef\u9009\u62e9\u6027\u5730\u91cd\u7f6e\u5b58\u50a8\u5728 <code class=\"filename\">pg_control</code> \u6587\u4ef6\u4e2d\u7684\u67d0\u4e9b\u5176\u4ed6\u63a7\u5236\u4fe1\u606f\u3002\u5982\u679c\u8fd9\u4e9b\u6587\u4ef6\u5df2\u7ecf\u635f\u574f\uff0c\u6709\u65f6\u5c31\u9700\u8981\u4f7f\u7528\u6b64\u529f\u80fd\u3002\u53ea\u6709\u5f53\u670d\u52a1\u5668\u56e0\u8fd9\u7c7b\u635f\u574f\u800c\u65e0\u6cd5\u542f\u52a8\u65f6\uff0c\u624d\u5e94\u5c06\u5176\u4f5c\u4e3a\u6700\u540e\u624b\u6bb5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u9009\u9879\uff0c\u5982 <code class=\"option\">--wal-segsize</code>\uff08\u89c1\u4e0b\u6587\uff09\uff0c\u4e5f\u53ef\u7528\u4e8e\u5728\u4e0d\u91cd\u65b0\u8fd0\u884c <code class=\"command\">initdb</code> \u7684\u60c5\u51b5\u4e0b\u4fee\u6539\u6570\u636e\u5e93\u96c6\u7c07\u7684\u67d0\u4e9b\u5168\u5c40\u8bbe\u7f6e\u3002\u82e5\u4e0d\u4f7f\u7528\u4e0b\u6587\u63d0\u5230\u7684\u5371\u9669\u6a21\u5f0f\uff0c\u5219\u53ef\u5728\u5176\u4ed6\u65b9\u9762\u5b8c\u597d\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e0a\u5b89\u5168\u6267\u884c\u6b64\u64cd\u4f5c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u67d0\u4e2a\u6570\u636e\u76ee\u5f55\u4e0a\u4f7f\u7528 <code class=\"command\">pg_resetwal</code> \u65f6\uff0c\u670d\u52a1\u5668\u5df2\u7ecf\u88ab\u5e72\u51c0\u5173\u95ed\u4e14\u63a7\u5236\u6587\u4ef6\u5b8c\u597d\uff0c\u90a3\u4e48\u9664\u4e86\u4f1a\u6e05\u9664\u4e0d\u518d\u4f7f\u7528\u7684 WAL \u6587\u4ef6\u5916\uff0c\u5b83\u4e0d\u4f1a\u5bf9\u6570\u636e\u5e93\u7cfb\u7edf\u7684\u5185\u5bb9\u4ea7\u751f\u4efb\u4f55\u5f71\u54cd\u3002\u5176\u4ed6\u4efb\u4f55\u7528\u6cd5\u90fd\u53ef\u80fd\u6709\u5371\u9669\uff0c\u5fc5\u987b\u6781\u5176\u8c28\u614e\u3002\u82e5\u8981\u5728\u670d\u52a1\u5668\u672a\u5e72\u51c0\u5173\u95ed\u6216\u63a7\u5236\u6587\u4ef6\u5df2\u635f\u574f\u7684\u6570\u636e\u76ee\u5f55\u4e0a\u6267\u884c\u64cd\u4f5c\uff0c<code class=\"command\">pg_resetwal</code> \u8981\u6c42\u5fc5\u987b\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5728\u5e26\u6709\u635f\u574f WAL \u6216\u635f\u574f\u63a7\u5236\u6587\u4ef6\u7684\u6570\u636e\u76ee\u5f55\u4e0a\u8fd0\u884c\u6b64\u547d\u4ee4\u540e\uff0c\u670d\u52a1\u5668\u5e94\u8be5\u53ef\u4ee5\u542f\u52a8\uff1b\u4f46\u8bf7\u8bb0\u4f4f\uff0c\u7531\u4e8e\u4ec5\u90e8\u5206\u63d0\u4ea4\u7684\u4e8b\u52a1\uff0c\u6570\u636e\u5e93\u4e2d\u53ef\u80fd\u542b\u6709\u4e0d\u4e00\u81f4\u7684\u6570\u636e\u3002\u5e94\u7acb\u5373\u8f6c\u50a8\u6570\u636e\uff0c\u8fd0\u884c <code class=\"command\">initdb</code>\uff0c\u7136\u540e\u6062\u590d\u3002\u6062\u590d\u540e\uff0c\u8bf7\u68c0\u67e5\u662f\u5426\u5b58\u5728\u4e0d\u4e00\u81f4\u5e76\u6309\u9700\u4fee\u590d\u3002</p>\n<p lang=\"zh\">\u5982\u679c <code class=\"command\">pg_resetwal</code> \u62a5\u544a\u65e0\u6cd5\u786e\u5b9a <code class=\"filename\">pg_control</code> \u7684\u6709\u6548\u6570\u636e\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u5f3a\u884c\u7ee7\u7eed\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u7f3a\u5931\u7684\u6570\u636e\u5c06\u4ee5\u770b\u4f3c\u5408\u7406\u7684\u503c\u4ee3\u66ff\u3002\u5927\u591a\u6570\u5b57\u6bb5\u9884\u8ba1\u90fd\u80fd\u5339\u914d\uff0c\u4f46\u5bf9\u4e8e\u4e0b\u4e00\u4e2a OID\u3001\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u53ca\u5176\u7eaa\u5143\u3001\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID \u53ca\u5176\u504f\u79fb\u91cf\uff0c\u4ee5\u53ca WAL \u8d77\u59cb\u4f4d\u7f6e\u5b57\u6bb5\uff0c\u53ef\u80fd\u4ecd\u9700\u8981\u4eba\u5de5\u534f\u52a9\u3002\u8fd9\u4e9b\u5b57\u6bb5\u53ef\u901a\u8fc7\u4e0b\u6587\u8ba8\u8bba\u7684\u9009\u9879\u6765\u8bbe\u7f6e\u3002\u5982\u679c\u65e0\u6cd5\u4e3a\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u786e\u5b9a\u6b63\u786e\u503c\uff0c\u4ecd\u7136\u53ef\u4ee5\u4f7f\u7528 <code class=\"option\">-f</code>\uff0c\u4f46\u6062\u590d\u5f97\u5230\u7684\u6570\u636e\u5e93\u5fc5\u987b\u6bd4\u5e73\u65f6\u66f4\u53d7\u6000\u7591\uff1a\u7acb\u5373\u8f6c\u50a8\u5e76\u6062\u590d\u52bf\u5728\u5fc5\u884c\u3002<span class=\"emphasis\"><em>\u5207\u52ff</em></span>\u5728\u5b8c\u6210\u8f6c\u50a8\u4e4b\u524d\u5bf9\u6570\u636e\u5e93\u6267\u884c\u4efb\u4f55\u4fee\u6539\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u56e0\u4e3a\u4efb\u4f55\u6b64\u7c7b\u64cd\u4f5c\u90fd\u5f88\u53ef\u80fd\u4f7f\u635f\u574f\u8fdb\u4e00\u6b65\u6076\u5316\u3002</p>\n<p lang=\"zh\">\u8be5\u5de5\u5177\u53ea\u80fd\u7531\u5b89\u88c5\u8be5\u670d\u52a1\u5668\u7684\u7528\u6237\u8fd0\u884c\uff0c\u56e0\u4e3a\u5b83\u9700\u8981\u5bf9\u6570\u636e\u76ee\u5f55\u5177\u6709\u8bfb\u5199\u8bbf\u95ee\u6743\u9650\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>datadir</code></em><br/></span><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>datadir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>datadir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u76ee\u5f55\u7684\u4f4d\u7f6e\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002<code class=\"command\">pg_resetwal</code> \u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf <code class=\"envar\">PGDATA</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f</code><br/></span><span class=\"term\"><code class=\"option\">--force</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5373\u4f7f\u5728\u53ef\u80fd\u6709\u5371\u9669\u7684\u60c5\u51b5\u4e0b\uff0c\u4e5f\u5f3a\u5236 <code class=\"command\">pg_resetwal</code> \u7ee7\u7eed\u6267\u884c\uff0c\u5982\u4e0a\u6587\u6240\u8ff0\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5982\u679c\u670d\u52a1\u5668\u672a\u88ab\u5e72\u51c0\u5173\u95ed\uff0c\u6216\u8005 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u4e3a <code class=\"filename\">pg_control</code> \u786e\u5b9a\u6709\u6548\u6570\u636e\uff0c\u5219\u5fc5\u987b\u6307\u5b9a\u8be5\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--dry-run</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"option\">-n</code>/<code class=\"option\">--dry-run</code> \u9009\u9879\u4f1a\u8ba9 <code class=\"command\">pg_resetwal</code> \u6253\u5370\u4ece <code class=\"filename\">pg_control</code> \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u9009\u9879\u4ec5\u5728 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u901a\u8fc7\u8bfb\u53d6 <code class=\"filename\">pg_control</code> \u786e\u5b9a\u9002\u5f53\u503c\u65f6\u624d\u9700\u8981\u4f7f\u7528\u3002\u5b89\u5168\u503c\u53ef\u6309\u4e0b\u8ff0\u65b9\u6cd5\u786e\u5b9a\u3002\u5bf9\u4e8e\u63a5\u53d7\u6570\u5b57\u53c2\u6570\u7684\u9009\u9879\uff0c\u53ef\u4f7f\u7528\u524d\u7f00 <code class=\"literal\">0x</code> \u6307\u5b9a\u5341\u516d\u8fdb\u5236\u503c\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e9b\u8bf4\u660e\u4ec5\u9002\u7528\u4e8e\u6807\u51c6\u5757\u5927\u5c0f\u4e3a 8 kB \u7684\u60c5\u51b5\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--commit-timestamp-ids=<em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e00\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_commit_ts</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u76f8\u53cd\uff0c\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65b0\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e8c\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u5747\u4e3a\u5341\u516d\u8fdb\u5236\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e <em class=\"replaceable\"><code>xid_epoch</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--epoch=<em class=\"replaceable\"><code>xid_epoch</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002</p>\n<p lang=\"zh\">\u4e8b\u52a1 ID \u7eaa\u5143\u5b9e\u9645\u4e0a\u5e76\u672a\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u4efb\u4f55\u5730\u65b9\uff0c\u9664\u4e86\u7531 <code class=\"command\">pg_resetwal</code> \u8bbe\u7f6e\u7684\u8fd9\u4e2a\u5b57\u6bb5\uff0c\u56e0\u6b64\u5c31\u6570\u636e\u5e93\u672c\u8eab\u800c\u8a00\uff0c\u4efb\u4f55\u503c\u90fd\u53ef\u7528\u3002\u53ef\u80fd\u9700\u8981\u8c03\u6574\u8be5\u503c\uff0c\u4ee5\u786e\u4fdd <span class=\"application\">Slony-I</span> \u548c <span class=\"application\">Skytools</span> \u7b49\u590d\u5236\u7cfb\u7edf\u6b63\u5e38\u5de5\u4f5c \u2014 \u5982\u679c\u786e\u6709\u9700\u8981\uff0c\u5e94\u8be5\u53ef\u4ee5\u4ece\u4e0b\u6e38\u590d\u5236\u6570\u636e\u5e93\u7684\u72b6\u6001\u4e2d\u83b7\u5f97\u5408\u9002\u7684\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>walfile</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-wal-file=<em class=\"replaceable\"><code>walfile</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\u5e94\u5927\u4e8e\u5f53\u524d\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_wal</code> \u76ee\u5f55\u4e2d\u73b0\u5b58\u7684\u4efb\u610f WAL \u6bb5\u6587\u4ef6\u540d\u3002\u8fd9\u4e9b\u540d\u79f0\u540c\u6837\u91c7\u7528\u5341\u516d\u8fdb\u5236\uff0c\u5e76\u7531\u4e09\u4e2a\u90e8\u5206\u7ec4\u6210\u3002\u7b2c\u4e00\u90e8\u5206\u662f<span class=\"quote\">\u201c<span class=\"quote\">\u65f6\u95f4\u7ebf ID</span>\u201d</span>\uff0c\u901a\u5e38\u5e94\u4fdd\u6301\u4e0d\u53d8\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">00000001000000320000004A</code> \u662f <code class=\"filename\">pg_wal</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u5219\u5e94\u4f7f\u7528 <code class=\"literal\">-l 00000001000000320000004B</code> \u6216\u66f4\u5927\u7684\u503c\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u5728\u4f7f\u7528\u975e\u9ed8\u8ba4 WAL \u6bb5\u5927\u5c0f\u65f6\uff0cWAL \u6587\u4ef6\u540d\u4e2d\u7684\u6570\u5b57\u4e0e\u7cfb\u7edf\u51fd\u6570\u548c\u7cfb\u7edf\u89c6\u56fe\u62a5\u544a\u7684 LSN \u4e0d\u540c\u3002\u8be5\u9009\u9879\u63a5\u53d7\u7684\u662f WAL \u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f LSN\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">pg_resetwal \u81ea\u8eab\u4f1a\u68c0\u67e5 pg_wal \u4e2d\u7684\u6587\u4ef6\uff0c\u5e76\u4e3a -l \u9009\u62e9\u4e00\u4e2a\u8d85\u8fc7\u73b0\u6709\u6700\u540e\u4e00\u4e2a\u6587\u4ef6\u540d\u7684\u9ed8\u8ba4\u503c\u3002\u56e0\u6b64\uff0c\u53ea\u6709\u5728\u786e\u5b9a\u5b58\u5728\u5f53\u524d\u4e0d\u5728 pg_wal \u4e2d\u7684 WAL \u6bb5\u6587\u4ef6\uff08\u4f8b\u5982\u79bb\u7ebf\u5f52\u6863\u4e2d\u7684\u6587\u4ef6\uff09\uff0c\u6216 pg_wal \u7684\u5185\u5bb9\u5b8c\u5168\u4e22\u5931\u65f6\uff0c\u624d\u5e94\u8be5\u9700\u8981\u624b\u52a8\u8c03\u6574 -l\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-m <em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-ids=<em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u8981\u786e\u5b9a\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID\uff08\u7b2c\u4e00\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u5728\u6570\u636e\u76ee\u5f55\u4e0b\u7684 pg_multixact/offsets \u76ee\u5f55\u4e2d\u627e\u5230\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5c06\u5176\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 65536\uff080x10000\uff09\u3002\u76f8\u5e94\u5730\uff0c\u8981\u786e\u5b9a\u6700\u65e7\u591a\u4e8b\u52a1 ID\uff08-m \u7684\u7b2c\u4e8c\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u627e\u5230\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 65536\u3002\u6587\u4ef6\u540d\u4f7f\u7528\u5341\u516d\u8fdb\u5236\uff0c\u56e0\u6b64\u6700\u7b80\u5355\u7684\u505a\u6cd5\u662f\u4ee5\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u9009\u9879\u503c\uff0c\u5e76\u5728\u672b\u5c3e\u6dfb\u52a0\u56db\u4e2a\u96f6\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>oid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-oid=<em class=\"replaceable\"><code>oid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002</p>\n<p lang=\"zh\">\u5e76\u6ca1\u6709\u540c\u6837\u7b80\u5355\u7684\u65b9\u6cd5\u6765\u786e\u5b9a\u4e00\u4e2a\u8d85\u51fa\u6570\u636e\u5e93\u4e2d\u6700\u5927 OID \u7684\u4e0b\u4e00\u4e2a OID\uff0c\u4e0d\u8fc7\u5e78\u8fd0\u7684\u662f\uff0c\u4e0b\u4e00\u4e2a OID \u7684\u8bbe\u7f6e\u662f\u5426\u7cbe\u786e\u5e76\u4e0d\u5173\u952e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O <em class=\"replaceable\"><code>mxoff</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-offset=<em class=\"replaceable\"><code>mxoff</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_multixact/members</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 52352 (0xCC80) \u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u8fd9\u91cc\u6ca1\u6709\u50cf\u5176\u4ed6\u9009\u9879\u90a3\u6837\u901a\u8fc7\u8ffd\u52a0\u96f6\u5373\u53ef\u5f97\u5230\u7ed3\u679c\u7684\u7b80\u5355\u65b9\u6cd5\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>wal_segment_size</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u8be5\u9009\u9879\u4e5f\u53ef\u7528\u4e8e\u66f4\u6539\u73b0\u6709\u6570\u636e\u5e93\u96c6\u7c07\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u4ece\u800c\u907f\u514d\u91cd\u65b0\u6267\u884c <code class=\"command\">initdb</code>\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u867d\u7136 <code class=\"command\">pg_resetwal</code> \u4f1a\u628a WAL \u8d77\u59cb\u4f4d\u7f6e\u8bbe\u7f6e\u5230\u8d85\u51fa\u73b0\u6709\u6700\u65b0 WAL \u6bb5\u6587\u4ef6\u7684\u4f4d\u7f6e\uff0c\u4f46\u67d0\u4e9b\u6bb5\u5927\u5c0f\u53d8\u66f4\u53ef\u80fd\u5bfc\u81f4\u65e7 WAL \u6587\u4ef6\u540d\u88ab\u91cd\u65b0\u4f7f\u7528\u3002\u5982\u679c WAL \u6587\u4ef6\u540d\u91cd\u53e0\u4f1a\u7ed9\u5f52\u6863\u7b56\u7565\u5e26\u6765\u95ee\u9898\uff0c\u5efa\u8bae\u5c06 <code class=\"option\">-l</code> \u4e0e\u6b64\u9009\u9879\u914d\u5408\u4f7f\u7528\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-u <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--oldest-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0007</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5c0f\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-u 0x700000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0011</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-x 0x1200000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u670d\u52a1\u5668\u8fd0\u884c\u671f\u95f4\u4e0d\u5f97\u4f7f\u7528\u6b64\u547d\u4ee4\u3002\u5982\u679c\u5728\u6570\u636e\u76ee\u5f55\u4e2d\u53d1\u73b0\u670d\u52a1\u5668\u9501\u6587\u4ef6\uff0c<code class=\"command\">pg_resetwal</code> \u5c06\u62d2\u7edd\u542f\u52a8\u3002\u5982\u679c\u670d\u52a1\u5668\u66fe\u5d29\u6e83\uff0c\u53ef\u80fd\u9057\u7559\u9501\u6587\u4ef6\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5220\u9664\u8be5\u9501\u6587\u4ef6\u4ee5\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u8fd0\u884c\u3002\u4f46\u5728\u8fd9\u6837\u505a\u4e4b\u524d\uff0c\u52a1\u5fc5\u518d\u4e09\u786e\u8ba4\u6ca1\u6709\u4efb\u4f55\u670d\u52a1\u5668\u8fdb\u7a0b\u4ecd\u5728\u8fd0\u884c\u3002</p>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4ec5\u9002\u7528\u4e8e\u76f8\u540c\u4e3b\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/17/app-pgcontroldata.html\" title=\"pg_controldata\"><span class=\"refentrytitle\"><span class=\"application\">pg_controldata</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgresetwal.html", "localization": {"status": "complete", "sources": [{"url": "/docs/17/app-pgresetwal.html", "method": "same-major semantic node", "sha256": "9b569f895d4a1d75074d4a17ba12311fb93f989056fbcfb8746818fa6d33edd1", "language": "zh", "matched_nodes": ["#APP-PGRESETWAL/div[2]/p[1]", "#APP-PGRESETWAL/div[3]/h2[0]", "#APP-PGRESETWAL/div[4]/p[1]", "#APP-PGRESETWAL/div[4]/p[2]", "#APP-PGRESETWAL/div[4]/p[3]", "#APP-PGRESETWAL/div[4]/p[4]", "#APP-PGRESETWAL/div[4]/p[5]", "#APP-PGRESETWAL/div[4]/p[6]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[7]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/div[2]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/div[3]/h3[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[2]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[7]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[1]", "#APP-PGRESETWAL/div[5]/p[2]", "#APP-PGRESETWAL/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[6]/h2[0]", "#APP-PGRESETWAL/div[7]/h2[0]", "#APP-PGRESETWAL/div[7]/p[1]", "#APP-PGRESETWAL/div[7]/p[2]", "#APP-PGRESETWAL/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/17/description/0": "pg_resetwal \u2014 reset the write-ahead log and other control information of a PostgreSQL database cluster", "/versions/17/facts/0/label": "Documented executable", "/versions/17/facts/1/label": "Executable version", "/versions/17/facts/2/label": "Reference inventory", "/versions/17/facts/2/value": "Server applications", "/versions/17/facts/3/label": "Option definition groups", "/versions/17/tables/0/title": "Documented options", "/versions/17/tables/1/title": "Environment variables", "/versions/17/tables/0/rows/0/summary": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA .", "/versions/17/tables/0/rows/1/summary": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control .", "/versions/17/tables/0/rows/2/summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "/versions/17/tables/0/rows/3/summary": "Display version information, then exit.", "/versions/17/tables/0/rows/4/summary": "Show help, then exit.", "/versions/17/tables/0/rows/5/summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "/versions/17/tables/0/rows/6/summary": "Manually set the next transaction ID's epoch.", "/versions/17/tables/0/rows/7/summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "/versions/17/tables/0/rows/8/summary": "Manually set the next and oldest multitransaction ID.", "/versions/17/tables/0/rows/9/summary": "Manually set the next OID.", "/versions/17/tables/0/columns/0/label": "Option and arguments", "/versions/17/tables/0/columns/1/label": "Description", "/versions/17/tables/0/rows/10/summary": "Manually set the next multitransaction offset.", "/versions/17/tables/0/rows/11/summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "/versions/17/tables/0/rows/12/summary": "Manually set the oldest unfrozen transaction ID.", "/versions/17/tables/0/rows/13/summary": "Manually set the next transaction ID.", "/versions/17/tables/1/columns/0/label": "Variable", "/versions/17/tables/1/columns/1/label": "Meaning", "/versions/17/tables/1/rows/0/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "ade8632f5b1ef3fae806a8f8778639375cff5d88daa7b81d6f5724f82ab16b70"}, "comparison_data": {"options": [{"names": ["-D datadir", "--pgdata= datadir"], "signature": "datadir -D datadir --pgdata= datadir", "description": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA ."}, {"names": ["-f", "--force"], "signature": "-f --force", "description": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control ."}, {"names": ["-n", "--dry-run"], "signature": "-n --dry-run", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "signature": "-e xid_epoch --epoch= xid_epoch", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "signature": "-l walfile --next-wal-file= walfile", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "signature": "-o oid --next-oid= oid", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "signature": "-O mxoff --multixact-offset= mxoff", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["--wal-segsize= wal_segment_size"], "signature": "--wal-segsize= wal_segment_size", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. This option can also be used to change the WAL segment size of an existing database cluster, avoiding the need to re- initdb . Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "signature": "-u xid --oldest-transaction-id= xid", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "signature": "-x xid --next-transaction-id= xid", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "db2882d3f20232817113d977ba0fd94c565ea8de3141ad923fb451967d367d18", "manual_language": "zh"}, "18": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_resetwal"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "18.6"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "15"}], "tables": [{"key": "options", "rows": [{"summary": "\u6307\u5b9a\u6570\u636e\u5e93\u76ee\u5f55\u7684\u4f4d\u7f6e\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002 pg_resetwal \u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf PGDATA \u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "datadir -D datadir --pgdata= datadir"}}, {"summary": "\u5373\u4f7f\u5728\u53ef\u80fd\u6709\u5371\u9669\u7684\u60c5\u51b5\u4e0b\uff0c\u4e5f\u5f3a\u5236 pg_resetwal \u7ee7\u7eed\u6267\u884c\uff0c\u5982\u4e0a\u6587\u6240\u8ff0\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5982\u679c\u670d\u52a1\u5668\u672a\u88ab\u5e72\u51c0\u5173\u95ed\uff0c\u6216\u8005 pg_resetwal \u65e0\u6cd5\u4e3a pg_control \u786e\u5b9a\u6709\u6548\u6570\u636e\uff0c\u5219\u5fc5\u987b\u6307\u5b9a\u8be5\u9009\u9879\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-f --force"}}, {"summary": "-n / --dry-run \u9009\u9879\u4f1a\u8ba9 pg_resetwal \u6253\u5370\u4ece pg_control \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 pg_resetwal \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-n --dry-run"}}, {"summary": "\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-? --help"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-c xid , xid --commit-timestamp-ids= xid , xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-e xid_epoch --epoch= xid_epoch"}}, {"summary": "\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-l walfile --next-wal-file= walfile"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-m mxid , mxid --multixact-ids= mxid , mxid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-o oid --next-oid= oid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-O mxoff --multixact-offset= mxoff"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-u xid --oldest-transaction-id= xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-x xid --next-transaction-id= xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u9ed8\u8ba4\u7684 char \u6709\u7b26\u53f7\u6027\u3002\u53ef\u9009\u503c\u4e3a signed \u548c unsigned \u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "--char-signedness= option"}}, {"summary": "\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "--wal-segsize= wal_segment_size"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-D datadir", "--pgdata= datadir"], "summary": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA .", "signature": "datadir -D datadir --pgdata= datadir", "source_url": "/docs/18/app-pgresetwal.html", "description": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA ."}, {"names": ["-f", "--force"], "summary": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control .", "signature": "-f --force", "source_url": "/docs/18/app-pgresetwal.html", "description": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control ."}, {"names": ["-n", "--dry-run"], "summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "signature": "-n --dry-run", "source_url": "/docs/18/app-pgresetwal.html", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "summary": "Display version information, then exit.", "signature": "-V --version", "source_url": "/docs/18/app-pgresetwal.html", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "summary": "Show help, then exit.", "signature": "-? --help", "source_url": "/docs/18/app-pgresetwal.html", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "summary": "Manually set the next transaction ID's epoch.", "signature": "-e xid_epoch --epoch= xid_epoch", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "signature": "-l walfile --next-wal-file= walfile", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "summary": "Manually set the next and oldest multitransaction ID.", "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "summary": "Manually set the next OID.", "signature": "-o oid --next-oid= oid", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "summary": "Manually set the next multitransaction offset.", "signature": "-O mxoff --multixact-offset= mxoff", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "summary": "Manually set the oldest unfrozen transaction ID.", "signature": "-u xid --oldest-transaction-id= xid", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "summary": "Manually set the next transaction ID.", "signature": "-x xid --next-transaction-id= xid", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["--char-signedness= option"], "summary": "Manually set the default char signedness. Possible values are signed and unsigned .", "signature": "--char-signedness= option", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the default char signedness. Possible values are signed and unsigned . For a database cluster that pg_upgrade upgraded from a PostgreSQL version before 18, the safe value would be the default char signedness of the platform that ran the cluster before that upgrade. For all other clusters, signed would be the safe value. However, this option is exclusively for use with pg_upgrade and should not normally be used manually."}, {"names": ["--wal-segsize= wal_segment_size"], "summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "signature": "--wal-segsize= wal_segment_size", "source_url": "/docs/18/app-pgresetwal.html", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. This option can also be used to change the WAL segment size of an existing database cluster, avoiding the need to re- initdb . Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "18.6", "major": "18", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/18/postgresql-18-A4.pdf", "bytes": 15865106, "pages": 3154, "sha256": "19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/18/postgresql-18-US.pdf", "bytes": 15748059, "pages": 3328, "sha256": "facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319", "built_at": "2026-09-26"}}, "tree": "18", "index": "index.html", "major": "18", "pages": 1148, "release": "18.6", "source_url": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "revision": "ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8", "evidence_kind": "English manual and source declarations", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "sources": [{"url": "https://pg.center/docs/18/app-pgresetwal.html", "file": "app-pgresetwal.html", "label": "18.6 English manual \u00b7 app-pgresetwal.html", "anchor": "", "sha256": "d98a541b766cc4c6dd1c5b77d2b20c904ad76b7aa169e8e76916fa724097642f", "language": "en", "original_url": "/docs/18/app-pgresetwal.html"}, {"url": "https://pg.center/docs/18/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "e9f8bbcc8e3641fadd1d20991e8aad6b532155b786ba5a1b7b364ec4f1a5bef3", "language": "en", "original_url": "/docs/18/reference-server.html"}], "sections": [], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "signature": "pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir", "description": ["pg_resetwal \u2014 \u91cd\u7f6e PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESETWAL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_resetwal</span></span></h2>\n<p lang=\"zh\">pg_resetwal \u2014 \u91cd\u7f6e <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.9.4.1\"><code class=\"command\">pg_resetwal</code> [ <code class=\"option\">-f</code> | <code class=\"option\">--force</code> ] [ <code class=\"option\">-n</code> | <code class=\"option\">--dry-run</code> ] [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">-D</code> | <code class=\"option\">--pgdata</code> ]<em class=\"replaceable\"><code>datadir</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PGRESETWAL-1\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4f1a\u6e05\u9664\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\uff0c\u5e76\u53ef\u9009\u62e9\u6027\u5730\u91cd\u7f6e\u5b58\u50a8\u5728 <code class=\"filename\">pg_control</code> \u6587\u4ef6\u4e2d\u7684\u67d0\u4e9b\u5176\u4ed6\u63a7\u5236\u4fe1\u606f\u3002\u5982\u679c\u8fd9\u4e9b\u6587\u4ef6\u5df2\u7ecf\u635f\u574f\uff0c\u6709\u65f6\u5c31\u9700\u8981\u4f7f\u7528\u6b64\u529f\u80fd\u3002\u53ea\u6709\u5f53\u670d\u52a1\u5668\u56e0\u8fd9\u7c7b\u635f\u574f\u800c\u65e0\u6cd5\u542f\u52a8\u65f6\uff0c\u624d\u5e94\u5c06\u5176\u4f5c\u4e3a\u6700\u540e\u624b\u6bb5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u9009\u9879\uff0c\u5982 <code class=\"option\">--wal-segsize</code>\uff08\u89c1\u4e0b\u6587\uff09\uff0c\u4e5f\u53ef\u7528\u4e8e\u5728\u4e0d\u91cd\u65b0\u8fd0\u884c <code class=\"command\">initdb</code> \u7684\u60c5\u51b5\u4e0b\u4fee\u6539\u6570\u636e\u5e93\u96c6\u7c07\u7684\u67d0\u4e9b\u5168\u5c40\u8bbe\u7f6e\u3002\u82e5\u4e0d\u4f7f\u7528\u4e0b\u6587\u63d0\u5230\u7684\u5371\u9669\u6a21\u5f0f\uff0c\u5219\u53ef\u5728\u5176\u4ed6\u65b9\u9762\u5b8c\u597d\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e0a\u5b89\u5168\u6267\u884c\u6b64\u64cd\u4f5c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u67d0\u4e2a\u6570\u636e\u76ee\u5f55\u4e0a\u4f7f\u7528 <code class=\"command\">pg_resetwal</code> \u65f6\uff0c\u670d\u52a1\u5668\u5df2\u7ecf\u88ab\u5e72\u51c0\u5173\u95ed\u4e14\u63a7\u5236\u6587\u4ef6\u5b8c\u597d\uff0c\u90a3\u4e48\u9664\u4e86\u4f1a\u6e05\u9664\u4e0d\u518d\u4f7f\u7528\u7684 WAL \u6587\u4ef6\u5916\uff0c\u5b83\u4e0d\u4f1a\u5bf9\u6570\u636e\u5e93\u7cfb\u7edf\u7684\u5185\u5bb9\u4ea7\u751f\u4efb\u4f55\u5f71\u54cd\u3002\u5176\u4ed6\u4efb\u4f55\u7528\u6cd5\u90fd\u53ef\u80fd\u6709\u5371\u9669\uff0c\u5fc5\u987b\u6781\u5176\u8c28\u614e\u3002\u82e5\u8981\u5728\u670d\u52a1\u5668\u672a\u5e72\u51c0\u5173\u95ed\u6216\u63a7\u5236\u6587\u4ef6\u5df2\u635f\u574f\u7684\u6570\u636e\u76ee\u5f55\u4e0a\u6267\u884c\u64cd\u4f5c\uff0c<code class=\"command\">pg_resetwal</code> \u8981\u6c42\u5fc5\u987b\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5728\u5e26\u6709\u635f\u574f WAL \u6216\u635f\u574f\u63a7\u5236\u6587\u4ef6\u7684\u6570\u636e\u76ee\u5f55\u4e0a\u8fd0\u884c\u6b64\u547d\u4ee4\u540e\uff0c\u670d\u52a1\u5668\u5e94\u8be5\u53ef\u4ee5\u542f\u52a8\uff1b\u4f46\u8bf7\u8bb0\u4f4f\uff0c\u7531\u4e8e\u4ec5\u90e8\u5206\u63d0\u4ea4\u7684\u4e8b\u52a1\uff0c\u6570\u636e\u5e93\u4e2d\u53ef\u80fd\u542b\u6709\u4e0d\u4e00\u81f4\u7684\u6570\u636e\u3002\u5e94\u7acb\u5373\u8f6c\u50a8\u6570\u636e\uff0c\u8fd0\u884c <code class=\"command\">initdb</code>\uff0c\u7136\u540e\u6062\u590d\u3002\u6062\u590d\u540e\uff0c\u8bf7\u68c0\u67e5\u662f\u5426\u5b58\u5728\u4e0d\u4e00\u81f4\u5e76\u6309\u9700\u4fee\u590d\u3002</p>\n<p lang=\"zh\">\u5982\u679c <code class=\"command\">pg_resetwal</code> \u62a5\u544a\u65e0\u6cd5\u786e\u5b9a <code class=\"filename\">pg_control</code> \u7684\u6709\u6548\u6570\u636e\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u5f3a\u884c\u7ee7\u7eed\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u7f3a\u5931\u7684\u6570\u636e\u5c06\u4ee5\u770b\u4f3c\u5408\u7406\u7684\u503c\u4ee3\u66ff\u3002\u5927\u591a\u6570\u5b57\u6bb5\u9884\u8ba1\u90fd\u80fd\u5339\u914d\uff0c\u4f46\u5bf9\u4e8e\u4e0b\u4e00\u4e2a OID\u3001\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u53ca\u5176\u7eaa\u5143\u3001\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID \u53ca\u5176\u504f\u79fb\u91cf\uff0c\u4ee5\u53ca WAL \u8d77\u59cb\u4f4d\u7f6e\u5b57\u6bb5\uff0c\u53ef\u80fd\u4ecd\u9700\u8981\u4eba\u5de5\u534f\u52a9\u3002\u8fd9\u4e9b\u5b57\u6bb5\u53ef\u901a\u8fc7\u4e0b\u6587\u8ba8\u8bba\u7684\u9009\u9879\u6765\u8bbe\u7f6e\u3002\u5982\u679c\u65e0\u6cd5\u4e3a\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u786e\u5b9a\u6b63\u786e\u503c\uff0c\u4ecd\u7136\u53ef\u4ee5\u4f7f\u7528 <code class=\"option\">-f</code>\uff0c\u4f46\u6062\u590d\u5f97\u5230\u7684\u6570\u636e\u5e93\u5fc5\u987b\u6bd4\u5e73\u65f6\u66f4\u53d7\u6000\u7591\uff1a\u7acb\u5373\u8f6c\u50a8\u5e76\u6062\u590d\u52bf\u5728\u5fc5\u884c\u3002<span class=\"emphasis\"><em>\u5207\u52ff</em></span>\u5728\u5b8c\u6210\u8f6c\u50a8\u4e4b\u524d\u5bf9\u6570\u636e\u5e93\u6267\u884c\u4efb\u4f55\u4fee\u6539\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u56e0\u4e3a\u4efb\u4f55\u6b64\u7c7b\u64cd\u4f5c\u90fd\u5f88\u53ef\u80fd\u4f7f\u635f\u574f\u8fdb\u4e00\u6b65\u6076\u5316\u3002</p>\n<p lang=\"zh\">\u8be5\u5de5\u5177\u53ea\u80fd\u7531\u5b89\u88c5\u8be5\u670d\u52a1\u5668\u7684\u7528\u6237\u8fd0\u884c\uff0c\u56e0\u4e3a\u5b83\u9700\u8981\u5bf9\u6570\u636e\u76ee\u5f55\u5177\u6709\u8bfb\u5199\u8bbf\u95ee\u6743\u9650\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>datadir</code></em><br/></span><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>datadir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>datadir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u76ee\u5f55\u7684\u4f4d\u7f6e\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002<code class=\"command\">pg_resetwal</code> \u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf <code class=\"envar\">PGDATA</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f</code><br/></span><span class=\"term\"><code class=\"option\">--force</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5373\u4f7f\u5728\u53ef\u80fd\u6709\u5371\u9669\u7684\u60c5\u51b5\u4e0b\uff0c\u4e5f\u5f3a\u5236 <code class=\"command\">pg_resetwal</code> \u7ee7\u7eed\u6267\u884c\uff0c\u5982\u4e0a\u6587\u6240\u8ff0\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5982\u679c\u670d\u52a1\u5668\u672a\u88ab\u5e72\u51c0\u5173\u95ed\uff0c\u6216\u8005 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u4e3a <code class=\"filename\">pg_control</code> \u786e\u5b9a\u6709\u6548\u6570\u636e\uff0c\u5219\u5fc5\u987b\u6307\u5b9a\u8be5\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--dry-run</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"option\">-n</code>/<code class=\"option\">--dry-run</code> \u9009\u9879\u4f1a\u8ba9 <code class=\"command\">pg_resetwal</code> \u6253\u5370\u4ece <code class=\"filename\">pg_control</code> \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u9009\u9879\u4ec5\u5728 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u901a\u8fc7\u8bfb\u53d6 <code class=\"filename\">pg_control</code> \u786e\u5b9a\u9002\u5f53\u503c\u65f6\u624d\u9700\u8981\u4f7f\u7528\u3002\u5b89\u5168\u503c\u53ef\u6309\u4e0b\u8ff0\u65b9\u6cd5\u786e\u5b9a\u3002\u5bf9\u4e8e\u63a5\u53d7\u6570\u5b57\u53c2\u6570\u7684\u9009\u9879\uff0c\u53ef\u4f7f\u7528\u524d\u7f00 <code class=\"literal\">0x</code> \u6307\u5b9a\u5341\u516d\u8fdb\u5236\u503c\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e9b\u8bf4\u660e\u4ec5\u9002\u7528\u4e8e\u6807\u51c6\u5757\u5927\u5c0f\u4e3a 8 kB \u7684\u60c5\u51b5\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--commit-timestamp-ids=<em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e00\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_commit_ts</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u76f8\u53cd\uff0c\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65b0\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e8c\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u5747\u4e3a\u5341\u516d\u8fdb\u5236\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e <em class=\"replaceable\"><code>xid_epoch</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--epoch=<em class=\"replaceable\"><code>xid_epoch</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002</p>\n<p lang=\"zh\">\u4e8b\u52a1 ID \u7eaa\u5143\u5b9e\u9645\u4e0a\u5e76\u672a\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u4efb\u4f55\u5730\u65b9\uff0c\u9664\u4e86\u7531 <code class=\"command\">pg_resetwal</code> \u8bbe\u7f6e\u7684\u8fd9\u4e2a\u5b57\u6bb5\uff0c\u56e0\u6b64\u5c31\u6570\u636e\u5e93\u672c\u8eab\u800c\u8a00\uff0c\u4efb\u4f55\u503c\u90fd\u53ef\u7528\u3002\u53ef\u80fd\u9700\u8981\u8c03\u6574\u8be5\u503c\uff0c\u4ee5\u786e\u4fdd <span class=\"application\">Slony-I</span> \u548c <span class=\"application\">Skytools</span> \u7b49\u590d\u5236\u7cfb\u7edf\u6b63\u5e38\u5de5\u4f5c \u2014 \u5982\u679c\u786e\u6709\u9700\u8981\uff0c\u5e94\u8be5\u53ef\u4ee5\u4ece\u4e0b\u6e38\u590d\u5236\u6570\u636e\u5e93\u7684\u72b6\u6001\u4e2d\u83b7\u5f97\u5408\u9002\u7684\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>walfile</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-wal-file=<em class=\"replaceable\"><code>walfile</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\u5e94\u5927\u4e8e\u5f53\u524d\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_wal</code> \u76ee\u5f55\u4e2d\u73b0\u5b58\u7684\u4efb\u610f WAL \u6bb5\u6587\u4ef6\u540d\u3002\u8fd9\u4e9b\u540d\u79f0\u540c\u6837\u91c7\u7528\u5341\u516d\u8fdb\u5236\uff0c\u5e76\u7531\u4e09\u4e2a\u90e8\u5206\u7ec4\u6210\u3002\u7b2c\u4e00\u90e8\u5206\u662f<span class=\"quote\">\u201c<span class=\"quote\">\u65f6\u95f4\u7ebf ID</span>\u201d</span>\uff0c\u901a\u5e38\u5e94\u4fdd\u6301\u4e0d\u53d8\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">00000001000000320000004A</code> \u662f <code class=\"filename\">pg_wal</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u5219\u5e94\u4f7f\u7528 <code class=\"literal\">-l 00000001000000320000004B</code> \u6216\u66f4\u5927\u7684\u503c\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u5728\u4f7f\u7528\u975e\u9ed8\u8ba4 WAL \u6bb5\u5927\u5c0f\u65f6\uff0cWAL \u6587\u4ef6\u540d\u4e2d\u7684\u6570\u5b57\u4e0e\u7cfb\u7edf\u51fd\u6570\u548c\u7cfb\u7edf\u89c6\u56fe\u62a5\u544a\u7684 LSN \u4e0d\u540c\u3002\u8be5\u9009\u9879\u63a5\u53d7\u7684\u662f WAL \u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f LSN\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">pg_resetwal \u81ea\u8eab\u4f1a\u68c0\u67e5 pg_wal \u4e2d\u7684\u6587\u4ef6\uff0c\u5e76\u4e3a -l \u9009\u62e9\u4e00\u4e2a\u8d85\u8fc7\u73b0\u6709\u6700\u540e\u4e00\u4e2a\u6587\u4ef6\u540d\u7684\u9ed8\u8ba4\u503c\u3002\u56e0\u6b64\uff0c\u53ea\u6709\u5728\u786e\u5b9a\u5b58\u5728\u5f53\u524d\u4e0d\u5728 pg_wal \u4e2d\u7684 WAL \u6bb5\u6587\u4ef6\uff08\u4f8b\u5982\u79bb\u7ebf\u5f52\u6863\u4e2d\u7684\u6587\u4ef6\uff09\uff0c\u6216 pg_wal \u7684\u5185\u5bb9\u5b8c\u5168\u4e22\u5931\u65f6\uff0c\u624d\u5e94\u8be5\u9700\u8981\u624b\u52a8\u8c03\u6574 -l\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-m <em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-ids=<em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u8981\u786e\u5b9a\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID\uff08\u7b2c\u4e00\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u5728\u6570\u636e\u76ee\u5f55\u4e0b\u7684 pg_multixact/offsets \u76ee\u5f55\u4e2d\u627e\u5230\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5c06\u5176\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 65536\uff080x10000\uff09\u3002\u76f8\u5e94\u5730\uff0c\u8981\u786e\u5b9a\u6700\u65e7\u591a\u4e8b\u52a1 ID\uff08-m \u7684\u7b2c\u4e8c\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u627e\u5230\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 65536\u3002\u6587\u4ef6\u540d\u4f7f\u7528\u5341\u516d\u8fdb\u5236\uff0c\u56e0\u6b64\u6700\u7b80\u5355\u7684\u505a\u6cd5\u662f\u4ee5\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u9009\u9879\u503c\uff0c\u5e76\u5728\u672b\u5c3e\u6dfb\u52a0\u56db\u4e2a\u96f6\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>oid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-oid=<em class=\"replaceable\"><code>oid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002</p>\n<p lang=\"zh\">\u5e76\u6ca1\u6709\u540c\u6837\u7b80\u5355\u7684\u65b9\u6cd5\u6765\u786e\u5b9a\u4e00\u4e2a\u8d85\u51fa\u6570\u636e\u5e93\u4e2d\u6700\u5927 OID \u7684\u4e0b\u4e00\u4e2a OID\uff0c\u4e0d\u8fc7\u5e78\u8fd0\u7684\u662f\uff0c\u4e0b\u4e00\u4e2a OID \u7684\u8bbe\u7f6e\u662f\u5426\u7cbe\u786e\u5e76\u4e0d\u5173\u952e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O <em class=\"replaceable\"><code>mxoff</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-offset=<em class=\"replaceable\"><code>mxoff</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_multixact/members</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 52352 (0xCC80) \u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u8fd9\u91cc\u6ca1\u6709\u50cf\u5176\u4ed6\u9009\u9879\u90a3\u6837\u901a\u8fc7\u8ffd\u52a0\u96f6\u5373\u53ef\u5f97\u5230\u7ed3\u679c\u7684\u7b80\u5355\u65b9\u6cd5\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-u <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--oldest-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0007</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5c0f\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-u 0x700000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0011</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-x 0x1200000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--char-signedness=<em class=\"replaceable\"><code>option</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u9ed8\u8ba4\u7684 char \u6709\u7b26\u53f7\u6027\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">signed</code> \u548c <code class=\"literal\">unsigned</code>\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u7531 <code class=\"command\">pg_upgrade</code> \u4ece 18 \u4e4b\u524d\u7684 <span class=\"productname\">PostgreSQL</span> \u7248\u672c\u5347\u7ea7\u800c\u6765\u7684\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5b89\u5168\u503c\u5e94\u4e3a\u5347\u7ea7\u524d\u8fd0\u884c\u8be5\u96c6\u7c07\u7684\u5e73\u53f0\u4e0a\u9ed8\u8ba4\u7684 <code class=\"type\">char</code> \u6709\u7b26\u53f7\u6027\u3002\u5bf9\u4e8e\u6240\u6709\u5176\u4ed6\u96c6\u7c07\uff0c<code class=\"literal\">signed</code> \u5c31\u662f\u5b89\u5168\u503c\u3002\u4e0d\u8fc7\uff0c\u8be5\u9009\u9879\u4e13\u4f9b <code class=\"command\">pg_upgrade</code> \u4f7f\u7528\uff0c\u901a\u5e38\u4e0d\u5e94\u624b\u5de5\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>wal_segment_size</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u8be5\u9009\u9879\u4e5f\u53ef\u7528\u4e8e\u66f4\u6539\u73b0\u6709\u6570\u636e\u5e93\u96c6\u7c07\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u4ece\u800c\u907f\u514d\u91cd\u65b0\u6267\u884c <code class=\"command\">initdb</code>\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u867d\u7136 <code class=\"command\">pg_resetwal</code> \u4f1a\u628a WAL \u8d77\u59cb\u4f4d\u7f6e\u8bbe\u7f6e\u5230\u8d85\u51fa\u73b0\u6709\u6700\u65b0 WAL \u6bb5\u6587\u4ef6\u7684\u4f4d\u7f6e\uff0c\u4f46\u67d0\u4e9b\u6bb5\u5927\u5c0f\u53d8\u66f4\u53ef\u80fd\u5bfc\u81f4\u65e7 WAL \u6587\u4ef6\u540d\u88ab\u91cd\u65b0\u4f7f\u7528\u3002\u5982\u679c WAL \u6587\u4ef6\u540d\u91cd\u53e0\u4f1a\u7ed9\u5f52\u6863\u7b56\u7565\u5e26\u6765\u95ee\u9898\uff0c\u5efa\u8bae\u5c06 <code class=\"option\">-l</code> \u4e0e\u6b64\u9009\u9879\u914d\u5408\u4f7f\u7528\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n</div>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u670d\u52a1\u5668\u8fd0\u884c\u671f\u95f4\u4e0d\u5f97\u4f7f\u7528\u6b64\u547d\u4ee4\u3002\u5982\u679c\u5728\u6570\u636e\u76ee\u5f55\u4e2d\u53d1\u73b0\u670d\u52a1\u5668\u9501\u6587\u4ef6\uff0c<code class=\"command\">pg_resetwal</code> \u5c06\u62d2\u7edd\u542f\u52a8\u3002\u5982\u679c\u670d\u52a1\u5668\u66fe\u5d29\u6e83\uff0c\u53ef\u80fd\u9057\u7559\u9501\u6587\u4ef6\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5220\u9664\u8be5\u9501\u6587\u4ef6\u4ee5\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u8fd0\u884c\u3002\u4f46\u5728\u8fd9\u6837\u505a\u4e4b\u524d\uff0c\u52a1\u5fc5\u518d\u4e09\u786e\u8ba4\u6ca1\u6709\u4efb\u4f55\u670d\u52a1\u5668\u8fdb\u7a0b\u4ecd\u5728\u8fd0\u884c\u3002</p>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4ec5\u9002\u7528\u4e8e\u76f8\u540c\u4e3b\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/18/app-pgcontroldata.html\" title=\"pg_controldata\"><span class=\"refentrytitle\"><span class=\"application\">pg_controldata</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgresetwal.html", "localization": {"status": "complete", "sources": [{"url": "/docs/18/app-pgresetwal.html", "method": "same-major semantic node", "sha256": "80594b2bf329e679e09ab6352be7572062a211f39bcb2a4d8cf486314f82d240", "language": "zh", "matched_nodes": ["#APP-PGRESETWAL/div[2]/p[1]", "#APP-PGRESETWAL/div[3]/h2[0]", "#APP-PGRESETWAL/div[4]/p[1]", "#APP-PGRESETWAL/div[4]/p[2]", "#APP-PGRESETWAL/div[4]/p[3]", "#APP-PGRESETWAL/div[4]/p[4]", "#APP-PGRESETWAL/div[4]/p[5]", "#APP-PGRESETWAL/div[4]/p[6]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[7]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[19]/div[2]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[19]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/div[3]/h3[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[2]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[7]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[1]", "#APP-PGRESETWAL/div[5]/p[2]", "#APP-PGRESETWAL/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[6]/h2[0]", "#APP-PGRESETWAL/div[7]/h2[0]", "#APP-PGRESETWAL/div[7]/p[1]", "#APP-PGRESETWAL/div[7]/p[2]", "#APP-PGRESETWAL/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/18/description/0": "pg_resetwal \u2014 reset the write-ahead log and other control information of a PostgreSQL database cluster", "/versions/18/facts/0/label": "Documented executable", "/versions/18/facts/1/label": "Executable version", "/versions/18/facts/2/label": "Reference inventory", "/versions/18/facts/2/value": "Server applications", "/versions/18/facts/3/label": "Option definition groups", "/versions/18/tables/0/title": "Documented options", "/versions/18/tables/1/title": "Environment variables", "/versions/18/tables/0/rows/0/summary": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA .", "/versions/18/tables/0/rows/1/summary": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control .", "/versions/18/tables/0/rows/2/summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "/versions/18/tables/0/rows/3/summary": "Display version information, then exit.", "/versions/18/tables/0/rows/4/summary": "Show help, then exit.", "/versions/18/tables/0/rows/5/summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "/versions/18/tables/0/rows/6/summary": "Manually set the next transaction ID's epoch.", "/versions/18/tables/0/rows/7/summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "/versions/18/tables/0/rows/8/summary": "Manually set the next and oldest multitransaction ID.", "/versions/18/tables/0/rows/9/summary": "Manually set the next OID.", "/versions/18/tables/0/columns/0/label": "Option and arguments", "/versions/18/tables/0/columns/1/label": "Description", "/versions/18/tables/0/rows/10/summary": "Manually set the next multitransaction offset.", "/versions/18/tables/0/rows/11/summary": "Manually set the oldest unfrozen transaction ID.", "/versions/18/tables/0/rows/12/summary": "Manually set the next transaction ID.", "/versions/18/tables/0/rows/13/summary": "Manually set the default char signedness. Possible values are signed and unsigned .", "/versions/18/tables/0/rows/14/summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "/versions/18/tables/1/columns/0/label": "Variable", "/versions/18/tables/1/columns/1/label": "Meaning", "/versions/18/tables/1/rows/0/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "862d589c18d17b071b7f9795ccd951ea72263dce7afd5d02fc868b7a7d58bbe6"}, "comparison_data": {"options": [{"names": ["-D datadir", "--pgdata= datadir"], "signature": "datadir -D datadir --pgdata= datadir", "description": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA ."}, {"names": ["-f", "--force"], "signature": "-f --force", "description": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control ."}, {"names": ["-n", "--dry-run"], "signature": "-n --dry-run", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "signature": "-e xid_epoch --epoch= xid_epoch", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "signature": "-l walfile --next-wal-file= walfile", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "signature": "-o oid --next-oid= oid", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "signature": "-O mxoff --multixact-offset= mxoff", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "signature": "-u xid --oldest-transaction-id= xid", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "signature": "-x xid --next-transaction-id= xid", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["--char-signedness= option"], "signature": "--char-signedness= option", "description": "Manually set the default char signedness. Possible values are signed and unsigned . For a database cluster that pg_upgrade upgraded from a PostgreSQL version before 18, the safe value would be the default char signedness of the platform that ran the cluster before that upgrade. For all other clusters, signed would be the safe value. However, this option is exclusively for use with pg_upgrade and should not normally be used manually."}, {"names": ["--wal-segsize= wal_segment_size"], "signature": "--wal-segsize= wal_segment_size", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. This option can also be used to change the WAL segment size of an existing database cluster, avoiding the need to re- initdb . Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "0f1118258498f92ca5f53e8e85a37fad632ff9873b0fe2ed804994c4a7ed6ca3", "manual_language": "zh"}, "19": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_resetwal"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "19beta4"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "15"}], "tables": [{"key": "options", "rows": [{"summary": "\u6307\u5b9a\u6570\u636e\u5e93\u76ee\u5f55\u7684\u4f4d\u7f6e\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002 pg_resetwal \u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf PGDATA \u3002", "signature": {"url": "/docs/19/app-pgresetwal.html", "text": "datadir -D datadir --pgdata= datadir"}}, {"summary": "\u5373\u4f7f\u5728\u53ef\u80fd\u6709\u5371\u9669\u7684\u60c5\u51b5\u4e0b\uff0c\u4e5f\u5f3a\u5236 pg_resetwal \u7ee7\u7eed\u6267\u884c\uff0c\u5982\u4e0a\u6587\u6240\u8ff0\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5982\u679c\u670d\u52a1\u5668\u672a\u88ab\u5e72\u51c0\u5173\u95ed\uff0c\u6216\u8005 pg_resetwal \u65e0\u6cd5\u4e3a pg_control \u786e\u5b9a\u6709\u6548\u6570\u636e\uff0c\u5219\u5fc5\u987b\u6307\u5b9a\u8be5\u9009\u9879\u3002", "signature": {"url": "/docs/19/app-pgresetwal.html", "text": "-f --force"}}, {"summary": "-n / --dry-run \u9009\u9879\u4f1a\u8ba9 pg_resetwal \u6253\u5370\u4ece pg_control \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 pg_resetwal \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002", "signature": {"url": "/docs/19/app-pgresetwal.html", "text": "-n --dry-run"}}, {"summary": "\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/19/app-pgresetwal.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/19/app-pgresetwal.html", "text": "-? --help"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/19/app-pgresetwal.html", "text": "-c xid , xid --commit-timestamp-ids= xid , xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002", "signature": {"url": "/docs/19/app-pgresetwal.html", "text": "-e xid_epoch --epoch= xid_epoch"}}, {"summary": "\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002", "signature": {"url": "/docs/19/app-pgresetwal.html", "text": "-l walfile --next-wal-file= walfile"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/19/app-pgresetwal.html", "text": "-m mxid , mxid --multixact-ids= mxid , mxid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002", "signature": {"url": "/docs/19/app-pgresetwal.html", "text": "-o oid --next-oid= oid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002", "signature": {"url": "/docs/19/app-pgresetwal.html", "text": "-O mxoff --multixact-offset= mxoff"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/19/app-pgresetwal.html", "text": "-u xid --oldest-transaction-id= xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/19/app-pgresetwal.html", "text": "-x xid --next-transaction-id= xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u9ed8\u8ba4\u7684 char \u6709\u7b26\u53f7\u6027\u3002\u53ef\u9009\u503c\u4e3a signed \u548c unsigned \u3002", "signature": {"url": "/docs/19/app-pgresetwal.html", "text": "--char-signedness= option"}}, {"summary": "\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002", "signature": {"url": "/docs/19/app-pgresetwal.html", "text": "--wal-segsize= wal_segment_size"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-D datadir", "--pgdata= datadir"], "summary": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA .", "signature": "datadir -D datadir --pgdata= datadir", "source_url": "/docs/19/app-pgresetwal.html", "description": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA ."}, {"names": ["-f", "--force"], "summary": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control .", "signature": "-f --force", "source_url": "/docs/19/app-pgresetwal.html", "description": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control ."}, {"names": ["-n", "--dry-run"], "summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "signature": "-n --dry-run", "source_url": "/docs/19/app-pgresetwal.html", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "summary": "Display version information, then exit.", "signature": "-V --version", "source_url": "/docs/19/app-pgresetwal.html", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "summary": "Show help, then exit.", "signature": "-? --help", "source_url": "/docs/19/app-pgresetwal.html", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "source_url": "/docs/19/app-pgresetwal.html", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "summary": "Manually set the next transaction ID's epoch.", "signature": "-e xid_epoch --epoch= xid_epoch", "source_url": "/docs/19/app-pgresetwal.html", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "signature": "-l walfile --next-wal-file= walfile", "source_url": "/docs/19/app-pgresetwal.html", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "summary": "Manually set the next and oldest multitransaction ID.", "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "source_url": "/docs/19/app-pgresetwal.html", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 32768 (0x8000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 32768 (0x8000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 000F and 0007 are the greatest and smallest entries in pg_multixact/offsets , -m 0x80000,0x38000 will work."}, {"names": ["-o oid", "--next-oid= oid"], "summary": "Manually set the next OID.", "signature": "-o oid --next-oid= oid", "source_url": "/docs/19/app-pgresetwal.html", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "summary": "Manually set the next multitransaction offset.", "signature": "-O mxoff --multixact-offset= mxoff", "source_url": "/docs/19/app-pgresetwal.html", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "summary": "Manually set the oldest unfrozen transaction ID.", "signature": "-u xid --oldest-transaction-id= xid", "source_url": "/docs/19/app-pgresetwal.html", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "summary": "Manually set the next transaction ID.", "signature": "-x xid --next-transaction-id= xid", "source_url": "/docs/19/app-pgresetwal.html", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["--char-signedness= option"], "summary": "Manually set the default char signedness. Possible values are signed and unsigned .", "signature": "--char-signedness= option", "source_url": "/docs/19/app-pgresetwal.html", "description": "Manually set the default char signedness. Possible values are signed and unsigned . For a database cluster that pg_upgrade upgraded from a PostgreSQL version before 18, the safe value would be the default char signedness of the platform that ran the cluster before that upgrade. For all other clusters, signed would be the safe value. However, this option is exclusively for use with pg_upgrade and should not normally be used manually."}, {"names": ["--wal-segsize= wal_segment_size"], "summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "signature": "--wal-segsize= wal_segment_size", "source_url": "/docs/19/app-pgresetwal.html", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. This option can also be used to change the WAL segment size of an existing database cluster, avoiding the need to re- initdb . Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v19beta4/postgresql-19beta4.tar.bz2", "label": "19beta4", "major": "19", "channel": "preview", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/19/postgresql-19-A4.pdf", "bytes": 16064841, "pages": 3052, "sha256": "4dd099e4125c591128fc5f3ebd02178dc24781f9e5ae629f96d67c4c8547427b", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/19/postgresql-19-US.pdf", "bytes": 15974616, "pages": 3225, "sha256": "61971fa857f0956d47341a0388fa6af9ae10acf691d4b2fc009007d384b0342b", "built_at": "2026-09-26"}}, "tree": "19", "index": "index.html", "major": "19", "pages": 1155, "release": "19beta4", "source_url": "https://ftp.postgresql.org/pub/source/v19beta4/postgresql-19beta4.tar.bz2", "svg_assets": 5, "source_mode": "en SGML built with pinned official archive", "source_sha256": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86"}, "revision": "1bbbbf4133d426f0e4304010688d2984c30fb67df0cc3a61b3e37eb3f6f37833", "evidence_kind": "English manual and source declarations", "source_sha256": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86"}, "sources": [{"url": "https://pg.center/docs/19/app-pgresetwal.html", "file": "app-pgresetwal.html", "label": "19beta4 English manual \u00b7 app-pgresetwal.html", "anchor": "", "sha256": "ef961683ce1163fa9c1ecfe89ad6e5349898d754df79e42115e24d31a23e047c", "language": "en", "original_url": "/docs/19/app-pgresetwal.html"}, {"url": "https://pg.center/docs/19/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "425b070323b448b5516d2cb4e9e4ac77efb5d19dd4e8005d0ae1c61db9ec78e6", "language": "en", "original_url": "/docs/19/reference-server.html"}], "sections": [], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "signature": "pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir", "description": ["pg_resetwal \u2014 \u91cd\u7f6e PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESETWAL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_resetwal</span></span></h2>\n<p lang=\"zh\">pg_resetwal \u2014 \u91cd\u7f6e <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.9.4.1\"><code class=\"command\">pg_resetwal</code> [ <code class=\"option\">-f</code> | <code class=\"option\">--force</code> ] [ <code class=\"option\">-n</code> | <code class=\"option\">--dry-run</code> ] [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">-D</code> | <code class=\"option\">--pgdata</code> ] <em class=\"replaceable\"><code>datadir</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PGRESETWAL-1\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4f1a\u6e05\u9664\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\uff0c\u5e76\u53ef\u9009\u62e9\u6027\u5730\u91cd\u7f6e\u5b58\u50a8\u5728 <code class=\"filename\">pg_control</code> \u6587\u4ef6\u4e2d\u7684\u67d0\u4e9b\u5176\u4ed6\u63a7\u5236\u4fe1\u606f\u3002\u5982\u679c\u8fd9\u4e9b\u6587\u4ef6\u5df2\u7ecf\u635f\u574f\uff0c\u6709\u65f6\u5c31\u9700\u8981\u4f7f\u7528\u6b64\u529f\u80fd\u3002\u53ea\u6709\u5f53\u670d\u52a1\u5668\u56e0\u8fd9\u7c7b\u635f\u574f\u800c\u65e0\u6cd5\u542f\u52a8\u65f6\uff0c\u624d\u5e94\u5c06\u5176\u4f5c\u4e3a\u6700\u540e\u624b\u6bb5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u9009\u9879\uff0c\u5982 <code class=\"option\">--wal-segsize</code>\uff08\u89c1\u4e0b\u6587\uff09\uff0c\u4e5f\u53ef\u7528\u4e8e\u5728\u4e0d\u91cd\u65b0\u8fd0\u884c <code class=\"command\">initdb</code> \u7684\u60c5\u51b5\u4e0b\u4fee\u6539\u6570\u636e\u5e93\u96c6\u7c07\u7684\u67d0\u4e9b\u5168\u5c40\u8bbe\u7f6e\u3002\u82e5\u4e0d\u4f7f\u7528\u4e0b\u6587\u63d0\u5230\u7684\u5371\u9669\u6a21\u5f0f\uff0c\u5219\u53ef\u5728\u5176\u4ed6\u65b9\u9762\u5b8c\u597d\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e0a\u5b89\u5168\u6267\u884c\u6b64\u64cd\u4f5c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u67d0\u4e2a\u6570\u636e\u76ee\u5f55\u4e0a\u4f7f\u7528 <code class=\"command\">pg_resetwal</code> \u65f6\uff0c\u670d\u52a1\u5668\u5df2\u7ecf\u88ab\u5e72\u51c0\u5173\u95ed\u4e14\u63a7\u5236\u6587\u4ef6\u5b8c\u597d\uff0c\u90a3\u4e48\u9664\u4e86\u4f1a\u6e05\u9664\u4e0d\u518d\u4f7f\u7528\u7684 WAL \u6587\u4ef6\u5916\uff0c\u5b83\u4e0d\u4f1a\u5bf9\u6570\u636e\u5e93\u7cfb\u7edf\u7684\u5185\u5bb9\u4ea7\u751f\u4efb\u4f55\u5f71\u54cd\u3002\u5176\u4ed6\u4efb\u4f55\u7528\u6cd5\u90fd\u53ef\u80fd\u6709\u5371\u9669\uff0c\u5fc5\u987b\u6781\u5176\u8c28\u614e\u3002\u82e5\u8981\u5728\u670d\u52a1\u5668\u672a\u5e72\u51c0\u5173\u95ed\u6216\u63a7\u5236\u6587\u4ef6\u5df2\u635f\u574f\u7684\u6570\u636e\u76ee\u5f55\u4e0a\u6267\u884c\u64cd\u4f5c\uff0c<code class=\"command\">pg_resetwal</code> \u8981\u6c42\u5fc5\u987b\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5728\u5e26\u6709\u635f\u574f WAL \u6216\u635f\u574f\u63a7\u5236\u6587\u4ef6\u7684\u6570\u636e\u76ee\u5f55\u4e0a\u8fd0\u884c\u6b64\u547d\u4ee4\u540e\uff0c\u670d\u52a1\u5668\u5e94\u8be5\u53ef\u4ee5\u542f\u52a8\uff1b\u4f46\u8bf7\u8bb0\u4f4f\uff0c\u7531\u4e8e\u4ec5\u90e8\u5206\u63d0\u4ea4\u7684\u4e8b\u52a1\uff0c\u6570\u636e\u5e93\u4e2d\u53ef\u80fd\u542b\u6709\u4e0d\u4e00\u81f4\u7684\u6570\u636e\u3002\u5e94\u7acb\u5373\u8f6c\u50a8\u6570\u636e\uff0c\u8fd0\u884c <code class=\"command\">initdb</code>\uff0c\u7136\u540e\u6062\u590d\u3002\u6062\u590d\u540e\uff0c\u8bf7\u68c0\u67e5\u662f\u5426\u5b58\u5728\u4e0d\u4e00\u81f4\u5e76\u6309\u9700\u4fee\u590d\u3002</p>\n<p lang=\"zh\">\u5982\u679c <code class=\"command\">pg_resetwal</code> \u62a5\u544a\u65e0\u6cd5\u786e\u5b9a <code class=\"filename\">pg_control</code> \u7684\u6709\u6548\u6570\u636e\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u5f3a\u884c\u7ee7\u7eed\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u7f3a\u5931\u7684\u6570\u636e\u5c06\u4ee5\u770b\u4f3c\u5408\u7406\u7684\u503c\u4ee3\u66ff\u3002\u5927\u591a\u6570\u5b57\u6bb5\u9884\u8ba1\u90fd\u80fd\u5339\u914d\uff0c\u4f46\u5bf9\u4e8e\u4e0b\u4e00\u4e2a OID\u3001\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u53ca\u5176\u7eaa\u5143\u3001\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID \u53ca\u5176\u504f\u79fb\u91cf\uff0c\u4ee5\u53ca WAL \u8d77\u59cb\u4f4d\u7f6e\u5b57\u6bb5\uff0c\u53ef\u80fd\u4ecd\u9700\u8981\u4eba\u5de5\u534f\u52a9\u3002\u8fd9\u4e9b\u5b57\u6bb5\u53ef\u901a\u8fc7\u4e0b\u6587\u8ba8\u8bba\u7684\u9009\u9879\u6765\u8bbe\u7f6e\u3002\u5982\u679c\u65e0\u6cd5\u4e3a\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u786e\u5b9a\u6b63\u786e\u503c\uff0c\u4ecd\u7136\u53ef\u4ee5\u4f7f\u7528 <code class=\"option\">-f</code>\uff0c\u4f46\u6062\u590d\u5f97\u5230\u7684\u6570\u636e\u5e93\u5fc5\u987b\u6bd4\u5e73\u65f6\u66f4\u53d7\u6000\u7591\uff1a\u7acb\u5373\u8f6c\u50a8\u5e76\u6062\u590d\u52bf\u5728\u5fc5\u884c\u3002<span class=\"emphasis\"><em>\u5207\u52ff</em></span>\u5728\u5b8c\u6210\u8f6c\u50a8\u4e4b\u524d\u5bf9\u6570\u636e\u5e93\u6267\u884c\u4efb\u4f55\u4fee\u6539\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u56e0\u4e3a\u4efb\u4f55\u6b64\u7c7b\u64cd\u4f5c\u90fd\u5f88\u53ef\u80fd\u4f7f\u635f\u574f\u8fdb\u4e00\u6b65\u6076\u5316\u3002</p>\n<p lang=\"zh\">\u8be5\u5de5\u5177\u53ea\u80fd\u7531\u5b89\u88c5\u8be5\u670d\u52a1\u5668\u7684\u7528\u6237\u8fd0\u884c\uff0c\u56e0\u4e3a\u5b83\u9700\u8981\u5bf9\u6570\u636e\u76ee\u5f55\u5177\u6709\u8bfb\u5199\u8bbf\u95ee\u6743\u9650\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>datadir</code></em><br/></span><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>datadir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>datadir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u76ee\u5f55\u7684\u4f4d\u7f6e\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002<code class=\"command\">pg_resetwal</code> \u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf <code class=\"envar\">PGDATA</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f</code><br/></span><span class=\"term\"><code class=\"option\">--force</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5373\u4f7f\u5728\u53ef\u80fd\u6709\u5371\u9669\u7684\u60c5\u51b5\u4e0b\uff0c\u4e5f\u5f3a\u5236 <code class=\"command\">pg_resetwal</code> \u7ee7\u7eed\u6267\u884c\uff0c\u5982\u4e0a\u6587\u6240\u8ff0\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5982\u679c\u670d\u52a1\u5668\u672a\u88ab\u5e72\u51c0\u5173\u95ed\uff0c\u6216\u8005 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u4e3a <code class=\"filename\">pg_control</code> \u786e\u5b9a\u6709\u6548\u6570\u636e\uff0c\u5219\u5fc5\u987b\u6307\u5b9a\u8be5\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--dry-run</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"option\">-n</code>/<code class=\"option\">--dry-run</code> \u9009\u9879\u4f1a\u8ba9 <code class=\"command\">pg_resetwal</code> \u6253\u5370\u4ece <code class=\"filename\">pg_control</code> \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u9009\u9879\u4ec5\u5728 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u901a\u8fc7\u8bfb\u53d6 <code class=\"filename\">pg_control</code> \u786e\u5b9a\u9002\u5f53\u503c\u65f6\u624d\u9700\u8981\u4f7f\u7528\u3002\u5b89\u5168\u503c\u53ef\u6309\u4e0b\u8ff0\u65b9\u6cd5\u786e\u5b9a\u3002\u5bf9\u4e8e\u63a5\u53d7\u6570\u5b57\u53c2\u6570\u7684\u9009\u9879\uff0c\u53ef\u4f7f\u7528\u524d\u7f00 <code class=\"literal\">0x</code> \u6307\u5b9a\u5341\u516d\u8fdb\u5236\u503c\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e9b\u8bf4\u660e\u4ec5\u9002\u7528\u4e8e\u6807\u51c6\u5757\u5927\u5c0f\u4e3a 8 kB \u7684\u60c5\u51b5\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--commit-timestamp-ids=<em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e00\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_commit_ts</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u76f8\u53cd\uff0c\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65b0\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e8c\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u5747\u4e3a\u5341\u516d\u8fdb\u5236\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e <em class=\"replaceable\"><code>xid_epoch</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--epoch=<em class=\"replaceable\"><code>xid_epoch</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002</p>\n<p lang=\"zh\">\u4e8b\u52a1 ID \u7eaa\u5143\u5b9e\u9645\u4e0a\u5e76\u672a\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u4efb\u4f55\u5730\u65b9\uff0c\u9664\u4e86\u7531 <code class=\"command\">pg_resetwal</code> \u8bbe\u7f6e\u7684\u8fd9\u4e2a\u5b57\u6bb5\uff0c\u56e0\u6b64\u5c31\u6570\u636e\u5e93\u672c\u8eab\u800c\u8a00\uff0c\u4efb\u4f55\u503c\u90fd\u53ef\u7528\u3002\u53ef\u80fd\u9700\u8981\u8c03\u6574\u8be5\u503c\uff0c\u4ee5\u786e\u4fdd <span class=\"application\">Slony-I</span> \u548c <span class=\"application\">Skytools</span> \u7b49\u590d\u5236\u7cfb\u7edf\u6b63\u5e38\u5de5\u4f5c \u2014 \u5982\u679c\u786e\u6709\u9700\u8981\uff0c\u5e94\u8be5\u53ef\u4ee5\u4ece\u4e0b\u6e38\u590d\u5236\u6570\u636e\u5e93\u7684\u72b6\u6001\u4e2d\u83b7\u5f97\u5408\u9002\u7684\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>walfile</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-wal-file=<em class=\"replaceable\"><code>walfile</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\u5e94\u5927\u4e8e\u5f53\u524d\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_wal</code> \u76ee\u5f55\u4e2d\u73b0\u5b58\u7684\u4efb\u610f WAL \u6bb5\u6587\u4ef6\u540d\u3002\u8fd9\u4e9b\u540d\u79f0\u540c\u6837\u91c7\u7528\u5341\u516d\u8fdb\u5236\uff0c\u5e76\u7531\u4e09\u4e2a\u90e8\u5206\u7ec4\u6210\u3002\u7b2c\u4e00\u90e8\u5206\u662f<span class=\"quote\">\u201c<span class=\"quote\">\u65f6\u95f4\u7ebf ID</span>\u201d</span>\uff0c\u901a\u5e38\u5e94\u4fdd\u6301\u4e0d\u53d8\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">00000001000000320000004A</code> \u662f <code class=\"filename\">pg_wal</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u5219\u5e94\u4f7f\u7528 <code class=\"literal\">-l 00000001000000320000004B</code> \u6216\u66f4\u5927\u7684\u503c\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u5728\u4f7f\u7528\u975e\u9ed8\u8ba4 WAL \u6bb5\u5927\u5c0f\u65f6\uff0cWAL \u6587\u4ef6\u540d\u4e2d\u7684\u6570\u5b57\u4e0e\u7cfb\u7edf\u51fd\u6570\u548c\u7cfb\u7edf\u89c6\u56fe\u62a5\u544a\u7684 LSN \u4e0d\u540c\u3002\u8be5\u9009\u9879\u63a5\u53d7\u7684\u662f WAL \u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f LSN\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">pg_resetwal \u81ea\u8eab\u4f1a\u68c0\u67e5 pg_wal \u4e2d\u7684\u6587\u4ef6\uff0c\u5e76\u4e3a -l \u9009\u62e9\u4e00\u4e2a\u8d85\u8fc7\u73b0\u6709\u6700\u540e\u4e00\u4e2a\u6587\u4ef6\u540d\u7684\u9ed8\u8ba4\u503c\u3002\u56e0\u6b64\uff0c\u53ea\u6709\u5728\u786e\u5b9a\u5b58\u5728\u5f53\u524d\u4e0d\u5728 pg_wal \u4e2d\u7684 WAL \u6bb5\u6587\u4ef6\uff08\u4f8b\u5982\u79bb\u7ebf\u5f52\u6863\u4e2d\u7684\u6587\u4ef6\uff09\uff0c\u6216 pg_wal \u7684\u5185\u5bb9\u5b8c\u5168\u4e22\u5931\u65f6\uff0c\u624d\u5e94\u8be5\u9700\u8981\u624b\u52a8\u8c03\u6574 -l\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-m <em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-ids=<em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e00\u90e8\u5206\uff09\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_multixact/offsets</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 32768 (0x8000) \u6765\u786e\u5b9a\u3002\u76f8\u53cd\uff0c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08<code class=\"option\">-m</code> \u7684\u7b2c\u4e8c\u90e8\u5206\uff09\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\u5e76\u4e58\u4ee5 32768 (0x8000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u7684\u3002\u901a\u5e38\u6700\u7b80\u5355\u7684\u505a\u6cd5\u4e5f\u662f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u9009\u9879\u503c\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">000F</code> \u548c <code class=\"filename\">0007</code> \u5206\u522b\u662f <code class=\"filename\">pg_multixact/offsets</code> \u4e2d\u6700\u5927\u548c\u6700\u5c0f\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-m 0x80000,0x38000</code> \u5c31\u53ef\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>oid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-oid=<em class=\"replaceable\"><code>oid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002</p>\n<p lang=\"zh\">\u5e76\u6ca1\u6709\u540c\u6837\u7b80\u5355\u7684\u65b9\u6cd5\u6765\u786e\u5b9a\u4e00\u4e2a\u8d85\u51fa\u6570\u636e\u5e93\u4e2d\u6700\u5927 OID \u7684\u4e0b\u4e00\u4e2a OID\uff0c\u4e0d\u8fc7\u5e78\u8fd0\u7684\u662f\uff0c\u4e0b\u4e00\u4e2a OID \u7684\u8bbe\u7f6e\u662f\u5426\u7cbe\u786e\u5e76\u4e0d\u5173\u952e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O <em class=\"replaceable\"><code>mxoff</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-offset=<em class=\"replaceable\"><code>mxoff</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_multixact/members</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 52352 (0xCC80) \u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u8fd9\u91cc\u6ca1\u6709\u50cf\u5176\u4ed6\u9009\u9879\u90a3\u6837\u901a\u8fc7\u8ffd\u52a0\u96f6\u5373\u53ef\u5f97\u5230\u7ed3\u679c\u7684\u7b80\u5355\u65b9\u6cd5\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-u <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--oldest-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0007</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5c0f\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-u 0x700000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0011</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-x 0x1200000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--char-signedness=<em class=\"replaceable\"><code>option</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u9ed8\u8ba4\u7684 char \u6709\u7b26\u53f7\u6027\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">signed</code> \u548c <code class=\"literal\">unsigned</code>\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u7531 <code class=\"command\">pg_upgrade</code> \u4ece 18 \u4e4b\u524d\u7684 <span class=\"productname\">PostgreSQL</span> \u7248\u672c\u5347\u7ea7\u800c\u6765\u7684\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5b89\u5168\u503c\u5e94\u4e3a\u5347\u7ea7\u524d\u8fd0\u884c\u8be5\u96c6\u7c07\u7684\u5e73\u53f0\u4e0a\u9ed8\u8ba4\u7684 <code class=\"type\">char</code> \u6709\u7b26\u53f7\u6027\u3002\u5bf9\u4e8e\u6240\u6709\u5176\u4ed6\u96c6\u7c07\uff0c<code class=\"literal\">signed</code> \u5c31\u662f\u5b89\u5168\u503c\u3002\u4e0d\u8fc7\uff0c\u8be5\u9009\u9879\u4e13\u4f9b <code class=\"command\">pg_upgrade</code> \u4f7f\u7528\uff0c\u901a\u5e38\u4e0d\u5e94\u624b\u5de5\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>wal_segment_size</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u8be5\u9009\u9879\u4e5f\u53ef\u7528\u4e8e\u66f4\u6539\u73b0\u6709\u6570\u636e\u5e93\u96c6\u7c07\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u4ece\u800c\u907f\u514d\u91cd\u65b0\u6267\u884c <code class=\"command\">initdb</code>\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u867d\u7136 <code class=\"command\">pg_resetwal</code> \u4f1a\u628a WAL \u8d77\u59cb\u4f4d\u7f6e\u8bbe\u7f6e\u5230\u8d85\u51fa\u73b0\u6709\u6700\u65b0 WAL \u6bb5\u6587\u4ef6\u7684\u4f4d\u7f6e\uff0c\u4f46\u67d0\u4e9b\u6bb5\u5927\u5c0f\u53d8\u66f4\u53ef\u80fd\u5bfc\u81f4\u65e7 WAL \u6587\u4ef6\u540d\u88ab\u91cd\u65b0\u4f7f\u7528\u3002\u5982\u679c WAL \u6587\u4ef6\u540d\u91cd\u53e0\u4f1a\u7ed9\u5f52\u6863\u7b56\u7565\u5e26\u6765\u95ee\u9898\uff0c\u5efa\u8bae\u5c06 <code class=\"option\">-l</code> \u4e0e\u6b64\u9009\u9879\u914d\u5408\u4f7f\u7528\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n</div>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u670d\u52a1\u5668\u8fd0\u884c\u671f\u95f4\u4e0d\u5f97\u4f7f\u7528\u6b64\u547d\u4ee4\u3002\u5982\u679c\u5728\u6570\u636e\u76ee\u5f55\u4e2d\u53d1\u73b0\u670d\u52a1\u5668\u9501\u6587\u4ef6\uff0c<code class=\"command\">pg_resetwal</code> \u5c06\u62d2\u7edd\u542f\u52a8\u3002\u5982\u679c\u670d\u52a1\u5668\u66fe\u5d29\u6e83\uff0c\u53ef\u80fd\u9057\u7559\u9501\u6587\u4ef6\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5220\u9664\u8be5\u9501\u6587\u4ef6\u4ee5\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u8fd0\u884c\u3002\u4f46\u5728\u8fd9\u6837\u505a\u4e4b\u524d\uff0c\u52a1\u5fc5\u518d\u4e09\u786e\u8ba4\u6ca1\u6709\u4efb\u4f55\u670d\u52a1\u5668\u8fdb\u7a0b\u4ecd\u5728\u8fd0\u884c\u3002</p>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4ec5\u9002\u7528\u4e8e\u76f8\u540c\u4e3b\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/19/app-pgcontroldata.html\" title=\"pg_controldata\"><span class=\"refentrytitle\"><span class=\"application\">pg_controldata</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgresetwal.html", "localization": {"status": "complete", "sources": [{"url": "/docs/19/app-pgresetwal.html", "method": "same-major semantic node", "sha256": "3cbb1f9b8e6f7e89c6f64b1b09a13f33c5435556e84c01892dd88b693d3c0ff1", "language": "zh", "matched_nodes": ["#APP-PGRESETWAL/div[2]/p[1]", "#APP-PGRESETWAL/div[3]/h2[0]", "#APP-PGRESETWAL/div[4]/p[1]", "#APP-PGRESETWAL/div[4]/p[2]", "#APP-PGRESETWAL/div[4]/p[3]", "#APP-PGRESETWAL/div[4]/p[4]", "#APP-PGRESETWAL/div[4]/p[5]", "#APP-PGRESETWAL/div[4]/p[6]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[7]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[19]/div[2]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[19]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/div[3]/h3[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[2]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[7]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[7]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[1]", "#APP-PGRESETWAL/div[5]/p[2]", "#APP-PGRESETWAL/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[6]/h2[0]", "#APP-PGRESETWAL/div[7]/h2[0]", "#APP-PGRESETWAL/div[7]/p[1]", "#APP-PGRESETWAL/div[7]/p[2]", "#APP-PGRESETWAL/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/19/description/0": "pg_resetwal \u2014 reset the write-ahead log and other control information of a PostgreSQL database cluster", "/versions/19/facts/0/label": "Documented executable", "/versions/19/facts/1/label": "Executable version", "/versions/19/facts/2/label": "Reference inventory", "/versions/19/facts/2/value": "Server applications", "/versions/19/facts/3/label": "Option definition groups", "/versions/19/tables/0/title": "Documented options", "/versions/19/tables/1/title": "Environment variables", "/versions/19/tables/0/rows/0/summary": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA .", "/versions/19/tables/0/rows/1/summary": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control .", "/versions/19/tables/0/rows/2/summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "/versions/19/tables/0/rows/3/summary": "Display version information, then exit.", "/versions/19/tables/0/rows/4/summary": "Show help, then exit.", "/versions/19/tables/0/rows/5/summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "/versions/19/tables/0/rows/6/summary": "Manually set the next transaction ID's epoch.", "/versions/19/tables/0/rows/7/summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "/versions/19/tables/0/rows/8/summary": "Manually set the next and oldest multitransaction ID.", "/versions/19/tables/0/rows/9/summary": "Manually set the next OID.", "/versions/19/tables/0/columns/0/label": "Option and arguments", "/versions/19/tables/0/columns/1/label": "Description", "/versions/19/tables/0/rows/10/summary": "Manually set the next multitransaction offset.", "/versions/19/tables/0/rows/11/summary": "Manually set the oldest unfrozen transaction ID.", "/versions/19/tables/0/rows/12/summary": "Manually set the next transaction ID.", "/versions/19/tables/0/rows/13/summary": "Manually set the default char signedness. Possible values are signed and unsigned .", "/versions/19/tables/0/rows/14/summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "/versions/19/tables/1/columns/0/label": "Variable", "/versions/19/tables/1/columns/1/label": "Meaning", "/versions/19/tables/1/rows/0/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "812d42aeec95394474673ae6ce0f3f4680f764ef8c070ed18611a629466ad28c"}, "comparison_data": {"options": [{"names": ["-D datadir", "--pgdata= datadir"], "signature": "datadir -D datadir --pgdata= datadir", "description": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA ."}, {"names": ["-f", "--force"], "signature": "-f --force", "description": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control ."}, {"names": ["-n", "--dry-run"], "signature": "-n --dry-run", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "signature": "-e xid_epoch --epoch= xid_epoch", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "signature": "-l walfile --next-wal-file= walfile", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 32768 (0x8000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 32768 (0x8000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 000F and 0007 are the greatest and smallest entries in pg_multixact/offsets , -m 0x80000,0x38000 will work."}, {"names": ["-o oid", "--next-oid= oid"], "signature": "-o oid --next-oid= oid", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "signature": "-O mxoff --multixact-offset= mxoff", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "signature": "-u xid --oldest-transaction-id= xid", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "signature": "-x xid --next-transaction-id= xid", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["--char-signedness= option"], "signature": "--char-signedness= option", "description": "Manually set the default char signedness. Possible values are signed and unsigned . For a database cluster that pg_upgrade upgraded from a PostgreSQL version before 18, the safe value would be the default char signedness of the platform that ran the cluster before that upgrade. For all other clusters, signed would be the safe value. However, this option is exclusively for use with pg_upgrade and should not normally be used manually."}, {"names": ["--wal-segsize= wal_segment_size"], "signature": "--wal-segsize= wal_segment_size", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. This option can also be used to change the WAL segment size of an existing database cluster, avoiding the need to re- initdb . Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "34fd5dc3fb5ebf7b538a75ff93a05c017170002906782b9bd1f4f77eacc93725", "manual_language": "zh"}, "20": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_resetwal"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "20devel"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "15"}], "tables": [{"key": "options", "rows": [{"summary": "\u6307\u5b9a\u6570\u636e\u5e93\u76ee\u5f55\u7684\u4f4d\u7f6e\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002 pg_resetwal \u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf PGDATA \u3002", "signature": {"url": "/docs/devel/app-pgresetwal.html", "text": "datadir -D datadir --pgdata= datadir"}}, {"summary": "\u5373\u4f7f\u5728\u53ef\u80fd\u6709\u5371\u9669\u7684\u60c5\u51b5\u4e0b\uff0c\u4e5f\u5f3a\u5236 pg_resetwal \u7ee7\u7eed\u6267\u884c\uff0c\u5982\u4e0a\u6587\u6240\u8ff0\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5982\u679c\u670d\u52a1\u5668\u672a\u88ab\u5e72\u51c0\u5173\u95ed\uff0c\u6216\u8005 pg_resetwal \u65e0\u6cd5\u4e3a pg_control \u786e\u5b9a\u6709\u6548\u6570\u636e\uff0c\u5219\u5fc5\u987b\u6307\u5b9a\u8be5\u9009\u9879\u3002", "signature": {"url": "/docs/devel/app-pgresetwal.html", "text": "-f --force"}}, {"summary": "-n / --dry-run \u9009\u9879\u4f1a\u8ba9 pg_resetwal \u6253\u5370\u4ece pg_control \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 pg_resetwal \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002", "signature": {"url": "/docs/devel/app-pgresetwal.html", "text": "-n --dry-run"}}, {"summary": "\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/devel/app-pgresetwal.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/devel/app-pgresetwal.html", "text": "-? --help"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/devel/app-pgresetwal.html", "text": "-c xid , xid --commit-timestamp-ids= xid , xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002", "signature": {"url": "/docs/devel/app-pgresetwal.html", "text": "-e xid_epoch --epoch= xid_epoch"}}, {"summary": "\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002", "signature": {"url": "/docs/devel/app-pgresetwal.html", "text": "-l walfile --next-wal-file= walfile"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/devel/app-pgresetwal.html", "text": "-m mxid , mxid --multixact-ids= mxid , mxid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\uff088 \u5b57\u8282\uff09\u3002", "signature": {"url": "/docs/devel/app-pgresetwal.html", "text": "-o oid8 --next-oid= oid8"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002", "signature": {"url": "/docs/devel/app-pgresetwal.html", "text": "-O mxoff --multixact-offset= mxoff"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/devel/app-pgresetwal.html", "text": "-u xid --oldest-transaction-id= xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/devel/app-pgresetwal.html", "text": "-x xid --next-transaction-id= xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u9ed8\u8ba4\u7684 char \u6709\u7b26\u53f7\u6027\u3002\u53ef\u9009\u503c\u4e3a signed \u548c unsigned \u3002", "signature": {"url": "/docs/devel/app-pgresetwal.html", "text": "--char-signedness= option"}}, {"summary": "\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002", "signature": {"url": "/docs/devel/app-pgresetwal.html", "text": "--wal-segsize= wal_segment_size"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-D datadir", "--pgdata= datadir"], "summary": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA .", "signature": "datadir -D datadir --pgdata= datadir", "source_url": "/docs/devel/app-pgresetwal.html", "description": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA ."}, {"names": ["-f", "--force"], "summary": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control .", "signature": "-f --force", "source_url": "/docs/devel/app-pgresetwal.html", "description": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control ."}, {"names": ["-n", "--dry-run"], "summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "signature": "-n --dry-run", "source_url": "/docs/devel/app-pgresetwal.html", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "summary": "Display version information, then exit.", "signature": "-V --version", "source_url": "/docs/devel/app-pgresetwal.html", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "summary": "Show help, then exit.", "signature": "-? --help", "source_url": "/docs/devel/app-pgresetwal.html", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "source_url": "/docs/devel/app-pgresetwal.html", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "summary": "Manually set the next transaction ID's epoch.", "signature": "-e xid_epoch --epoch= xid_epoch", "source_url": "/docs/devel/app-pgresetwal.html", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "signature": "-l walfile --next-wal-file= walfile", "source_url": "/docs/devel/app-pgresetwal.html", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "summary": "Manually set the next and oldest multitransaction ID.", "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "source_url": "/docs/devel/app-pgresetwal.html", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 32768 (0x8000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 32768 (0x8000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 000F and 0007 are the greatest and smallest entries in pg_multixact/offsets , -m 0x80000,0x38000 will work."}, {"names": ["-o oid8", "--next-oid= oid8"], "summary": "Manually set the next OID (8 bytes).", "signature": "-o oid8 --next-oid= oid8", "source_url": "/docs/devel/app-pgresetwal.html", "description": "Manually set the next OID (8 bytes). There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right, as long as the counter is not moved backwards. The counter is 8 bytes wide and never wraps around during the life of a cluster."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "summary": "Manually set the next multitransaction offset.", "signature": "-O mxoff --multixact-offset= mxoff", "source_url": "/docs/devel/app-pgresetwal.html", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "summary": "Manually set the oldest unfrozen transaction ID.", "signature": "-u xid --oldest-transaction-id= xid", "source_url": "/docs/devel/app-pgresetwal.html", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "summary": "Manually set the next transaction ID.", "signature": "-x xid --next-transaction-id= xid", "source_url": "/docs/devel/app-pgresetwal.html", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["--char-signedness= option"], "summary": "Manually set the default char signedness. Possible values are signed and unsigned .", "signature": "--char-signedness= option", "source_url": "/docs/devel/app-pgresetwal.html", "description": "Manually set the default char signedness. Possible values are signed and unsigned . For a database cluster that pg_upgrade upgraded from a PostgreSQL version before 18, the safe value would be the default char signedness of the platform that ran the cluster before that upgrade. For all other clusters, signed would be the safe value. However, this option is exclusively for use with pg_upgrade and should not normally be used manually."}, {"names": ["--wal-segsize= wal_segment_size"], "summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "signature": "--wal-segsize= wal_segment_size", "source_url": "/docs/devel/app-pgresetwal.html", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. This option can also be used to change the WAL segment size of an existing database cluster, avoiding the need to re- initdb . Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2", "label": "20devel", "major": "20", "channel": "devel", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/20/postgresql-20-A4.pdf", "bytes": 16030631, "pages": 3052, "sha256": "bd5d82c0ce38fc18f92a0447818a91a193a261776bca1c37564bf9a683e177d0", "built_at": "2026-09-28"}, "US": {"url": "/files/documentation/pdf/20/postgresql-20-US.pdf", "bytes": 15936613, "pages": 3223, "sha256": "d97d9e0db479a02f4234b175f50fcad70c3661619afc8d6df9b9437882e3c299", "built_at": "2026-09-28"}}, "tree": "0", "index": "index.html", "major": "20", "pages": 1156, "release": "20devel", "source_url": "https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2", "svg_assets": 6, "source_mode": "en SGML built with pinned official archive", "source_sha256": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41", "source_snapshot_utc": "26-Sep-2026 20:22"}, "revision": "2eba5e0fd4c3bffb2803247b6cd537878e9d6ee5a6dfbe3c50ece8b421b80918", "evidence_kind": "English manual and source declarations", "source_sha256": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41"}, "sources": [{"url": "https://pg.center/docs/devel/app-pgresetwal.html", "file": "app-pgresetwal.html", "label": "20devel English manual \u00b7 app-pgresetwal.html", "anchor": "", "sha256": "b32553130424b1cf768feaf4b5eece90c7c5b12ce5f20a5b10a34dd7b2170a2d", "language": "en", "original_url": "/docs/devel/app-pgresetwal.html"}, {"url": "https://pg.center/docs/devel/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "5532c1ebfb8c6f310301be63a28daf0ae212e2a78025bea61a1bdca99e02c43d", "language": "en", "original_url": "/docs/devel/reference-server.html"}], "sections": [], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "signature": "pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir", "description": ["pg_resetwal \u2014 \u91cd\u7f6e PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESETWAL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_resetwal</span></span></h2>\n<p lang=\"zh\">pg_resetwal \u2014 \u91cd\u7f6e <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.9.4.1\"><code class=\"command\">pg_resetwal</code> [ <code class=\"option\">-f</code> | <code class=\"option\">--force</code> ] [ <code class=\"option\">-n</code> | <code class=\"option\">--dry-run</code> ] [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">-D</code> | <code class=\"option\">--pgdata</code> ] <em class=\"replaceable\"><code>datadir</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PGRESETWAL-1\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4f1a\u6e05\u9664\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\uff0c\u5e76\u53ef\u9009\u62e9\u6027\u5730\u91cd\u7f6e\u5b58\u50a8\u5728 <code class=\"filename\">pg_control</code> \u6587\u4ef6\u4e2d\u7684\u67d0\u4e9b\u5176\u4ed6\u63a7\u5236\u4fe1\u606f\u3002\u5982\u679c\u8fd9\u4e9b\u6587\u4ef6\u5df2\u7ecf\u635f\u574f\uff0c\u6709\u65f6\u5c31\u9700\u8981\u4f7f\u7528\u6b64\u529f\u80fd\u3002\u53ea\u6709\u5f53\u670d\u52a1\u5668\u56e0\u8fd9\u7c7b\u635f\u574f\u800c\u65e0\u6cd5\u542f\u52a8\u65f6\uff0c\u624d\u5e94\u5c06\u5176\u4f5c\u4e3a\u6700\u540e\u624b\u6bb5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u9009\u9879\uff0c\u5982 <code class=\"option\">--wal-segsize</code>\uff08\u89c1\u4e0b\u6587\uff09\uff0c\u4e5f\u53ef\u7528\u4e8e\u5728\u4e0d\u91cd\u65b0\u8fd0\u884c <code class=\"command\">initdb</code> \u7684\u60c5\u51b5\u4e0b\u4fee\u6539\u6570\u636e\u5e93\u96c6\u7c07\u7684\u67d0\u4e9b\u5168\u5c40\u8bbe\u7f6e\u3002\u82e5\u4e0d\u4f7f\u7528\u4e0b\u6587\u63d0\u5230\u7684\u5371\u9669\u6a21\u5f0f\uff0c\u5219\u53ef\u5728\u5176\u4ed6\u65b9\u9762\u5b8c\u597d\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e0a\u5b89\u5168\u6267\u884c\u6b64\u64cd\u4f5c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u67d0\u4e2a\u6570\u636e\u76ee\u5f55\u4e0a\u4f7f\u7528 <code class=\"command\">pg_resetwal</code> \u65f6\uff0c\u670d\u52a1\u5668\u5df2\u7ecf\u88ab\u5e72\u51c0\u5173\u95ed\u4e14\u63a7\u5236\u6587\u4ef6\u5b8c\u597d\uff0c\u90a3\u4e48\u9664\u4e86\u4f1a\u6e05\u9664\u4e0d\u518d\u4f7f\u7528\u7684 WAL \u6587\u4ef6\u5916\uff0c\u5b83\u4e0d\u4f1a\u5bf9\u6570\u636e\u5e93\u7cfb\u7edf\u7684\u5185\u5bb9\u4ea7\u751f\u4efb\u4f55\u5f71\u54cd\u3002\u5176\u4ed6\u4efb\u4f55\u7528\u6cd5\u90fd\u53ef\u80fd\u6709\u5371\u9669\uff0c\u5fc5\u987b\u6781\u5176\u8c28\u614e\u3002\u82e5\u8981\u5728\u670d\u52a1\u5668\u672a\u5e72\u51c0\u5173\u95ed\u6216\u63a7\u5236\u6587\u4ef6\u5df2\u635f\u574f\u7684\u6570\u636e\u76ee\u5f55\u4e0a\u6267\u884c\u64cd\u4f5c\uff0c<code class=\"command\">pg_resetwal</code> \u8981\u6c42\u5fc5\u987b\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5728\u5e26\u6709\u635f\u574f WAL \u6216\u635f\u574f\u63a7\u5236\u6587\u4ef6\u7684\u6570\u636e\u76ee\u5f55\u4e0a\u8fd0\u884c\u6b64\u547d\u4ee4\u540e\uff0c\u670d\u52a1\u5668\u5e94\u8be5\u53ef\u4ee5\u542f\u52a8\uff1b\u4f46\u8bf7\u8bb0\u4f4f\uff0c\u7531\u4e8e\u4ec5\u90e8\u5206\u63d0\u4ea4\u7684\u4e8b\u52a1\uff0c\u6570\u636e\u5e93\u4e2d\u53ef\u80fd\u542b\u6709\u4e0d\u4e00\u81f4\u7684\u6570\u636e\u3002\u5e94\u7acb\u5373\u8f6c\u50a8\u6570\u636e\uff0c\u8fd0\u884c <code class=\"command\">initdb</code>\uff0c\u7136\u540e\u6062\u590d\u3002\u6062\u590d\u540e\uff0c\u8bf7\u68c0\u67e5\u662f\u5426\u5b58\u5728\u4e0d\u4e00\u81f4\u5e76\u6309\u9700\u4fee\u590d\u3002</p>\n<p lang=\"zh\">\u5982\u679c <code class=\"command\">pg_resetwal</code> \u62a5\u544a\u65e0\u6cd5\u786e\u5b9a <code class=\"filename\">pg_control</code> \u7684\u6709\u6548\u6570\u636e\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u5f3a\u884c\u7ee7\u7eed\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u7f3a\u5931\u7684\u6570\u636e\u5c06\u4ee5\u770b\u4f3c\u5408\u7406\u7684\u503c\u4ee3\u66ff\u3002\u5927\u591a\u6570\u5b57\u6bb5\u9884\u8ba1\u90fd\u80fd\u5339\u914d\uff0c\u4f46\u5bf9\u4e8e\u4e0b\u4e00\u4e2a OID\u3001\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u53ca\u5176\u7eaa\u5143\u3001\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID \u53ca\u5176\u504f\u79fb\u91cf\uff0c\u4ee5\u53ca WAL \u8d77\u59cb\u4f4d\u7f6e\u5b57\u6bb5\uff0c\u53ef\u80fd\u4ecd\u9700\u8981\u4eba\u5de5\u534f\u52a9\u3002\u8fd9\u4e9b\u5b57\u6bb5\u53ef\u901a\u8fc7\u4e0b\u6587\u8ba8\u8bba\u7684\u9009\u9879\u6765\u8bbe\u7f6e\u3002\u5982\u679c\u65e0\u6cd5\u4e3a\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u786e\u5b9a\u6b63\u786e\u503c\uff0c\u4ecd\u7136\u53ef\u4ee5\u4f7f\u7528 <code class=\"option\">-f</code>\uff0c\u4f46\u6062\u590d\u5f97\u5230\u7684\u6570\u636e\u5e93\u5fc5\u987b\u6bd4\u5e73\u65f6\u66f4\u53d7\u6000\u7591\uff1a\u7acb\u5373\u8f6c\u50a8\u5e76\u6062\u590d\u52bf\u5728\u5fc5\u884c\u3002<span class=\"emphasis\"><em>\u5207\u52ff</em></span>\u5728\u5b8c\u6210\u8f6c\u50a8\u4e4b\u524d\u5bf9\u6570\u636e\u5e93\u6267\u884c\u4efb\u4f55\u4fee\u6539\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u56e0\u4e3a\u4efb\u4f55\u6b64\u7c7b\u64cd\u4f5c\u90fd\u5f88\u53ef\u80fd\u4f7f\u635f\u574f\u8fdb\u4e00\u6b65\u6076\u5316\u3002</p>\n<p lang=\"zh\">\u8be5\u5de5\u5177\u53ea\u80fd\u7531\u5b89\u88c5\u8be5\u670d\u52a1\u5668\u7684\u7528\u6237\u8fd0\u884c\uff0c\u56e0\u4e3a\u5b83\u9700\u8981\u5bf9\u6570\u636e\u76ee\u5f55\u5177\u6709\u8bfb\u5199\u8bbf\u95ee\u6743\u9650\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>datadir</code></em><br/></span><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>datadir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>datadir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u76ee\u5f55\u7684\u4f4d\u7f6e\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002<code class=\"command\">pg_resetwal</code> \u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf <code class=\"envar\">PGDATA</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f</code><br/></span><span class=\"term\"><code class=\"option\">--force</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5373\u4f7f\u5728\u53ef\u80fd\u6709\u5371\u9669\u7684\u60c5\u51b5\u4e0b\uff0c\u4e5f\u5f3a\u5236 <code class=\"command\">pg_resetwal</code> \u7ee7\u7eed\u6267\u884c\uff0c\u5982\u4e0a\u6587\u6240\u8ff0\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5982\u679c\u670d\u52a1\u5668\u672a\u88ab\u5e72\u51c0\u5173\u95ed\uff0c\u6216\u8005 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u4e3a <code class=\"filename\">pg_control</code> \u786e\u5b9a\u6709\u6548\u6570\u636e\uff0c\u5219\u5fc5\u987b\u6307\u5b9a\u8be5\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--dry-run</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"option\">-n</code>/<code class=\"option\">--dry-run</code> \u9009\u9879\u4f1a\u8ba9 <code class=\"command\">pg_resetwal</code> \u6253\u5370\u4ece <code class=\"filename\">pg_control</code> \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u9009\u9879\u4ec5\u5728 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u901a\u8fc7\u8bfb\u53d6 <code class=\"filename\">pg_control</code> \u786e\u5b9a\u9002\u5f53\u503c\u65f6\u624d\u9700\u8981\u4f7f\u7528\u3002\u5b89\u5168\u503c\u53ef\u6309\u4e0b\u8ff0\u65b9\u6cd5\u786e\u5b9a\u3002\u5bf9\u4e8e\u63a5\u53d7\u6570\u5b57\u53c2\u6570\u7684\u9009\u9879\uff0c\u53ef\u4f7f\u7528\u524d\u7f00 <code class=\"literal\">0x</code> \u6307\u5b9a\u5341\u516d\u8fdb\u5236\u503c\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e9b\u8bf4\u660e\u4ec5\u9002\u7528\u4e8e\u6807\u51c6\u5757\u5927\u5c0f\u4e3a 8 kB \u7684\u60c5\u51b5\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--commit-timestamp-ids=<em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e00\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_commit_ts</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u76f8\u53cd\uff0c\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65b0\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e8c\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u5747\u4e3a\u5341\u516d\u8fdb\u5236\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e <em class=\"replaceable\"><code>xid_epoch</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--epoch=<em class=\"replaceable\"><code>xid_epoch</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002</p>\n<p lang=\"zh\">\u4e8b\u52a1 ID \u7eaa\u5143\u5b9e\u9645\u4e0a\u5e76\u672a\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u4efb\u4f55\u5730\u65b9\uff0c\u9664\u4e86\u7531 <code class=\"command\">pg_resetwal</code> \u8bbe\u7f6e\u7684\u8fd9\u4e2a\u5b57\u6bb5\uff0c\u56e0\u6b64\u5c31\u6570\u636e\u5e93\u672c\u8eab\u800c\u8a00\uff0c\u4efb\u4f55\u503c\u90fd\u53ef\u7528\u3002\u53ef\u80fd\u9700\u8981\u8c03\u6574\u8be5\u503c\uff0c\u4ee5\u786e\u4fdd <span class=\"application\">Slony-I</span> \u548c <span class=\"application\">Skytools</span> \u7b49\u590d\u5236\u7cfb\u7edf\u6b63\u5e38\u5de5\u4f5c \u2014 \u5982\u679c\u786e\u6709\u9700\u8981\uff0c\u5e94\u8be5\u53ef\u4ee5\u4ece\u4e0b\u6e38\u590d\u5236\u6570\u636e\u5e93\u7684\u72b6\u6001\u4e2d\u83b7\u5f97\u5408\u9002\u7684\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>walfile</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-wal-file=<em class=\"replaceable\"><code>walfile</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\u5e94\u5927\u4e8e\u5f53\u524d\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_wal</code> \u76ee\u5f55\u4e2d\u73b0\u5b58\u7684\u4efb\u610f WAL \u6bb5\u6587\u4ef6\u540d\u3002\u8fd9\u4e9b\u540d\u79f0\u540c\u6837\u91c7\u7528\u5341\u516d\u8fdb\u5236\uff0c\u5e76\u7531\u4e09\u4e2a\u90e8\u5206\u7ec4\u6210\u3002\u7b2c\u4e00\u90e8\u5206\u662f<span class=\"quote\">\u201c<span class=\"quote\">\u65f6\u95f4\u7ebf ID</span>\u201d</span>\uff0c\u901a\u5e38\u5e94\u4fdd\u6301\u4e0d\u53d8\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">00000001000000320000004A</code> \u662f <code class=\"filename\">pg_wal</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u5219\u5e94\u4f7f\u7528 <code class=\"literal\">-l 00000001000000320000004B</code> \u6216\u66f4\u5927\u7684\u503c\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u5728\u4f7f\u7528\u975e\u9ed8\u8ba4 WAL \u6bb5\u5927\u5c0f\u65f6\uff0cWAL \u6587\u4ef6\u540d\u4e2d\u7684\u6570\u5b57\u4e0e\u7cfb\u7edf\u51fd\u6570\u548c\u7cfb\u7edf\u89c6\u56fe\u62a5\u544a\u7684 LSN \u4e0d\u540c\u3002\u8be5\u9009\u9879\u63a5\u53d7\u7684\u662f WAL \u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f LSN\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">pg_resetwal \u81ea\u8eab\u4f1a\u68c0\u67e5 pg_wal \u4e2d\u7684\u6587\u4ef6\uff0c\u5e76\u4e3a -l \u9009\u62e9\u4e00\u4e2a\u8d85\u8fc7\u73b0\u6709\u6700\u540e\u4e00\u4e2a\u6587\u4ef6\u540d\u7684\u9ed8\u8ba4\u503c\u3002\u56e0\u6b64\uff0c\u53ea\u6709\u5728\u786e\u5b9a\u5b58\u5728\u5f53\u524d\u4e0d\u5728 pg_wal \u4e2d\u7684 WAL \u6bb5\u6587\u4ef6\uff08\u4f8b\u5982\u79bb\u7ebf\u5f52\u6863\u4e2d\u7684\u6587\u4ef6\uff09\uff0c\u6216 pg_wal \u7684\u5185\u5bb9\u5b8c\u5168\u4e22\u5931\u65f6\uff0c\u624d\u5e94\u8be5\u9700\u8981\u624b\u52a8\u8c03\u6574 -l\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-m <em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-ids=<em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e00\u90e8\u5206\uff09\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_multixact/offsets</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 32768 (0x8000) \u6765\u786e\u5b9a\u3002\u76f8\u53cd\uff0c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08<code class=\"option\">-m</code> \u7684\u7b2c\u4e8c\u90e8\u5206\uff09\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\u5e76\u4e58\u4ee5 32768 (0x8000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u7684\u3002\u901a\u5e38\u6700\u7b80\u5355\u7684\u505a\u6cd5\u4e5f\u662f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u9009\u9879\u503c\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">000F</code> \u548c <code class=\"filename\">0007</code> \u5206\u522b\u662f <code class=\"filename\">pg_multixact/offsets</code> \u4e2d\u6700\u5927\u548c\u6700\u5c0f\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-m 0x80000,0x38000</code> \u5c31\u53ef\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>oid8</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-oid=<em class=\"replaceable\"><code>oid8</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\uff088 \u5b57\u8282\uff09\u3002</p>\n<p lang=\"zh\">\u5e76\u6ca1\u6709\u540c\u6837\u7b80\u5355\u7684\u65b9\u6cd5\u6765\u786e\u5b9a\u4e00\u4e2a\u8d85\u51fa\u6570\u636e\u5e93\u4e2d\u6700\u5927 OID \u7684\u4e0b\u4e00\u4e2a OID\uff0c\u4e0d\u8fc7\u5e78\u8fd0\u7684\u662f\uff0c\u4e0b\u4e00\u4e2a OID \u7684\u8bbe\u7f6e\u662f\u5426\u7cbe\u786e\u5e76\u4e0d\u5173\u952e\uff0c\u53ea\u8981\u4e0d\u51cf\u5c0f\u8ba1\u6570\u5668\u7684\u503c\u3002\u8be5\u8ba1\u6570\u5668\u5bbd 8 \u5b57\u8282\uff0c\u5728\u96c6\u7c07\u7684\u6574\u4e2a\u751f\u547d\u5468\u671f\u5185\u4e0d\u4f1a\u56de\u7ed5\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O <em class=\"replaceable\"><code>mxoff</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-offset=<em class=\"replaceable\"><code>mxoff</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_multixact/members</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 52352 (0xCC80) \u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u8fd9\u91cc\u6ca1\u6709\u50cf\u5176\u4ed6\u9009\u9879\u90a3\u6837\u901a\u8fc7\u8ffd\u52a0\u96f6\u5373\u53ef\u5f97\u5230\u7ed3\u679c\u7684\u7b80\u5355\u65b9\u6cd5\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-u <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--oldest-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0007</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5c0f\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-u 0x700000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0011</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-x 0x1200000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--char-signedness=<em class=\"replaceable\"><code>option</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u9ed8\u8ba4\u7684 char \u6709\u7b26\u53f7\u6027\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">signed</code> \u548c <code class=\"literal\">unsigned</code>\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u7531 <code class=\"command\">pg_upgrade</code> \u4ece 18 \u4e4b\u524d\u7684 <span class=\"productname\">PostgreSQL</span> \u7248\u672c\u5347\u7ea7\u800c\u6765\u7684\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5b89\u5168\u503c\u5e94\u4e3a\u5347\u7ea7\u524d\u8fd0\u884c\u8be5\u96c6\u7c07\u7684\u5e73\u53f0\u4e0a\u9ed8\u8ba4\u7684 <code class=\"type\">char</code> \u6709\u7b26\u53f7\u6027\u3002\u5bf9\u4e8e\u6240\u6709\u5176\u4ed6\u96c6\u7c07\uff0c<code class=\"literal\">signed</code> \u5c31\u662f\u5b89\u5168\u503c\u3002\u4e0d\u8fc7\uff0c\u8be5\u9009\u9879\u4e13\u4f9b <code class=\"command\">pg_upgrade</code> \u4f7f\u7528\uff0c\u901a\u5e38\u4e0d\u5e94\u624b\u5de5\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>wal_segment_size</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u8be5\u9009\u9879\u4e5f\u53ef\u7528\u4e8e\u66f4\u6539\u73b0\u6709\u6570\u636e\u5e93\u96c6\u7c07\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u4ece\u800c\u907f\u514d\u91cd\u65b0\u6267\u884c <code class=\"command\">initdb</code>\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u867d\u7136 <code class=\"command\">pg_resetwal</code> \u4f1a\u628a WAL \u8d77\u59cb\u4f4d\u7f6e\u8bbe\u7f6e\u5230\u8d85\u51fa\u73b0\u6709\u6700\u65b0 WAL \u6bb5\u6587\u4ef6\u7684\u4f4d\u7f6e\uff0c\u4f46\u67d0\u4e9b\u6bb5\u5927\u5c0f\u53d8\u66f4\u53ef\u80fd\u5bfc\u81f4\u65e7 WAL \u6587\u4ef6\u540d\u88ab\u91cd\u65b0\u4f7f\u7528\u3002\u5982\u679c WAL \u6587\u4ef6\u540d\u91cd\u53e0\u4f1a\u7ed9\u5f52\u6863\u7b56\u7565\u5e26\u6765\u95ee\u9898\uff0c\u5efa\u8bae\u5c06 <code class=\"option\">-l</code> \u4e0e\u6b64\u9009\u9879\u914d\u5408\u4f7f\u7528\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n</div>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u670d\u52a1\u5668\u8fd0\u884c\u671f\u95f4\u4e0d\u5f97\u4f7f\u7528\u6b64\u547d\u4ee4\u3002\u5982\u679c\u5728\u6570\u636e\u76ee\u5f55\u4e2d\u53d1\u73b0\u670d\u52a1\u5668\u9501\u6587\u4ef6\uff0c<code class=\"command\">pg_resetwal</code> \u5c06\u62d2\u7edd\u542f\u52a8\u3002\u5982\u679c\u670d\u52a1\u5668\u66fe\u5d29\u6e83\uff0c\u53ef\u80fd\u9057\u7559\u9501\u6587\u4ef6\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5220\u9664\u8be5\u9501\u6587\u4ef6\u4ee5\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u8fd0\u884c\u3002\u4f46\u5728\u8fd9\u6837\u505a\u4e4b\u524d\uff0c\u52a1\u5fc5\u518d\u4e09\u786e\u8ba4\u6ca1\u6709\u4efb\u4f55\u670d\u52a1\u5668\u8fdb\u7a0b\u4ecd\u5728\u8fd0\u884c\u3002</p>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4ec5\u9002\u7528\u4e8e\u76f8\u540c\u4e3b\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/devel/app-pgcontroldata.html\" title=\"pg_controldata\"><span class=\"refentrytitle\"><span class=\"application\">pg_controldata</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgresetwal.html", "localization": {"status": "complete", "sources": [{"url": "/docs/devel/app-pgresetwal.html", "method": "same-major semantic node", "sha256": "bda568976feff68588c25a436d4ebe58435e93aa00f0558c4532c343af17cb38", "language": "zh", "matched_nodes": ["#APP-PGRESETWAL/div[2]/p[1]", "#APP-PGRESETWAL/div[3]/h2[0]", "#APP-PGRESETWAL/div[4]/p[1]", "#APP-PGRESETWAL/div[4]/p[2]", "#APP-PGRESETWAL/div[4]/p[3]", "#APP-PGRESETWAL/div[4]/p[4]", "#APP-PGRESETWAL/div[4]/p[5]", "#APP-PGRESETWAL/div[4]/p[6]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[7]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[19]/div[2]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[19]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/div[3]/h3[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[2]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[7]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[7]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[1]", "#APP-PGRESETWAL/div[5]/p[2]", "#APP-PGRESETWAL/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[6]/h2[0]", "#APP-PGRESETWAL/div[7]/h2[0]", "#APP-PGRESETWAL/div[7]/p[1]", "#APP-PGRESETWAL/div[7]/p[2]", "#APP-PGRESETWAL/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/summary": "pg_resetwal \u2014 reset the write-ahead log and other control information of a PostgreSQL database cluster", "/category": "Server applications", "/versions/20/description/0": "pg_resetwal \u2014 reset the write-ahead log and other control information of a PostgreSQL database cluster", "/versions/20/facts/0/label": "Documented executable", "/versions/20/facts/1/label": "Executable version", "/versions/20/facts/2/label": "Reference inventory", "/versions/20/facts/2/value": "Server applications", "/versions/20/facts/3/label": "Option definition groups", "/versions/20/tables/0/title": "Documented options", "/versions/20/tables/1/title": "Environment variables", "/versions/20/tables/0/rows/0/summary": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA .", "/versions/20/tables/0/rows/1/summary": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control .", "/versions/20/tables/0/rows/2/summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "/versions/20/tables/0/rows/3/summary": "Display version information, then exit.", "/versions/20/tables/0/rows/4/summary": "Show help, then exit.", "/versions/20/tables/0/rows/5/summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "/versions/20/tables/0/rows/6/summary": "Manually set the next transaction ID's epoch.", "/versions/20/tables/0/rows/7/summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "/versions/20/tables/0/rows/8/summary": "Manually set the next and oldest multitransaction ID.", "/versions/20/tables/0/rows/9/summary": "Manually set the next OID (8 bytes).", "/versions/20/tables/0/columns/0/label": "Option and arguments", "/versions/20/tables/0/columns/1/label": "Description", "/versions/20/tables/0/rows/10/summary": "Manually set the next multitransaction offset.", "/versions/20/tables/0/rows/11/summary": "Manually set the oldest unfrozen transaction ID.", "/versions/20/tables/0/rows/12/summary": "Manually set the next transaction ID.", "/versions/20/tables/0/rows/13/summary": "Manually set the default char signedness. Possible values are signed and unsigned .", "/versions/20/tables/0/rows/14/summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "/versions/20/tables/1/columns/0/label": "Variable", "/versions/20/tables/1/columns/1/label": "Meaning", "/versions/20/tables/1/rows/0/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "2552b9dd2ad27fbb993029ed8a3cb41b712d45848bf99ed8329892cfbb2ef65d"}, "comparison_data": {"options": [{"names": ["-D datadir", "--pgdata= datadir"], "signature": "datadir -D datadir --pgdata= datadir", "description": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA ."}, {"names": ["-f", "--force"], "signature": "-f --force", "description": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control ."}, {"names": ["-n", "--dry-run"], "signature": "-n --dry-run", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "signature": "-e xid_epoch --epoch= xid_epoch", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "signature": "-l walfile --next-wal-file= walfile", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 32768 (0x8000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 32768 (0x8000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 000F and 0007 are the greatest and smallest entries in pg_multixact/offsets , -m 0x80000,0x38000 will work."}, {"names": ["-o oid8", "--next-oid= oid8"], "signature": "-o oid8 --next-oid= oid8", "description": "Manually set the next OID (8 bytes). There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right, as long as the counter is not moved backwards. The counter is 8 bytes wide and never wraps around during the life of a cluster."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "signature": "-O mxoff --multixact-offset= mxoff", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "signature": "-u xid --oldest-transaction-id= xid", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "signature": "-x xid --next-transaction-id= xid", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["--char-signedness= option"], "signature": "--char-signedness= option", "description": "Manually set the default char signedness. Possible values are signed and unsigned . For a database cluster that pg_upgrade upgraded from a PostgreSQL version before 18, the safe value would be the default char signedness of the platform that ran the cluster before that upgrade. For all other clusters, signed would be the safe value. However, this option is exclusively for use with pg_upgrade and should not normally be used manually."}, {"names": ["--wal-segsize= wal_segment_size"], "signature": "--wal-segsize= wal_segment_size", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. This option can also be used to change the WAL segment size of an existing database cluster, avoiding the need to re- initdb . Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "7954cbe6f7140f1ae1a6a70c7e57dcb34421b239a8ced4710e5abf93f76193c6", "manual_language": "zh"}}}, "snapshot": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "pg_resetwal"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "18.6"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u670d\u52a1\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "15"}], "tables": [{"key": "options", "rows": [{"summary": "\u6307\u5b9a\u6570\u636e\u5e93\u76ee\u5f55\u7684\u4f4d\u7f6e\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002 pg_resetwal \u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf PGDATA \u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "datadir -D datadir --pgdata= datadir"}}, {"summary": "\u5373\u4f7f\u5728\u53ef\u80fd\u6709\u5371\u9669\u7684\u60c5\u51b5\u4e0b\uff0c\u4e5f\u5f3a\u5236 pg_resetwal \u7ee7\u7eed\u6267\u884c\uff0c\u5982\u4e0a\u6587\u6240\u8ff0\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5982\u679c\u670d\u52a1\u5668\u672a\u88ab\u5e72\u51c0\u5173\u95ed\uff0c\u6216\u8005 pg_resetwal \u65e0\u6cd5\u4e3a pg_control \u786e\u5b9a\u6709\u6548\u6570\u636e\uff0c\u5219\u5fc5\u987b\u6307\u5b9a\u8be5\u9009\u9879\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-f --force"}}, {"summary": "-n / --dry-run \u9009\u9879\u4f1a\u8ba9 pg_resetwal \u6253\u5370\u4ece pg_control \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 pg_resetwal \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-n --dry-run"}}, {"summary": "\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-V --version"}}, {"summary": "\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-? --help"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-c xid , xid --commit-timestamp-ids= xid , xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-e xid_epoch --epoch= xid_epoch"}}, {"summary": "\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-l walfile --next-wal-file= walfile"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-m mxid , mxid --multixact-ids= mxid , mxid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-o oid --next-oid= oid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-O mxoff --multixact-offset= mxoff"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-u xid --oldest-transaction-id= xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "-x xid --next-transaction-id= xid"}}, {"summary": "\u624b\u5de5\u8bbe\u7f6e\u9ed8\u8ba4\u7684 char \u6709\u7b26\u53f7\u6027\u3002\u53ef\u9009\u503c\u4e3a signed \u548c unsigned \u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "--char-signedness= option"}}, {"summary": "\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002", "signature": {"url": "/docs/18/app-pgresetwal.html", "text": "--wal-segsize= wal_segment_size"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-D datadir", "--pgdata= datadir"], "summary": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA .", "signature": "datadir -D datadir --pgdata= datadir", "source_url": "/docs/18/app-pgresetwal.html", "description": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA ."}, {"names": ["-f", "--force"], "summary": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control .", "signature": "-f --force", "source_url": "/docs/18/app-pgresetwal.html", "description": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control ."}, {"names": ["-n", "--dry-run"], "summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "signature": "-n --dry-run", "source_url": "/docs/18/app-pgresetwal.html", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "summary": "Display version information, then exit.", "signature": "-V --version", "source_url": "/docs/18/app-pgresetwal.html", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "summary": "Show help, then exit.", "signature": "-? --help", "source_url": "/docs/18/app-pgresetwal.html", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "summary": "Manually set the next transaction ID's epoch.", "signature": "-e xid_epoch --epoch= xid_epoch", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "signature": "-l walfile --next-wal-file= walfile", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "summary": "Manually set the next and oldest multitransaction ID.", "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "summary": "Manually set the next OID.", "signature": "-o oid --next-oid= oid", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "summary": "Manually set the next multitransaction offset.", "signature": "-O mxoff --multixact-offset= mxoff", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "summary": "Manually set the oldest unfrozen transaction ID.", "signature": "-u xid --oldest-transaction-id= xid", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "summary": "Manually set the next transaction ID.", "signature": "-x xid --next-transaction-id= xid", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["--char-signedness= option"], "summary": "Manually set the default char signedness. Possible values are signed and unsigned .", "signature": "--char-signedness= option", "source_url": "/docs/18/app-pgresetwal.html", "description": "Manually set the default char signedness. Possible values are signed and unsigned . For a database cluster that pg_upgrade upgraded from a PostgreSQL version before 18, the safe value would be the default char signedness of the platform that ran the cluster before that upgrade. For all other clusters, signed would be the safe value. However, this option is exclusively for use with pg_upgrade and should not normally be used manually."}, {"names": ["--wal-segsize= wal_segment_size"], "summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "signature": "--wal-segsize= wal_segment_size", "source_url": "/docs/18/app-pgresetwal.html", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. This option can also be used to change the WAL segment size of an existing database cluster, avoiding the need to re- initdb . Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}], "related": [], "release": {"ref": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "18.6", "major": "18", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/18/postgresql-18-A4.pdf", "bytes": 15865106, "pages": 3154, "sha256": "19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/18/postgresql-18-US.pdf", "bytes": 15748059, "pages": 3328, "sha256": "facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319", "built_at": "2026-09-26"}}, "tree": "18", "index": "index.html", "major": "18", "pages": 1148, "release": "18.6", "source_url": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "revision": "ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8", "evidence_kind": "English manual and source declarations", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "sources": [{"url": "https://pg.center/docs/18/app-pgresetwal.html", "file": "app-pgresetwal.html", "label": "18.6 English manual \u00b7 app-pgresetwal.html", "anchor": "", "sha256": "d98a541b766cc4c6dd1c5b77d2b20c904ad76b7aa169e8e76916fa724097642f", "language": "en", "original_url": "/docs/18/app-pgresetwal.html"}, {"url": "https://pg.center/docs/18/reference-server.html", "file": "reference-server.html", "label": "Server applications inventory", "anchor": "", "sha256": "e9f8bbcc8e3641fadd1d20991e8aad6b532155b786ba5a1b7b364ec4f1a5bef3", "language": "en", "original_url": "/docs/18/reference-server.html"}], "sections": [], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "signature": "pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir", "description": ["pg_resetwal \u2014 \u91cd\u7f6e PostgreSQL \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PGRESETWAL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">pg_resetwal</span></span></h2>\n<p lang=\"zh\">pg_resetwal \u2014 \u91cd\u7f6e <span class=\"productname\">PostgreSQL</span> \u6570\u636e\u5e93\u96c6\u7c07\u7684\u9884\u5199\u5f0f\u65e5\u5fd7\u53ca\u5176\u4ed6\u63a7\u5236\u4fe1\u606f</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.5.9.4.1\"><code class=\"command\">pg_resetwal</code> [ <code class=\"option\">-f</code> | <code class=\"option\">--force</code> ] [ <code class=\"option\">-n</code> | <code class=\"option\">--dry-run</code> ] [<em class=\"replaceable\"><code>option</code></em>...] [ <code class=\"option\">-D</code> | <code class=\"option\">--pgdata</code> ]<em class=\"replaceable\"><code>datadir</code></em></p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PGRESETWAL-1\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4f1a\u6e05\u9664\u9884\u5199\u5f0f\u65e5\u5fd7\uff08WAL\uff09\uff0c\u5e76\u53ef\u9009\u62e9\u6027\u5730\u91cd\u7f6e\u5b58\u50a8\u5728 <code class=\"filename\">pg_control</code> \u6587\u4ef6\u4e2d\u7684\u67d0\u4e9b\u5176\u4ed6\u63a7\u5236\u4fe1\u606f\u3002\u5982\u679c\u8fd9\u4e9b\u6587\u4ef6\u5df2\u7ecf\u635f\u574f\uff0c\u6709\u65f6\u5c31\u9700\u8981\u4f7f\u7528\u6b64\u529f\u80fd\u3002\u53ea\u6709\u5f53\u670d\u52a1\u5668\u56e0\u8fd9\u7c7b\u635f\u574f\u800c\u65e0\u6cd5\u542f\u52a8\u65f6\uff0c\u624d\u5e94\u5c06\u5176\u4f5c\u4e3a\u6700\u540e\u624b\u6bb5\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u9009\u9879\uff0c\u5982 <code class=\"option\">--wal-segsize</code>\uff08\u89c1\u4e0b\u6587\uff09\uff0c\u4e5f\u53ef\u7528\u4e8e\u5728\u4e0d\u91cd\u65b0\u8fd0\u884c <code class=\"command\">initdb</code> \u7684\u60c5\u51b5\u4e0b\u4fee\u6539\u6570\u636e\u5e93\u96c6\u7c07\u7684\u67d0\u4e9b\u5168\u5c40\u8bbe\u7f6e\u3002\u82e5\u4e0d\u4f7f\u7528\u4e0b\u6587\u63d0\u5230\u7684\u5371\u9669\u6a21\u5f0f\uff0c\u5219\u53ef\u5728\u5176\u4ed6\u65b9\u9762\u5b8c\u597d\u7684\u6570\u636e\u5e93\u96c6\u7c07\u4e0a\u5b89\u5168\u6267\u884c\u6b64\u64cd\u4f5c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u67d0\u4e2a\u6570\u636e\u76ee\u5f55\u4e0a\u4f7f\u7528 <code class=\"command\">pg_resetwal</code> \u65f6\uff0c\u670d\u52a1\u5668\u5df2\u7ecf\u88ab\u5e72\u51c0\u5173\u95ed\u4e14\u63a7\u5236\u6587\u4ef6\u5b8c\u597d\uff0c\u90a3\u4e48\u9664\u4e86\u4f1a\u6e05\u9664\u4e0d\u518d\u4f7f\u7528\u7684 WAL \u6587\u4ef6\u5916\uff0c\u5b83\u4e0d\u4f1a\u5bf9\u6570\u636e\u5e93\u7cfb\u7edf\u7684\u5185\u5bb9\u4ea7\u751f\u4efb\u4f55\u5f71\u54cd\u3002\u5176\u4ed6\u4efb\u4f55\u7528\u6cd5\u90fd\u53ef\u80fd\u6709\u5371\u9669\uff0c\u5fc5\u987b\u6781\u5176\u8c28\u614e\u3002\u82e5\u8981\u5728\u670d\u52a1\u5668\u672a\u5e72\u51c0\u5173\u95ed\u6216\u63a7\u5236\u6587\u4ef6\u5df2\u635f\u574f\u7684\u6570\u636e\u76ee\u5f55\u4e0a\u6267\u884c\u64cd\u4f5c\uff0c<code class=\"command\">pg_resetwal</code> \u8981\u6c42\u5fc5\u987b\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5728\u5e26\u6709\u635f\u574f WAL \u6216\u635f\u574f\u63a7\u5236\u6587\u4ef6\u7684\u6570\u636e\u76ee\u5f55\u4e0a\u8fd0\u884c\u6b64\u547d\u4ee4\u540e\uff0c\u670d\u52a1\u5668\u5e94\u8be5\u53ef\u4ee5\u542f\u52a8\uff1b\u4f46\u8bf7\u8bb0\u4f4f\uff0c\u7531\u4e8e\u4ec5\u90e8\u5206\u63d0\u4ea4\u7684\u4e8b\u52a1\uff0c\u6570\u636e\u5e93\u4e2d\u53ef\u80fd\u542b\u6709\u4e0d\u4e00\u81f4\u7684\u6570\u636e\u3002\u5e94\u7acb\u5373\u8f6c\u50a8\u6570\u636e\uff0c\u8fd0\u884c <code class=\"command\">initdb</code>\uff0c\u7136\u540e\u6062\u590d\u3002\u6062\u590d\u540e\uff0c\u8bf7\u68c0\u67e5\u662f\u5426\u5b58\u5728\u4e0d\u4e00\u81f4\u5e76\u6309\u9700\u4fee\u590d\u3002</p>\n<p lang=\"zh\">\u5982\u679c <code class=\"command\">pg_resetwal</code> \u62a5\u544a\u65e0\u6cd5\u786e\u5b9a <code class=\"filename\">pg_control</code> \u7684\u6709\u6548\u6570\u636e\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a <code class=\"option\">-f</code>\uff08\u5f3a\u5236\uff09\u9009\u9879\u5f3a\u884c\u7ee7\u7eed\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u7f3a\u5931\u7684\u6570\u636e\u5c06\u4ee5\u770b\u4f3c\u5408\u7406\u7684\u503c\u4ee3\u66ff\u3002\u5927\u591a\u6570\u5b57\u6bb5\u9884\u8ba1\u90fd\u80fd\u5339\u914d\uff0c\u4f46\u5bf9\u4e8e\u4e0b\u4e00\u4e2a OID\u3001\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u53ca\u5176\u7eaa\u5143\u3001\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID \u53ca\u5176\u504f\u79fb\u91cf\uff0c\u4ee5\u53ca WAL \u8d77\u59cb\u4f4d\u7f6e\u5b57\u6bb5\uff0c\u53ef\u80fd\u4ecd\u9700\u8981\u4eba\u5de5\u534f\u52a9\u3002\u8fd9\u4e9b\u5b57\u6bb5\u53ef\u901a\u8fc7\u4e0b\u6587\u8ba8\u8bba\u7684\u9009\u9879\u6765\u8bbe\u7f6e\u3002\u5982\u679c\u65e0\u6cd5\u4e3a\u6240\u6709\u8fd9\u4e9b\u5b57\u6bb5\u786e\u5b9a\u6b63\u786e\u503c\uff0c\u4ecd\u7136\u53ef\u4ee5\u4f7f\u7528 <code class=\"option\">-f</code>\uff0c\u4f46\u6062\u590d\u5f97\u5230\u7684\u6570\u636e\u5e93\u5fc5\u987b\u6bd4\u5e73\u65f6\u66f4\u53d7\u6000\u7591\uff1a\u7acb\u5373\u8f6c\u50a8\u5e76\u6062\u590d\u52bf\u5728\u5fc5\u884c\u3002<span class=\"emphasis\"><em>\u5207\u52ff</em></span>\u5728\u5b8c\u6210\u8f6c\u50a8\u4e4b\u524d\u5bf9\u6570\u636e\u5e93\u6267\u884c\u4efb\u4f55\u4fee\u6539\u6570\u636e\u7684\u64cd\u4f5c\uff0c\u56e0\u4e3a\u4efb\u4f55\u6b64\u7c7b\u64cd\u4f5c\u90fd\u5f88\u53ef\u80fd\u4f7f\u635f\u574f\u8fdb\u4e00\u6b65\u6076\u5316\u3002</p>\n<p lang=\"zh\">\u8be5\u5de5\u5177\u53ea\u80fd\u7531\u5b89\u88c5\u8be5\u670d\u52a1\u5668\u7684\u7528\u6237\u8fd0\u884c\uff0c\u56e0\u4e3a\u5b83\u9700\u8981\u5bf9\u6570\u636e\u76ee\u5f55\u5177\u6709\u8bfb\u5199\u8bbf\u95ee\u6743\u9650\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.6\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><em class=\"replaceable\"><code>datadir</code></em><br/></span><span class=\"term\"><code class=\"option\">-D <em class=\"replaceable\"><code>datadir</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pgdata=<em class=\"replaceable\"><code>datadir</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u6570\u636e\u5e93\u76ee\u5f55\u7684\u4f4d\u7f6e\u3002\u51fa\u4e8e\u5b89\u5168\u539f\u56e0\uff0c\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u6570\u636e\u76ee\u5f55\u3002<code class=\"command\">pg_resetwal</code> \u4e0d\u4f7f\u7528\u73af\u5883\u53d8\u91cf <code class=\"envar\">PGDATA</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f</code><br/></span><span class=\"term\"><code class=\"option\">--force</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5373\u4f7f\u5728\u53ef\u80fd\u6709\u5371\u9669\u7684\u60c5\u51b5\u4e0b\uff0c\u4e5f\u5f3a\u5236 <code class=\"command\">pg_resetwal</code> \u7ee7\u7eed\u6267\u884c\uff0c\u5982\u4e0a\u6587\u6240\u8ff0\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5982\u679c\u670d\u52a1\u5668\u672a\u88ab\u5e72\u51c0\u5173\u95ed\uff0c\u6216\u8005 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u4e3a <code class=\"filename\">pg_control</code> \u786e\u5b9a\u6709\u6548\u6570\u636e\uff0c\u5219\u5fc5\u987b\u6307\u5b9a\u8be5\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--dry-run</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"option\">-n</code>/<code class=\"option\">--dry-run</code> \u9009\u9879\u4f1a\u8ba9 <code class=\"command\">pg_resetwal</code> \u6253\u5370\u4ece <code class=\"filename\">pg_control</code> \u91cd\u5efa\u51fa\u7684\u503c\u4ee5\u53ca\u5373\u5c06\u66f4\u6539\u7684\u503c\uff0c\u7136\u540e\u5728\u4e0d\u505a\u4efb\u4f55\u4fee\u6539\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u3002\u8fd9\u4e3b\u8981\u662f\u8c03\u8bd5\u5de5\u5177\uff0c\u4f46\u5728\u771f\u6b63\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u6267\u884c\u4e4b\u524d\uff0c\u4e5f\u53ef\u7528\u4f5c\u5408\u7406\u6027\u68c0\u67e5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u7248\u672c\u4fe1\u606f\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\uff0c\u7136\u540e\u9000\u51fa\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4ee5\u4e0b\u9009\u9879\u4ec5\u5728 <code class=\"command\">pg_resetwal</code> \u65e0\u6cd5\u901a\u8fc7\u8bfb\u53d6 <code class=\"filename\">pg_control</code> \u786e\u5b9a\u9002\u5f53\u503c\u65f6\u624d\u9700\u8981\u4f7f\u7528\u3002\u5b89\u5168\u503c\u53ef\u6309\u4e0b\u8ff0\u65b9\u6cd5\u786e\u5b9a\u3002\u5bf9\u4e8e\u63a5\u53d7\u6570\u5b57\u53c2\u6570\u7684\u9009\u9879\uff0c\u53ef\u4f7f\u7528\u524d\u7f00 <code class=\"literal\">0x</code> \u6307\u5b9a\u5341\u516d\u8fdb\u5236\u503c\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e9b\u8bf4\u660e\u4ec5\u9002\u7528\u4e8e\u6807\u51c6\u5757\u5927\u5c0f\u4e3a 8 kB \u7684\u60c5\u51b5\u3002</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--commit-timestamp-ids=<em class=\"replaceable\"><code>xid</code></em>,<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u548c\u6700\u65b0\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65e7\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e00\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_commit_ts</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u76f8\u53cd\uff0c\u53ef\u68c0\u7d22\u63d0\u4ea4\u65f6\u95f4\u7684\u6700\u65b0\u4e8b\u52a1 ID \u7684\u5b89\u5168\u503c\uff08\u7b2c\u4e8c\u90e8\u5206\uff09\uff0c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u5747\u4e3a\u5341\u516d\u8fdb\u5236\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e <em class=\"replaceable\"><code>xid_epoch</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--epoch=<em class=\"replaceable\"><code>xid_epoch</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID \u7684\u7eaa\u5143\u3002</p>\n<p lang=\"zh\">\u4e8b\u52a1 ID \u7eaa\u5143\u5b9e\u9645\u4e0a\u5e76\u672a\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u4efb\u4f55\u5730\u65b9\uff0c\u9664\u4e86\u7531 <code class=\"command\">pg_resetwal</code> \u8bbe\u7f6e\u7684\u8fd9\u4e2a\u5b57\u6bb5\uff0c\u56e0\u6b64\u5c31\u6570\u636e\u5e93\u672c\u8eab\u800c\u8a00\uff0c\u4efb\u4f55\u503c\u90fd\u53ef\u7528\u3002\u53ef\u80fd\u9700\u8981\u8c03\u6574\u8be5\u503c\uff0c\u4ee5\u786e\u4fdd <span class=\"application\">Slony-I</span> \u548c <span class=\"application\">Skytools</span> \u7b49\u590d\u5236\u7cfb\u7edf\u6b63\u5e38\u5de5\u4f5c \u2014 \u5982\u679c\u786e\u6709\u9700\u8981\uff0c\u5e94\u8be5\u53ef\u4ee5\u4ece\u4e0b\u6e38\u590d\u5236\u6570\u636e\u5e93\u7684\u72b6\u6001\u4e2d\u83b7\u5f97\u5408\u9002\u7684\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l <em class=\"replaceable\"><code>walfile</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-wal-file=<em class=\"replaceable\"><code>walfile</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u901a\u8fc7\u6307\u5b9a\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0b\u4e00\u4e2a WAL \u6bb5\u6587\u4ef6\u7684\u540d\u79f0\u5e94\u5927\u4e8e\u5f53\u524d\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_wal</code> \u76ee\u5f55\u4e2d\u73b0\u5b58\u7684\u4efb\u610f WAL \u6bb5\u6587\u4ef6\u540d\u3002\u8fd9\u4e9b\u540d\u79f0\u540c\u6837\u91c7\u7528\u5341\u516d\u8fdb\u5236\uff0c\u5e76\u7531\u4e09\u4e2a\u90e8\u5206\u7ec4\u6210\u3002\u7b2c\u4e00\u90e8\u5206\u662f<span class=\"quote\">\u201c<span class=\"quote\">\u65f6\u95f4\u7ebf ID</span>\u201d</span>\uff0c\u901a\u5e38\u5e94\u4fdd\u6301\u4e0d\u53d8\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">00000001000000320000004A</code> \u662f <code class=\"filename\">pg_wal</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u5219\u5e94\u4f7f\u7528 <code class=\"literal\">-l 00000001000000320000004B</code> \u6216\u66f4\u5927\u7684\u503c\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u5728\u4f7f\u7528\u975e\u9ed8\u8ba4 WAL \u6bb5\u5927\u5c0f\u65f6\uff0cWAL \u6587\u4ef6\u540d\u4e2d\u7684\u6570\u5b57\u4e0e\u7cfb\u7edf\u51fd\u6570\u548c\u7cfb\u7edf\u89c6\u56fe\u62a5\u544a\u7684 LSN \u4e0d\u540c\u3002\u8be5\u9009\u9879\u63a5\u53d7\u7684\u662f WAL \u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f LSN\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">pg_resetwal \u81ea\u8eab\u4f1a\u68c0\u67e5 pg_wal \u4e2d\u7684\u6587\u4ef6\uff0c\u5e76\u4e3a -l \u9009\u62e9\u4e00\u4e2a\u8d85\u8fc7\u73b0\u6709\u6700\u540e\u4e00\u4e2a\u6587\u4ef6\u540d\u7684\u9ed8\u8ba4\u503c\u3002\u56e0\u6b64\uff0c\u53ea\u6709\u5728\u786e\u5b9a\u5b58\u5728\u5f53\u524d\u4e0d\u5728 pg_wal \u4e2d\u7684 WAL \u6bb5\u6587\u4ef6\uff08\u4f8b\u5982\u79bb\u7ebf\u5f52\u6863\u4e2d\u7684\u6587\u4ef6\uff09\uff0c\u6216 pg_wal \u7684\u5185\u5bb9\u5b8c\u5168\u4e22\u5931\u65f6\uff0c\u624d\u5e94\u8be5\u9700\u8981\u624b\u52a8\u8c03\u6574 -l\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-m <em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-ids=<em class=\"replaceable\"><code>mxid</code></em>,<em class=\"replaceable\"><code>mxid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u548c\u6700\u65e7\u7684\u591a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u8981\u786e\u5b9a\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1 ID\uff08\u7b2c\u4e00\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u5728\u6570\u636e\u76ee\u5f55\u4e0b\u7684 pg_multixact/offsets \u76ee\u5f55\u4e2d\u627e\u5230\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5c06\u5176\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 65536\uff080x10000\uff09\u3002\u76f8\u5e94\u5730\uff0c\u8981\u786e\u5b9a\u6700\u65e7\u591a\u4e8b\u52a1 ID\uff08-m \u7684\u7b2c\u4e8c\u90e8\u5206\uff09\u7684\u5b89\u5168\u503c\uff0c\u53ef\u4ee5\u627e\u5230\u540c\u4e00\u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 65536\u3002\u6587\u4ef6\u540d\u4f7f\u7528\u5341\u516d\u8fdb\u5236\uff0c\u56e0\u6b64\u6700\u7b80\u5355\u7684\u505a\u6cd5\u662f\u4ee5\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u9009\u9879\u503c\uff0c\u5e76\u5728\u672b\u5c3e\u6dfb\u52a0\u56db\u4e2a\u96f6\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>oid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-oid=<em class=\"replaceable\"><code>oid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a OID\u3002</p>\n<p lang=\"zh\">\u5e76\u6ca1\u6709\u540c\u6837\u7b80\u5355\u7684\u65b9\u6cd5\u6765\u786e\u5b9a\u4e00\u4e2a\u8d85\u51fa\u6570\u636e\u5e93\u4e2d\u6700\u5927 OID \u7684\u4e0b\u4e00\u4e2a OID\uff0c\u4e0d\u8fc7\u5e78\u8fd0\u7684\u662f\uff0c\u4e0b\u4e00\u4e2a OID \u7684\u8bbe\u7f6e\u662f\u5426\u7cbe\u786e\u5e76\u4e0d\u5173\u952e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-O <em class=\"replaceable\"><code>mxoff</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--multixact-offset=<em class=\"replaceable\"><code>mxoff</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u591a\u4e8b\u52a1\u504f\u79fb\u91cf\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_multixact/members</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 52352 (0xCC80) \u6765\u786e\u5b9a\u3002\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u8fd9\u91cc\u6ca1\u6709\u50cf\u5176\u4ed6\u9009\u9879\u90a3\u6837\u901a\u8fc7\u8ffd\u52a0\u96f6\u5373\u53ef\u5f97\u5230\u7ed3\u679c\u7684\u7b80\u5355\u65b9\u6cd5\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-u <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--oldest-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u6700\u65e7\u7684\u672a\u51bb\u7ed3\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5c0f\u7684\u6587\u4ef6\u540d\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0007</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5c0f\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-u 0x700000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x <em class=\"replaceable\"><code>xid</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--next-transaction-id=<em class=\"replaceable\"><code>xid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u4e0b\u4e00\u4e2a\u4e8b\u52a1 ID\u3002</p>\n<p lang=\"zh\">\u5b89\u5168\u503c\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b\u6570\u636e\u76ee\u5f55\u4e0b <code class=\"filename\">pg_xact</code> \u76ee\u5f55\u4e2d\u6570\u503c\u6700\u5927\u7684\u6587\u4ef6\u540d\uff0c\u5148\u52a0\u4e00\uff0c\u518d\u4e58\u4ee5 1048576 (0x100000) \u6765\u786e\u5b9a\u3002\u8bf7\u6ce8\u610f\uff0c\u6587\u4ef6\u540d\u662f\u5341\u516d\u8fdb\u5236\u3002\u901a\u5e38\uff0c\u9009\u9879\u503c\u4e5f\u7528\u5341\u516d\u8fdb\u5236\u6307\u5b9a\u6700\u4e3a\u7b80\u5355\u3002\u4f8b\u5982\uff0c\u5982\u679c <code class=\"filename\">0011</code> \u662f <code class=\"filename\">pg_xact</code> \u4e2d\u6700\u5927\u7684\u6761\u76ee\uff0c\u90a3\u4e48 <code class=\"literal\">-x 0x1200000</code> \u5c31\u53ef\u4ee5\u4f7f\u7528\uff08\u4e94\u4e2a\u5c3e\u968f\u96f6\u63d0\u4f9b\u4e86\u6b63\u786e\u7684\u4e58\u6570\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--char-signedness=<em class=\"replaceable\"><code>option</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u624b\u5de5\u8bbe\u7f6e\u9ed8\u8ba4\u7684 char \u6709\u7b26\u53f7\u6027\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">signed</code> \u548c <code class=\"literal\">unsigned</code>\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u7531 <code class=\"command\">pg_upgrade</code> \u4ece 18 \u4e4b\u524d\u7684 <span class=\"productname\">PostgreSQL</span> \u7248\u672c\u5347\u7ea7\u800c\u6765\u7684\u6570\u636e\u5e93\u96c6\u7c07\uff0c\u5b89\u5168\u503c\u5e94\u4e3a\u5347\u7ea7\u524d\u8fd0\u884c\u8be5\u96c6\u7c07\u7684\u5e73\u53f0\u4e0a\u9ed8\u8ba4\u7684 <code class=\"type\">char</code> \u6709\u7b26\u53f7\u6027\u3002\u5bf9\u4e8e\u6240\u6709\u5176\u4ed6\u96c6\u7c07\uff0c<code class=\"literal\">signed</code> \u5c31\u662f\u5b89\u5168\u503c\u3002\u4e0d\u8fc7\uff0c\u8be5\u9009\u9879\u4e13\u4f9b <code class=\"command\">pg_upgrade</code> \u4f7f\u7528\uff0c\u901a\u5e38\u4e0d\u5e94\u624b\u5de5\u4f7f\u7528\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--wal-segsize=<em class=\"replaceable\"><code>wal_segment_size</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u65b0\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u5355\u4f4d\u4e3a\u5146\u5b57\u8282\u3002\u53d6\u503c\u5fc5\u987b\u662f 1 \u5230 1024\uff08\u5146\u5b57\u8282\uff09\u4e4b\u95f4\u7684 2 \u7684\u5e42\u3002\u66f4\u591a\u4fe1\u606f\u53c2\u89c1 initdb \u7684\u540c\u540d\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u8be5\u9009\u9879\u4e5f\u53ef\u7528\u4e8e\u66f4\u6539\u73b0\u6709\u6570\u636e\u5e93\u96c6\u7c07\u7684 WAL \u6bb5\u5927\u5c0f\uff0c\u4ece\u800c\u907f\u514d\u91cd\u65b0\u6267\u884c <code class=\"command\">initdb</code>\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u867d\u7136 <code class=\"command\">pg_resetwal</code> \u4f1a\u628a WAL \u8d77\u59cb\u4f4d\u7f6e\u8bbe\u7f6e\u5230\u8d85\u51fa\u73b0\u6709\u6700\u65b0 WAL \u6bb5\u6587\u4ef6\u7684\u4f4d\u7f6e\uff0c\u4f46\u67d0\u4e9b\u6bb5\u5927\u5c0f\u53d8\u66f4\u53ef\u80fd\u5bfc\u81f4\u65e7 WAL \u6587\u4ef6\u540d\u88ab\u91cd\u65b0\u4f7f\u7528\u3002\u5982\u679c WAL \u6587\u4ef6\u540d\u91cd\u53e0\u4f1a\u7ed9\u5f52\u6863\u7b56\u7565\u5e26\u6765\u95ee\u9898\uff0c\u5efa\u8bae\u5c06 <code class=\"option\">-l</code> \u4e0e\u6b64\u9009\u9879\u914d\u5408\u4f7f\u7528\uff0c\u624b\u5de5\u8bbe\u7f6e WAL \u8d77\u59cb\u4f4d\u7f6e\u3002</p>\n</div>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.7\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.8\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<p lang=\"zh\">\u670d\u52a1\u5668\u8fd0\u884c\u671f\u95f4\u4e0d\u5f97\u4f7f\u7528\u6b64\u547d\u4ee4\u3002\u5982\u679c\u5728\u6570\u636e\u76ee\u5f55\u4e2d\u53d1\u73b0\u670d\u52a1\u5668\u9501\u6587\u4ef6\uff0c<code class=\"command\">pg_resetwal</code> \u5c06\u62d2\u7edd\u542f\u52a8\u3002\u5982\u679c\u670d\u52a1\u5668\u66fe\u5d29\u6e83\uff0c\u53ef\u80fd\u9057\u7559\u9501\u6587\u4ef6\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5220\u9664\u8be5\u9501\u6587\u4ef6\u4ee5\u5141\u8bb8 <code class=\"command\">pg_resetwal</code> \u8fd0\u884c\u3002\u4f46\u5728\u8fd9\u6837\u505a\u4e4b\u524d\uff0c\u52a1\u5fc5\u518d\u4e09\u786e\u8ba4\u6ca1\u6709\u4efb\u4f55\u670d\u52a1\u5668\u8fdb\u7a0b\u4ecd\u5728\u8fd0\u884c\u3002</p>\n<p lang=\"zh\"><code class=\"command\">pg_resetwal</code> \u4ec5\u9002\u7528\u4e8e\u76f8\u540c\u4e3b\u7248\u672c\u7684\u670d\u52a1\u5668\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.5.9.9\">\n<h2 lang=\"zh\">\u53e6\u89c1</h2><span class=\"simplelist\"><a class=\"xref\" href=\"https://pg.center/docs/18/app-pgcontroldata.html\" title=\"pg_controldata\"><span class=\"refentrytitle\"><span class=\"application\">pg_controldata</span></span></a></span>\n</div>\n</div></div>", "manual_path": "app-pgresetwal.html", "localization": {"status": "complete", "sources": [{"url": "/docs/18/app-pgresetwal.html", "method": "same-major semantic node", "sha256": "80594b2bf329e679e09ab6352be7572062a211f39bcb2a4d8cf486314f82d240", "language": "zh", "matched_nodes": ["#APP-PGRESETWAL/div[2]/p[1]", "#APP-PGRESETWAL/div[3]/h2[0]", "#APP-PGRESETWAL/div[4]/p[1]", "#APP-PGRESETWAL/div[4]/p[2]", "#APP-PGRESETWAL/div[4]/p[3]", "#APP-PGRESETWAL/div[4]/p[4]", "#APP-PGRESETWAL/div[4]/p[5]", "#APP-PGRESETWAL/div[4]/p[6]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[7]", "#APP-PGRESETWAL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[11]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[13]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[19]/div[2]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[19]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[1]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[3]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/div[3]/h3[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[1]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[5]/p[2]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[7]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[0]", "#APP-PGRESETWAL/div[5]/div[3]/dl[0]/dd[9]/p[1]", "#APP-PGRESETWAL/div[5]/p[2]", "#APP-PGRESETWAL/div[6]/div[1]/dl[0]/dd[1]", "#APP-PGRESETWAL/div[6]/h2[0]", "#APP-PGRESETWAL/div[7]/h2[0]", "#APP-PGRESETWAL/div[7]/p[1]", "#APP-PGRESETWAL/div[7]/p[2]", "#APP-PGRESETWAL/div[8]/h2[0]"]}], "language": "zh", "original_text": {"/versions/18/description/0": "pg_resetwal \u2014 reset the write-ahead log and other control information of a PostgreSQL database cluster", "/versions/18/facts/0/label": "Documented executable", "/versions/18/facts/1/label": "Executable version", "/versions/18/facts/2/label": "Reference inventory", "/versions/18/facts/2/value": "Server applications", "/versions/18/facts/3/label": "Option definition groups", "/versions/18/tables/0/title": "Documented options", "/versions/18/tables/1/title": "Environment variables", "/versions/18/tables/0/rows/0/summary": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA .", "/versions/18/tables/0/rows/1/summary": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control .", "/versions/18/tables/0/rows/2/summary": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real.", "/versions/18/tables/0/rows/3/summary": "Display version information, then exit.", "/versions/18/tables/0/rows/4/summary": "Show help, then exit.", "/versions/18/tables/0/rows/5/summary": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved.", "/versions/18/tables/0/rows/6/summary": "Manually set the next transaction ID's epoch.", "/versions/18/tables/0/rows/7/summary": "Manually set the WAL starting location by specifying the name of the next WAL segment file.", "/versions/18/tables/0/rows/8/summary": "Manually set the next and oldest multitransaction ID.", "/versions/18/tables/0/rows/9/summary": "Manually set the next OID.", "/versions/18/tables/0/columns/0/label": "Option and arguments", "/versions/18/tables/0/columns/1/label": "Description", "/versions/18/tables/0/rows/10/summary": "Manually set the next multitransaction offset.", "/versions/18/tables/0/rows/11/summary": "Manually set the oldest unfrozen transaction ID.", "/versions/18/tables/0/rows/12/summary": "Manually set the next transaction ID.", "/versions/18/tables/0/rows/13/summary": "Manually set the default char signedness. Possible values are signed and unsigned .", "/versions/18/tables/0/rows/14/summary": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information.", "/versions/18/tables/1/columns/0/label": "Variable", "/versions/18/tables/1/columns/1/label": "Meaning", "/versions/18/tables/1/rows/0/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "862d589c18d17b071b7f9795ccd951ea72263dce7afd5d02fc868b7a7d58bbe6"}, "comparison_data": {"options": [{"names": ["-D datadir", "--pgdata= datadir"], "signature": "datadir -D datadir --pgdata= datadir", "description": "Specifies the location of the database directory. For safety reasons, you must specify the data directory on the command line. pg_resetwal does not use the environment variable PGDATA ."}, {"names": ["-f", "--force"], "signature": "-f --force", "description": "Force pg_resetwal to proceed even in situations where it could be dangerous, as explained above. Specifically, this option is required to proceed if the server had not been cleanly shut down or if pg_resetwal cannot determine valid data for pg_control ."}, {"names": ["-n", "--dry-run"], "signature": "-n --dry-run", "description": "The -n / --dry-run option instructs pg_resetwal to print the values reconstructed from pg_control and values about to be changed, and then exit without modifying anything. This is mainly a debugging tool, but can be useful as a sanity check before allowing pg_resetwal to proceed for real."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Display version information, then exit."}, {"names": ["-?", "--help"], "signature": "-? --help", "description": "Show help, then exit."}, {"names": ["-c xid , xid", "--commit-timestamp-ids= xid , xid"], "signature": "-c xid , xid --commit-timestamp-ids= xid , xid", "description": "Manually set the oldest and newest transaction IDs for which the commit time can be retrieved. A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory pg_commit_ts under the data directory. Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically greatest file name in the same directory. The file names are in hexadecimal."}, {"names": ["-e xid_epoch", "--epoch= xid_epoch"], "signature": "-e xid_epoch --epoch= xid_epoch", "description": "Manually set the next transaction ID's epoch. The transaction ID epoch is not actually stored anywhere in the database except in the field that is set by pg_resetwal , so any value will work so far as the database itself is concerned. You might need to adjust this value to ensure that replication systems such as Slony-I and Skytools work correctly \u2014 if so, an appropriate value should be obtainable from the state of the downstream replicated database."}, {"names": ["-l walfile", "--next-wal-file= walfile"], "signature": "-l walfile --next-wal-file= walfile", "description": "Manually set the WAL starting location by specifying the name of the next WAL segment file. The name of next WAL segment file should be larger than any WAL segment file name currently existing in the directory pg_wal under the data directory. These names are also in hexadecimal and have three parts. The first part is the \u201c timeline ID \u201d and should usually be kept the same. For example, if 00000001000000320000004A is the largest entry in pg_wal , use -l 00000001000000320000004B or higher. Note that when using nondefault WAL segment sizes, the numbers in the WAL file names are different from the LSNs that are reported by system functions and system views. This option takes a WAL file name, not an LSN. Note pg_resetwal itself looks at the files in pg_wal and chooses a default -l setting beyond the last existing file name. Therefore, manual adjustment of -l should only be needed if you are aware of WAL segment files that are not currently present in pg_wal , such as entries in an offline archive; or if the contents of pg_wal have been lost entirely."}, {"names": ["-m mxid , mxid", "--multixact-ids= mxid , mxid"], "signature": "-m mxid , mxid --multixact-ids= mxid , mxid", "description": "Manually set the next and oldest multitransaction ID. A safe value for the next multitransaction ID (first part) can be determined by looking for the numerically largest file name in the directory pg_multixact/offsets under the data directory, adding one, and then multiplying by 65536 (0x10000). Conversely, a safe value for the oldest multitransaction ID (second part of -m ) can be determined by looking for the numerically smallest file name in the same directory and multiplying by 65536. The file names are in hexadecimal, so the easiest way to do this is to specify the option value in hexadecimal and append four zeroes."}, {"names": ["-o oid", "--next-oid= oid"], "signature": "-o oid --next-oid= oid", "description": "Manually set the next OID. There is no comparably easy way to determine a next OID that's beyond the largest one in the database, but fortunately it is not critical to get the next-OID setting right."}, {"names": ["-O mxoff", "--multixact-offset= mxoff"], "signature": "-O mxoff --multixact-offset= mxoff", "description": "Manually set the next multitransaction offset. A safe value can be determined by looking for the numerically largest file name in the directory pg_multixact/members under the data directory, adding one, and then multiplying by 52352 (0xCC80). The file names are in hexadecimal. There is no simple recipe such as the ones for other options of appending zeroes."}, {"names": ["-u xid", "--oldest-transaction-id= xid"], "signature": "-u xid --oldest-transaction-id= xid", "description": "Manually set the oldest unfrozen transaction ID. A safe value can be determined by looking for the numerically smallest file name in the directory pg_xact under the data directory and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0007 is the smallest entry in pg_xact , -u 0x700000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["-x xid", "--next-transaction-id= xid"], "signature": "-x xid --next-transaction-id= xid", "description": "Manually set the next transaction ID. A safe value can be determined by looking for the numerically largest file name in the directory pg_xact under the data directory, adding one, and then multiplying by 1048576 (0x100000). Note that the file names are in hexadecimal. It is usually easiest to specify the option value in hexadecimal too. For example, if 0011 is the largest entry in pg_xact , -x 0x1200000 will work (five trailing zeroes provide the proper multiplier)."}, {"names": ["--char-signedness= option"], "signature": "--char-signedness= option", "description": "Manually set the default char signedness. Possible values are signed and unsigned . For a database cluster that pg_upgrade upgraded from a PostgreSQL version before 18, the safe value would be the default char signedness of the platform that ran the cluster before that upgrade. For all other clusters, signed would be the safe value. However, this option is exclusively for use with pg_upgrade and should not normally be used manually."}, {"names": ["--wal-segsize= wal_segment_size"], "signature": "--wal-segsize= wal_segment_size", "description": "Set the new WAL segment size, in megabytes. The value must be set to a power of 2 between 1 and 1024 (megabytes). See the same option of initdb for more information. This option can also be used to change the WAL segment size of an existing database cluster, avoiding the need to re- initdb . Note While pg_resetwal will set the WAL starting address beyond the latest existing WAL segment file, some segment size changes can cause previous WAL file names to be reused. It is recommended to use -l together with this option to manually set the WAL starting address if WAL file name overlap will cause problems with your archiving strategy."}], "synopsis": ["pg_resetwal [ -f | --force ] [ -n | --dry-run ] [ option ...] [ -D | --pgdata ] datadir"], "environment": [{"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}]}, "comparison_hash": "0f1118258498f92ca5f53e8e85a37fad632ff9873b0fe2ed804994c4a7ed6ca3", "manual_language": "zh"}, "comparison": {"left": "11", "right": "12", "status": "changed", "diff": "--- PostgreSQL 11\n+++ PostgreSQL 12\n@@ -1,5 +1,10 @@\n {\n-  \"environment\": [],\n+  \"environment\": [\n+    {\n+      \"description\": \"Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .\",\n+      \"name\": \"PG_COLOR\"\n+    }\n+  ],\n   \"options\": [\n     {\n       \"description\": \"Force pg_resetwal to proceed even if it cannot determine valid data for pg_control , as explained above.\","}}