I can't find pg_resetxlog under /usr/bin.

postgres (PostgreSQL) 10.7 (Ubuntu 10.7-1.pgdg16.04+1)

cd /usr/bin
postgres@node-1:/usr/bin$ ./pg_resetxlog
-su: ./pg_resetxlog: No such file or directory

That's because from version 10 it has been renamed to pg_resetwal. And the binary is located in /usr/lib/postgresql/<version>/bin.

The pg_xlog directory was renamed to pg_wal in version 10 and several functions, tools and options as well, to reflect that change. See Postgres 10 release notes:

  • Rename write-ahead log directory pg_xlog to pg_wal, and rename transaction status directory pg_clog to pg_xact (Michael Paquier)

    Users have occasionally thought that these directories contained only inessential log files, and proceeded to remove write-ahead log files or transaction status files manually, causing irrecoverable data loss. These name changes are intended to discourage such errors in future.

  • Rename SQL functions, tools, and options that reference xlog to wal (Robert Haas)

    For example, pg_switch_xlog() becomes pg_switch_wal(), pg_receivexlog becomes pg_receivewal, and --xlogdir becomes --waldir. This is for consistency with the change of the pg_xlog directory name; in general, the xlog terminology is no longer used in any user-facing places.

| improve this answer | |
  • It's not there. postgres@node-1:/usr/lib/postgresql/10/bin$ ls clusterdb dropdb oid2name pgbench pg_dump pg_receivewal pg_restore pg_test_fsync pg_waldump psql repmgrd createdb dropuser pg_archivecleanup pg_controldata pg_dumpall pg_recvlogical pg_rewind pg_test_timing postgres reindexdb vacuumdb createuser initdb pg_basebackup pg_ctl pg_isready pg_resetwal pg_standby pg_upgrade postmaster repmgr vacuumlo – CJ Chang Feb 19 '19 at 14:11
  • 4
    I see pg_resetwal right there. – Colin 't Hart Feb 19 '19 at 14:16
  • 1
    Haha... I need a pair of reading glasses, thx! :) – CJ Chang Feb 20 '19 at 13:54

It is in /usr/lib/postgresql/version.number/bin

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.