Linux command
pg_resetwal 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Reset WAL (dry run)
pg_resetwal -n [data_dir]
Reset WAL
pg_resetwal [data_dir]
Force reset
pg_resetwal -f [data_dir]
说明
pg_resetwal resets write-ahead log and control information. Last resort recovery when WAL is corrupted. May cause data loss. Server must be stopped.
参数
- -D, --pgdata _dir_
- Data directory.
- -n, --dry-run
- Show what would be done.
- -f, --force
- Force reset.
- -e, --epoch _epoch_
- Set next transaction ID epoch.
- -x, --next-transaction-id _xid_
- Set next transaction ID.
- -o, --next-oid _oid_
- Set next OID.
- -m, --multixact-ids _mxid,mxid_
- Set next and oldest multitransaction ID.
- -O, --multixact-offset _mxoff_
- Set next multitransaction offset.
- -c, --commit-timestamp-ids _xid,xid_
- Set oldest and newest transaction IDs for commit timestamps.
- -u, --oldest-transaction-id _xid_
- Set oldest unfrozen transaction ID.
- -l, --next-wal-file _walfile_
- Force minimum WAL starting location.
- --wal-segsize _size_
- Set WAL segment size in megabytes.
FAQ
What is the pg_resetwal command used for?
pg_resetwal resets write-ahead log and control information. Last resort recovery when WAL is corrupted. May cause data loss. Server must be stopped.
How do I run a basic pg_resetwal example?
Run `pg_resetwal -n [data_dir]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -D, --pgdata _dir_ do in pg_resetwal?
Data directory.