gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
8.7KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>pg_checksums</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="pgarchivecleanup.html" title="pg_archivecleanup" /><link rel="next" href="app-pgcontroldata.html" title="pg_controldata" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center"><span xmlns="http://www.w3.org/1999/xhtml" class="application">pg_checksums</span></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="pgarchivecleanup.html" title="pg_archivecleanup">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="reference-server.html" title="PostgreSQL Server Applications">Up</a></td><th width="60%" align="center">PostgreSQL Server Applications</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="app-pgcontroldata.html" title="pg_controldata">Next</a></td></tr></table><hr></hr></div><div class="refentry" id="APP-PGCHECKSUMS"><div class="titlepage"></div><a id="id-1.9.5.5.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">pg_checksums</span></span></h2><p>pg_checksums — enable, disable or check data checksums in a <span class="productname">PostgreSQL</span> database cluster</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p id="id-1.9.5.5.4.1"><code class="command">pg_checksums</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></div></div><div class="refsect1" id="R1-APP-PG_CHECKSUMS-1"><h2>Description</h2><p>
  3. <span class="application">pg_checksums</span> checks, enables or disables data
  4. checksums in a <span class="productname">PostgreSQL</span> cluster. The server
  5. must be shut down cleanly before running
  6. <span class="application">pg_checksums</span>. When verifying checksums, the exit
  7. status is zero if there are no checksum errors, and nonzero if at least one
  8. checksum failure is detected. When enabling or disabling checksums, the
  9. exit status is nonzero if the operation failed.
  10. </p><p>
  11. When verifying checksums, every file in the cluster is scanned. When
  12. enabling checksums, every file in the cluster is rewritten. Disabling
  13. checksums only updates the file <code class="filename">pg_control</code>.
  14. </p></div><div class="refsect1" id="id-1.9.5.5.6"><h2>Options</h2><p>
  15. The following command-line options are available:
  16. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-D <em class="replaceable"><code>directory</code></em></code><br /></span><span class="term"><code class="option">--pgdata=<em class="replaceable"><code>directory</code></em></code></span></dt><dd><p>
  17. Specifies the directory where the database cluster is stored.
  18. </p></dd><dt><span class="term"><code class="option">-c</code><br /></span><span class="term"><code class="option">--check</code></span></dt><dd><p>
  19. Checks checksums. This is the default mode if nothing else is
  20. specified.
  21. </p></dd><dt><span class="term"><code class="option">-d</code><br /></span><span class="term"><code class="option">--disable</code></span></dt><dd><p>
  22. Disables checksums.
  23. </p></dd><dt><span class="term"><code class="option">-e</code><br /></span><span class="term"><code class="option">--enable</code></span></dt><dd><p>
  24. Enables checksums.
  25. </p></dd><dt><span class="term"><code class="option">-f <em class="replaceable"><code>filenode</code></em></code><br /></span><span class="term"><code class="option">--filenode=<em class="replaceable"><code>filenode</code></em></code></span></dt><dd><p>
  26. Only validate checksums in the relation with filenode
  27. <em class="replaceable"><code>filenode</code></em>.
  28. </p></dd><dt><span class="term"><code class="option">-N</code><br /></span><span class="term"><code class="option">--no-sync</code></span></dt><dd><p>
  29. By default, <code class="command">pg_checksums</code> will wait for all files
  30. to be written safely to disk. This option causes
  31. <code class="command">pg_checksums</code> to return without waiting, which is
  32. faster, but means that a subsequent operating system crash can leave
  33. the updated data directory corrupt. Generally, this option is useful
  34. for testing but should not be used on a production installation.
  35. This option has no effect when using <code class="literal">--check</code>.
  36. </p></dd><dt><span class="term"><code class="option">-P</code><br /></span><span class="term"><code class="option">--progress</code></span></dt><dd><p>
  37. Enable progress reporting. Turning this on will deliver a progress
  38. report while checking or enabling checksums.
  39. </p></dd><dt><span class="term"><code class="option">-v</code><br /></span><span class="term"><code class="option">--verbose</code></span></dt><dd><p>
  40. Enable verbose output. Lists all checked files.
  41. </p></dd><dt><span class="term"><code class="option">-V</code><br /></span><span class="term"><code class="option">--version</code></span></dt><dd><p>
  42. Print the <span class="application">pg_checksums</span> version and exit.
  43. </p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>
  44. Show help about <span class="application">pg_checksums</span> command line
  45. arguments, and exit.
  46. </p></dd></dl></div><p>
  47. </p></div><div class="refsect1" id="id-1.9.5.5.7"><h2>Environment</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">PGDATA</code></span></dt><dd><p>
  48. Specifies the directory where the database cluster is
  49. stored; can be overridden using the <code class="option">-D</code> option.
  50. </p></dd><dt><span class="term"><code class="envar">PG_COLOR</code></span></dt><dd><p>
  51. Specifies whether to use color in diagnostic messages. Possible values
  52. are <code class="literal">always</code>, <code class="literal">auto</code> and
  53. <code class="literal">never</code>.
  54. </p></dd></dl></div></div><div class="refsect1" id="id-1.9.5.5.8"><h2>Notes</h2><p>
  55. Enabling checksums in a large cluster can potentially take a long time.
  56. During this operation, the cluster or other programs that write to the
  57. data directory must not be started or else data loss may occur.
  58. </p><p>
  59. When using a replication setup with tools which perform direct copies
  60. of relation file blocks (for example <a class="xref" href="app-pgrewind.html" title="pg_rewind"><span class="refentrytitle"><span class="application">pg_rewind</span></span></a>),
  61. enabling or disabling checksums can lead to page corruptions in the
  62. shape of incorrect checksums if the operation is not done consistently
  63. across all nodes. When enabling or disabling checksums in a replication
  64. setup, it is thus recommended to stop all the clusters before switching
  65. them all consistently. Destroying all standbys, performing the operation
  66. on the primary and finally recreating the standbys from scratch is also
  67. safe.
  68. </p><p>
  69. If <span class="application">pg_checksums</span> is aborted or killed while
  70. enabling or disabling checksums, the cluster's data checksum configuration
  71. remains unchanged, and <span class="application">pg_checksums</span> can be
  72. re-run to perform the same operation.
  73. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="pgarchivecleanup.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-server.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="app-pgcontroldata.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="application">pg_archivecleanup</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="application">pg_controldata</span></td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1