{"Entry":{"collection":"tool","key":"pg-basebackup","name":"pg_basebackup","aliases":["pg_basebackup"],"metadata":{"aliases":["pg_basebackup"],"category":"Client applications","content_hash":"302d5a82cb86d2c4839b7b05bdcc88d2f2057edbdaadca3380e19b05448da725","derived_content_hash":"4f689856958c65f00307983920af65ef998584b210e8a447786d9ab061a93c50","documentation_refresh":{"batch":"20261113","original_source_rev":"","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"imported_at":"2026-09-30T00:40:34.031926+08:00","name":"pg_basebackup","name_zh":"","slug":"pg-basebackup","summary":"pg_basebackup — take a base backup of a PostgreSQL cluster"}},"Definition":{"Collection":"tool","Key":"pg-basebackup","SourceDatabase":"center","Version":"18","SourceTable":"command_tool","SourceKey":"pg-basebackup","SourceRevision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","Facts":{"comparison_data":{"environment":[],"options":[{"description":"Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required.","names":["-D directory","--pgdata= directory"],"signature":"-D directory --pgdata= directory"},{"description":"Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used.","names":["-F format","--format= format"],"signature":"-F format --format= format"},{"description":"Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup.","names":["-i old_manifest_file","--incremental= old_manifest_file"],"signature":"-i old_manifest_file --incremental= old_manifest_file"},{"description":"Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication and logical replication slot synchronization will use the same settings later on. The dbname will be recorded only if the dbname was specified explicitly in the connection string or environment variable .","names":["-R","--write-recovery-conf"],"signature":"-R --write-recovery-conf"},{"description":"Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup. Since WAL streaming is implemented by pg_basebackup rather than by the server, this option cannot be used together with -Xstream . Since that is the default, when this option is specified, you must also specify either -Xfetch or -Xnone .","names":["-t target","--target= target"],"signature":"-t target --target= target"},{"description":"Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected.","names":["-T olddir = newdir","--tablespace-mapping= olddir = newdir"],"signature":"-T olddir = newdir --tablespace-mapping= olddir = newdir"},{"description":"Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.","names":["--waldir= waldir"],"signature":"--waldir= waldir"},{"description":"Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default.","names":["-X method","--wal-method= method"],"signature":"-X method --wal-method= method"},{"description":"Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.","names":["-z","--gzip"],"signature":"-z --gzip"},{"description":"Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch . The compression method can be set to gzip , lz4 , zstd , none for no compression or an integer (no compression if 0, gzip if greater than 0). A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level , long , and workers . The detail string cannot be used when the compression method is specified as a plain integer. If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0. When the tar format is used with gzip , lz4 , or zstd , the suffix .gz , .lz4 , or .zst , respectively, will be automatically added to all tar filenames. When the plain format is used, client-side compression may not be specified, but it is still possible to request server-side compression. If this is done, the server will compress the backup for transmission, and the client will decompress and extract it. When this option is used in combination with -Xstream , pg_wal.tar will be compressed using gzip if client-side gzip compression is selected, but will not be compressed if any other compression algorithm is selected, or if server-side compression is selected.","names":["-Z level","-Z [{client|server}-] method [: detail ]","--compress= level","--compress=[{client|server}-] method [: detail ]"],"signature":"-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]"},{"description":"Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 ).","names":["-c {fast|spread}","--checkpoint={fast|spread}"],"signature":"-c {fast|spread} --checkpoint={fast|spread}"},{"description":"Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.","names":["-C","--create-slot"],"signature":"-C --create-slot"},{"description":"Sets the label for the backup. If none is specified, a default value of “ pg_basebackup base backup ” will be used.","names":["-l label","--label= label"],"signature":"-l label --label= label"},{"description":"By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way.","names":["-n","--no-clean"],"signature":"-n --no-clean"},{"description":"By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.","names":["-N","--no-sync"],"signature":"-N --no-sync"},{"description":"Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.","names":["-P","--progress"],"signature":"-P --progress"},{"description":"Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch .","names":["-r rate","--max-rate= rate"],"signature":"-r rate --max-rate= rate"},{"description":"This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming.","names":["-S slotname","--slot= slotname"],"signature":"-S slotname --slot= slotname"},{"description":"When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file system that contains the backup directory. When the plain format is used, pg_basebackup will also synchronize the file systems that contain the WAL files and each tablespace. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used.","names":["--sync-method= method"],"signature":"--sync-method= method"},{"description":"Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.","names":["-v","--verbose"],"signature":"-v --verbose"},{"description":"Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC-32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest.","names":["--manifest-checksums= algorithm"],"signature":"--manifest-checksums= algorithm"},{"description":"Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.","names":["--manifest-force-encode"],"signature":"--manifest-force-encode"},{"description":"Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by estimating the total amount of data that will be streamed, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress .","names":["--no-estimate-size"],"signature":"--no-estimate-size"},{"description":"Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.","names":["--no-manifest"],"signature":"--no-manifest"},{"description":"Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup.","names":["--no-slot"],"signature":"--no-slot"},{"description":"Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view.","names":["--no-verify-checksums"],"signature":"--no-verify-checksums"},{"description":"Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. This option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name included in the connection string will be ignored by the server. However, a database name supplied that way overrides the default database name ( replication ) for purposes of looking up the replication connection's password in ~/.pgpass . Similarly, middleware or proxies used in connecting to PostgreSQL might utilize the name for purposes such as connection routing. The database name can also be used by logical replication slot synchronization .","names":["-d connstr","--dbname= connstr"],"signature":"-d connstr --dbname= connstr"},{"description":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.","names":["-h host","--host= host"],"signature":"-h host --host= host"},{"description":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.","names":["-p port","--port= port"],"signature":"-p port --port= port"},{"description":"Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.","names":["-s interval","--status-interval= interval"],"signature":"-s interval --status-interval= interval"},{"description":"Specifies the user name to connect as.","names":["-U username","--username= username"],"signature":"-U username --username= username"},{"description":"Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.","names":["-w","--no-password"],"signature":"-w --no-password"},{"description":"Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.","names":["-W","--password"],"signature":"-W --password"},{"description":"Prints the pg_basebackup version and exits.","names":["-V","--version"],"signature":"-V --version"},{"description":"Shows help about pg_basebackup command line arguments, and exits.","names":["-?","--help"],"signature":"-? --help"}],"synopsis":["pg_basebackup [ option ...]"]},"comparison_hash":"1355c21a25dc07b130a2e139c0430698018dbc37b620dff3f0f565fbaec56228","description":["pg_basebackup — take a base backup of a PostgreSQL cluster"],"description_zh":"pg_basebackup — 获取 PostgreSQL 集簇的基础备份","description_zh_html":"\u003cdiv class=\"refentry\" id=\"APP-PGBASEBACKUP\"\u003e\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\u003cdiv class=\"refnamediv\"\u003e\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003cp\u003epg_basebackup — 获取 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 集簇的基础备份\u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsynopsisdiv\"\u003e\u003ch2\u003e大纲\u003c/h2\u003e\u003cdiv class=\"cmdsynopsis\"\u003e\u003cp id=\"id-1.9.4.10.4.1\"\u003e\u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...]\u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.5\"\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 用于获取正在运行的 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 数据库集簇的基础备份。备份过程不会影响数据库的其他客户端，并且该备份既可用于时间点恢复（见\u003ca class=\"xref\" href=\"/zh/docs/18/continuous-archiving.html\" title=\"25.3. 持续归档和时间点恢复（PITR）\"\u003e第 25.3 节\u003c/a\u003e），也可用作日志传送或流复制备库的起点（见\u003ca class=\"xref\" href=\"/zh/docs/18/warm-standby.html\" title=\"26.2. 日志传送备库\"\u003e第 26.2 节\u003c/a\u003e）。\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 既可以执行完整基础备份，也可以执行增量基础备份。执行完整备份时，它会精确复制数据库集簇的文件。执行增量备份时，原本会包含在完整备份中的某些文件，可能会被这些文件的增量版本替代，其中仅包含自参考备份以来被修改过的块。增量备份不能直接使用；必须先使用 \u003ca class=\"xref\" href=\"/zh/docs/18/app-pgcombinebackup.html\" title=\"pg_combinebackup\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_combinebackup\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e 将其与它所依赖的先前备份合并。关于增量备份的更多信息，见\u003ca class=\"xref\" href=\"/zh/docs/18/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" title=\"25.3.3. 进行增量备份\"\u003e第 25.3.3 节\u003c/a\u003e；关于从备份恢复的步骤，见\u003ca class=\"xref\" href=\"/zh/docs/18/continuous-archiving.html#BACKUP-PITR-RECOVERY\" title=\"25.3.5. 使用持续归档备份进行恢复\"\u003e第 25.3.5 节\u003c/a\u003e。\n  \u003c/p\u003e\u003cp\u003e\n   在任何模式下，\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 都会确保服务器自动进入和退出备份模式。备份始终针对整个数据库集簇；不可能只备份单个数据库或数据库对象。对于选择性备份，必须使用诸如 \u003ca class=\"xref\" href=\"/zh/docs/18/app-pgdump.html\" title=\"pg_dump\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e 之类的其他工具。\n  \u003c/p\u003e\u003cp\u003e\n   备份是通过一个使用复制协议的常规 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 连接进行的。建立该连接所使用的用户 ID 必须具有 \u003ccode class=\"literal\"\u003eREPLICATION\u003c/code\u003e 权限（见\u003ca class=\"xref\" href=\"/zh/docs/18/role-attributes.html\" title=\"21.2. 角色属性\"\u003e第 21.2 节\u003c/a\u003e），或者是超级用户，并且 \u003ca class=\"link\" href=\"/zh/docs/18/auth-pg-hba-conf.html\" title=\"20.1. pg_hba.conf 文件\"\u003e\u003ccode class=\"filename\"\u003epg_hba.conf\u003c/code\u003e\u003c/a\u003e 必须允许该复制连接。服务器还必须将 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\"\u003emax_wal_senders\u003c/a\u003e 设置得足够高，以便至少提供一个用于备份的 WAL 发送进程，并在使用 WAL 流式传输时再提供一个 WAL 发送进程。\n  \u003c/p\u003e\u003cp\u003e\n   可以同时运行多个 \u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e，但从性能角度来看，通常最好只执行一次备份，然后复制其结果。\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 不仅可以从主库获取基础备份，也可以从备库获取。要从备库获取备份，需要将备库配置为能够接受复制连接（即设置 \u003ccode class=\"varname\"\u003emax_wal_senders\u003c/code\u003e 和 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-replication.html#GUC-HOT-STANDBY\"\u003ehot_standby\u003c/a\u003e，并适当地配置其 \u003ccode class=\"filename\"\u003epg_hba.conf\u003c/code\u003e）。还需要在主库上启用 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-wal.html#GUC-FULL-PAGE-WRITES\"\u003efull_page_writes\u003c/a\u003e。\n  \u003c/p\u003e\u003cp\u003e\n   请注意，从备库获取备份存在一些限制：\n\n   \u003c/p\u003e\u003cdiv class=\"itemizedlist\"\u003e\u003cul class=\"itemizedlist\" style=\"list-style-type: disc; \"\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n      备份历史文件不会在被备份的数据库集簇中创建。\n     \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 无法强制备库在备份结束时切换到新的 WAL 文件。当使用 \u003ccode class=\"literal\"\u003e-X none\u003c/code\u003e 时，如果主库上的写入活动较少，\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 可能需要长时间等待，直到备份所需的最后一个 WAL 文件被切换并归档。在这种情况下，可以在主库上运行 \u003ccode class=\"function\"\u003epg_switch_wal\u003c/code\u003e，以立即触发 WAL 文件切换。\n     \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n      如果备库在备份过程中被提升为主库，则备份会失败。\n     \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n      备份所需的所有 WAL 记录都必须包含足够的整页写入，因此必须在主库上启用 \u003ccode class=\"varname\"\u003efull_page_writes\u003c/code\u003e。\n     \u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   每当 \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 执行基础备份时，服务器的 \u003ccode class=\"structname\"\u003epg_stat_progress_basebackup\u003c/code\u003e 视图都会报告备份进度。详见\u003ca class=\"xref\" href=\"/zh/docs/18/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.6. 基础备份进度报告\"\u003e第 27.4.6 节\u003c/a\u003e。\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.6\"\u003e\u003ch2\u003e选项\u003c/h2\u003e\u003cp\u003e\n    以下命令行选项控制输出的位置和格式：\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-2\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-D \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--pgdata=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置写入输出的目标目录。如果该目录不存在，\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 会创建它（以及所有缺失的父目录）。如果该目录已经存在，则必须为空。\n       \u003c/p\u003e\u003cp\u003e\n        当备份采用 tar 格式时，目标目录可以指定为\u003ccode class=\"literal\"\u003e-\u003c/code\u003e（短横线），从而将 tar 文件写到 \u003ccode class=\"literal\"\u003estdout\u003c/code\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        此选项是必需的。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-3\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-F \u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--format=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        选择输出格式。\u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e 可以是以下值之一：\n\n        \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-6\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ep\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eplain\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            将输出写为普通文件，其布局与源服务器的数据目录和表空间相同。当集簇没有额外表空间时，整个数据库都会放在目标目录中。如果集簇包含额外表空间，则主数据目录会放在目标目录中，而其他所有表空间都会放在与源服务器上相同的绝对路径中。（如需改变这一点，见 \u003ccode class=\"option\"\u003e--tablespace-mapping\u003c/code\u003e。）\n           \u003c/p\u003e\u003cp\u003e\n            这是默认格式。\n           \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-7\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003et\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003etar\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            将输出写为目标目录中的 tar 文件。主数据目录的内容会写入名为 \u003ccode class=\"filename\"\u003ebase.tar\u003c/code\u003e 的文件中，而每个其他表空间都会写入一个以该表空间 OID 命名的独立 tar 文件中。\n           \u003c/p\u003e\u003cp\u003e\n            如果目标目录指定为\u003ccode class=\"literal\"\u003e-\u003c/code\u003e（短横线），tar 内容将写入标准输出，适合通过管道传给例如 \u003cspan class=\"productname\"\u003egzip\u003c/span\u003e。只有当集簇没有额外表空间且未使用 WAL 流式传输时，才允许这样做。\n           \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-8\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-i \u003cem class=\"replaceable\"\u003e\u003ccode\u003eold_manifest_file\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--incremental=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eold_manifest_file\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        执行\u003ca class=\"link\" href=\"/zh/docs/18/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" title=\"25.3.3. 进行增量备份\"\u003e增量备份\u003c/a\u003e。必须提供参考备份的备份清单；该文件将被上传到服务器，随后服务器会返回所请求的增量备份。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-9\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-R\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--write-recovery-conf\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        创建 \u003ca class=\"link\" href=\"/zh/docs/18/warm-standby.html#FILE-STANDBY-SIGNAL\"\u003e\u003ccode class=\"filename\"\u003estandby.signal\u003c/code\u003e\u003c/a\u003e\n文件，并将连接设置追加到目标目录中的 \u003ccode class=\"filename\"\u003epostgresql.auto.conf\u003c/code\u003e 文件中（如果使用 tar 格式，则追加到基础归档文件内）。这样可以更方便地利用备份结果搭建备库。\n       \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"filename\"\u003epostgresql.auto.conf\u003c/code\u003e 文件将记录连接设置，以及（如果指定）\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 正在使用的复制槽，以便后续的流复制和\u003ca class=\"link\" href=\"/zh/docs/18/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3. 复制槽同步\"\u003e逻辑复制槽同步\u003c/a\u003e使用相同的设置。只有当 dbname 在连接字符串或\u003ca class=\"link\" href=\"/zh/docs/18/libpq-envars.html\" title=\"32.15. 环境变量\"\u003e环境变量\u003c/a\u003e中被显式指定时，才会记录 dbname。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-10\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t \u003cem class=\"replaceable\"\u003e\u003ccode\u003etarget\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--target=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etarget\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指示服务器将基础备份放到哪里。默认目标是 \u003ccode class=\"literal\"\u003eclient\u003c/code\u003e，表示备份应发送到运行 \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 的那台机器。如果目标改为 \u003ccode class=\"literal\"\u003eserver:/some/path\u003c/code\u003e，则备份会存储在服务器运行所在机器的 \u003ccode class=\"literal\"\u003e/some/path\u003c/code\u003e 目录中。将备份存储在服务器上需要超级用户权限，或拥有 \u003ccode class=\"literal\"\u003epg_write_server_files\u003c/code\u003e 角色的权限。如果目标设置为 \u003ccode class=\"literal\"\u003eblackhole\u003c/code\u003e，则内容会被丢弃，不会存储到任何地方。这只应用于测试目的，因为最终不会得到实际备份。\n       \u003c/p\u003e\u003cp\u003e\n        由于 WAL 流式传输是由 \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 而不是服务器实现的，因此此选项不能与 \u003ccode class=\"literal\"\u003e-Xstream\u003c/code\u003e 一起使用。由于后者是默认值，所以指定此选项时，还必须同时指定 \u003ccode class=\"literal\"\u003e-Xfetch\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003e-Xnone\u003c/code\u003e 之一。\n\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-11\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-T \u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--tablespace-mapping=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        在备份期间，将目录 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e 中的表空间重定位到 \u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e。要使此选项生效，\u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e 必须与源服务器上定义的该表空间路径完全一致。（但如果源服务器上在 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e 中没有表空间，也不算错误。）与此同时，\u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e 是接收主机文件系统中的一个目录。与主目标目录一样，\u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e 不必事先存在，但如果存在则必须为空。\u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e 和 \u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e 都必须是绝对路径。如果任一路径中需要包含等号（\u003ccode class=\"literal\"\u003e=\u003c/code\u003e），请在其前面加上反斜杠。可以多次指定此选项，以处理多个表空间。\n       \u003c/p\u003e\u003cp\u003e\n        如果以这种方式重定位表空间，主数据目录中的符号链接将被更新为指向新位置。因此，新数据目录已可直接用于启动一个所有表空间都位于更新后位置的新服务器实例。\n       \u003c/p\u003e\u003cp\u003e\n        目前，此选项仅适用于普通文件输出格式；如果选择了 tar 格式，则会被忽略。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-12\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--waldir=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ewaldir\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置写入 WAL（预写式日志）文件的目录。默认情况下，WAL 文件会放在目标目录的 \u003ccode class=\"filename\"\u003epg_wal\u003c/code\u003e 子目录中，但此选项可用于将其放在其他位置。\u003cem class=\"replaceable\"\u003e\u003ccode\u003ewaldir\u003c/code\u003e\u003c/em\u003e 必须是绝对路径。与主目标目录一样，\u003cem class=\"replaceable\"\u003e\u003ccode\u003ewaldir\u003c/code\u003e\u003c/em\u003e 不必事先存在，但如果存在则必须为空。只有当备份采用普通文件格式时，才能指定此选项。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-13\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-X \u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--wal-method=\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        在备份中包含所需的 WAL（预写式日志）文件。这将包括备份期间生成的所有预写式日志。除非指定方法 \u003ccode class=\"literal\"\u003enone\u003c/code\u003e，否则就可以在目标目录中启动 postmaster，而无需查阅 WAL 归档，从而使输出成为一个完全独立的备份。\n       \u003c/p\u003e\u003cp\u003e\n        支持以下用于收集预写式日志的 \u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e 值：\n\n        \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-17\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003en\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003enone\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            不在备份中包含预写式日志。\n           \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-18\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ef\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003efetch\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            在备份结束时收集预写式日志文件。因此，源服务器的 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-replication.html#GUC-WAL-KEEP-SIZE\"\u003ewal_keep_size\u003c/a\u003e 参数必须设置得足够高，以确保在备份结束前不会移除所需的日志数据。如果在传输这些数据之前它们已经被回收，则备份会失败并且无法使用。\n           \u003c/p\u003e\u003cp\u003e\n            当使用 tar 格式时，预写式日志文件会包含在 \u003ccode class=\"filename\"\u003ebase.tar\u003c/code\u003e 文件中。\n           \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-19\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003es\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003estream\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            在执行备份的同时流式传输预写式日志数据。此方法会向服务器打开第二个连接，并在执行备份时并行开始流式传输预写式日志。因此，它需要两个复制连接，而不只是一个。只要客户端能够跟上预写式日志数据，使用此方法就不需要在源服务器上额外保留预写式日志。\n           \u003c/p\u003e\u003cp\u003e\n            当使用 tar 格式时，预写式日志文件会写入一个名为 \u003ccode class=\"filename\"\u003epg_wal.tar\u003c/code\u003e 的独立文件中（如果服务器版本早于 10，则文件名为 \u003ccode class=\"filename\"\u003epg_xlog.tar\u003c/code\u003e）。\n           \u003c/p\u003e\u003cp\u003e\n            这是默认值。\n           \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-20\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-z\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--gzip\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        启用 tar 文件输出的 gzip 压缩，使用默认压缩级别。压缩仅在使用 tar 格式时可用，并且所有 tar 文件名都会自动添加\u003ccode class=\"filename\"\u003e.gz\u003c/code\u003e 后缀。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-21\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-Z \u003cem class=\"replaceable\"\u003e\u003ccode\u003elevel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-Z [{client|server}-]\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e[:\u003cem class=\"replaceable\"\u003e\u003ccode\u003edetail\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--compress=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elevel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--compress=[{client|server}-]\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e[:\u003cem class=\"replaceable\"\u003e\u003ccode\u003edetail\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        请求对备份进行压缩。如果包含 \u003ccode class=\"literal\"\u003eclient\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003eserver\u003c/code\u003e，则指定压缩执行的位置。在服务器端压缩会减少传输带宽占用，但会增加服务器 CPU 消耗。默认值是 \u003ccode class=\"literal\"\u003eclient\u003c/code\u003e，但使用 \u003ccode class=\"literal\"\u003e--target\u003c/code\u003e 时除外；此时备份不会发送到客户端，因此只有服务器端压缩才有意义。使用默认的 \u003ccode class=\"literal\"\u003e-Xstream\u003c/code\u003e 时，服务器端压缩不会应用于 WAL。若要压缩 WAL，请使用客户端压缩，或者指定 \u003ccode class=\"literal\"\u003e-Xfetch\u003c/code\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        压缩方法可以设置为 \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e、\u003ccode class=\"literal\"\u003elz4\u003c/code\u003e、\u003ccode class=\"literal\"\u003ezstd\u003c/code\u003e、\u003ccode class=\"literal\"\u003enone\u003c/code\u003e（不压缩），也可以直接指定一个整数（0 表示不压缩，大于 0 表示 \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e）。还可以选择性地指定压缩细节字符串。如果细节字符串是整数，则表示压缩级别；否则，它应为逗号分隔的项目列表，每项的形式为 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekeyword\u003c/code\u003e\u003c/em\u003e 或 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekeyword=value\u003c/code\u003e\u003c/em\u003e。目前支持的关键字有 \u003ccode class=\"literal\"\u003elevel\u003c/code\u003e、\u003ccode class=\"literal\"\u003elong\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003eworkers\u003c/code\u003e。当压缩方法以纯整数形式指定时，不能再使用细节字符串。\n       \u003c/p\u003e\u003cp\u003e\n        如果未指定压缩级别，则使用默认压缩级别。如果只指定了级别而未指定算法，那么级别大于 0 时使用 \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e 压缩，级别为 0 时则不压缩。\n       \u003c/p\u003e\u003cp\u003e\n        当 tar 格式配合 \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e、\u003ccode class=\"literal\"\u003elz4\u003c/code\u003e 或 \u003ccode class=\"literal\"\u003ezstd\u003c/code\u003e 使用时，所有 tar 文件名都会分别自动加上\u003ccode class=\"filename\"\u003e.gz\u003c/code\u003e、\u003ccode class=\"filename\"\u003e.lz4\u003c/code\u003e 或\u003ccode class=\"filename\"\u003e.zst\u003c/code\u003e 后缀。使用普通文件格式时，不能指定客户端压缩，但仍可以请求服务器端压缩。这样做时，服务器会先压缩备份再传输，而客户端会对其进行解压并提取。\n       \u003c/p\u003e\u003cp\u003e\n        当此选项与 \u003ccode class=\"literal\"\u003e-Xstream\u003c/code\u003e 组合使用时，如果选择了客户端 gzip 压缩，则 \u003ccode class=\"literal\"\u003epg_wal.tar\u003c/code\u003e 会使用 \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e 压缩；但如果选择了其他压缩算法，或者选择了服务器端压缩，则不会被压缩。\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    以下命令行选项控制备份的生成和程序的调用：\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-23\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c {fast|spread}\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--checkpoint={fast|spread}\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        将检查点模式设置为 fast（立即）或 spread（默认）（见\u003ca class=\"xref\" href=\"/zh/docs/18/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP\" title=\"25.3.4. 使用低级 API 进行基础备份\"\u003e第 25.3.4 节\u003c/a\u003e）。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-24\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-C\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定在开始备份之前，应创建由 \u003ccode class=\"literal\"\u003e--slot\u003c/code\u003e 选项指定名称的复制槽。如果该槽已经存在，则会报错。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-25\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l \u003cem class=\"replaceable\"\u003e\u003ccode\u003elabel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--label=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elabel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置备份标签。如果未指定，则使用默认值\u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e\u003ccode class=\"literal\"\u003epg_basebackup base backup\u003c/code\u003e\u003c/span\u003e”\u003c/span\u003e。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-26\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-n\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-clean\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        默认情况下，当 \u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e 因错误中止时，它会删除在发现自己无法完成任务之前可能已创建的所有目录（例如目标目录和预写式日志目录）。此选项会禁止这种清理，因此对调试很有帮助。\n       \u003c/p\u003e\u003cp\u003e\n        请注意，无论是否使用此选项，表空间目录都不会被清理。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-27\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-N\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        默认情况下，\u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e 会等待所有文件都被安全写入磁盘。此选项会使 \u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e 不经等待就直接返回，因此速度更快，但这意味着如果随后操作系统崩溃，基础备份可能会损坏。通常，此选项适合测试，但不应用于创建生产环境安装。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-28\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-P\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--progress\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        启用进度报告。打开此选项后，会在备份过程中给出一个近似的进度报告。由于数据库在备份过程中可能发生变化，因此这只是近似值，最终未必恰好结束在 \u003ccode class=\"literal\"\u003e100%\u003c/code\u003e。特别是当备份中包含 WAL 时，总数据量无法预先估计；在这种情况下，一旦进度超过不含 WAL 时的总估计值，估计目标大小就会继续增加。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-29\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-r \u003cem class=\"replaceable\"\u003e\u003ccode\u003erate\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--max-rate=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erate\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置从源服务器收集数据时允许的最大传输速率。这有助于限制 \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 对服务器的影响。取值单位为每秒千字节。使用后缀 \u003ccode class=\"literal\"\u003eM\u003c/code\u003e 表示每秒兆字节。也接受后缀 \u003ccode class=\"literal\"\u003ek\u003c/code\u003e，但没有实际影响。有效取值范围为每秒 32 千字节到每秒 1024 兆字节。\n       \u003c/p\u003e\u003cp\u003e\n        此选项始终影响数据目录的传输。只有当收集方法为 \u003ccode class=\"literal\"\u003efetch\u003c/code\u003e 时，WAL 文件的传输才会受到影响。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-30\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S \u003cem class=\"replaceable\"\u003e\u003ccode\u003eslotname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--slot=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eslotname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        此选项只能与 \u003ccode class=\"literal\"\u003e-X stream\u003c/code\u003e 一起使用。它会使 WAL 流式传输使用指定的复制槽。如果此基础备份打算用作使用复制槽的流复制备库，那么该备库应将同一个复制槽名称用作 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME\"\u003eprimary_slot_name\u003c/a\u003e 的值。这样可以确保主库在基础备份结束与新备库开始流复制之间的这段时间内，不会移除任何必需的 WAL 数据。\n       \u003c/p\u003e\u003cp\u003e\n        指定的复制槽必须已经存在，除非还同时使用了 \u003ccode class=\"option\"\u003e-C\u003c/code\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        如果未指定此选项，并且服务器支持临时复制槽（10 及以上版本），则会自动使用临时复制槽进行 WAL 流式传输。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-31\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--sync-method=\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        设置为 \u003ccode class=\"literal\"\u003efsync\u003c/code\u003e（默认）时，\u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e 会递归打开并同步备份目录中的所有文件。使用普通文件格式时，查找文件会跟随 WAL 目录和各已配置表空间的符号链接。\n       \u003c/p\u003e\u003cp\u003e\n        在 Linux 上，也可以使用 \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e，让操作系统同步包含备份目录的整个文件系统。使用普通文件格式时，\u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e 还会同步包含 WAL 文件和各表空间的文件系统。关于使用 \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e 时需要注意的事项，见 \u003ca class=\"xref\" href=\"/zh/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\"\u003erecovery_init_sync_method\u003c/a\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        使用 \u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e 时，此选项无效。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-32\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--verbose\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        启用详细模式。它会在启动和关闭过程中输出一些额外步骤；如果同时启用了进度报告，还会显示当前正在处理的确切文件名。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-33\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--manifest-checksums=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ealgorithm\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定应用到备份清单中每个文件的校验和算法。目前可用的算法有 \u003ccode class=\"literal\"\u003eNONE\u003c/code\u003e、\u003ccode class=\"literal\"\u003eCRC32C\u003c/code\u003e、\u003ccode class=\"literal\"\u003eSHA224\u003c/code\u003e、\u003ccode class=\"literal\"\u003eSHA256\u003c/code\u003e、\u003ccode class=\"literal\"\u003eSHA384\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003eSHA512\u003c/code\u003e。默认值为 \u003ccode class=\"literal\"\u003eCRC32C\u003c/code\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        如果选择 \u003ccode class=\"literal\"\u003eNONE\u003c/code\u003e，备份清单将不包含任何校验和。否则，它将包含使用指定算法为备份中每个文件计算的校验和。此外，清单始终会包含其自身内容的 \u003ccode class=\"literal\"\u003eSHA256\u003c/code\u003e 校验和。\u003ccode class=\"literal\"\u003eSHA\u003c/code\u003e 算法明显比 \u003ccode class=\"literal\"\u003eCRC32C\u003c/code\u003e 更耗费 CPU，因此选择其中一种可能会增加完成备份所需的时间。\n       \u003c/p\u003e\u003cp\u003e\n        对于希望验证备份未被篡改的用户，使用 SHA hash 函数可以为每个文件提供具有密码学安全性的摘要；而 CRC-32C 算法提供的校验和计算速度要快得多，虽然它很适合发现由于意外改动造成的错误，但并不能抵御恶意修改。请注意，要想对能够访问备份的攻击者形成防护，备份清单就需要安全地保存在其他地方，或者以其他方式确认自备份完成后未被修改。\n       \u003c/p\u003e\u003cp\u003e\n        可以使用 \u003ca class=\"xref\" href=\"/zh/docs/18/app-pgverifybackup.html\" title=\"pg_verifybackup\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_verifybackup\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e 根据备份清单检查备份的完整性。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-34\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--manifest-force-encode\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        强制将备份清单中的所有文件名编码为十六进制。如果未指定此选项，则只对非 UTF8 文件名进行十六进制编码。此选项主要用于测试读取备份清单文件的工具是否能正确处理这种情况。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-35\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-estimate-size\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        阻止服务器估算将要流式传输的备份数据总量，因此 \u003ccode class=\"structname\"\u003epg_stat_progress_basebackup\u003c/code\u003e 视图中的 \u003ccode class=\"structfield\"\u003ebackup_total\u003c/code\u003e 列将始终为 \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        如果不使用此选项，备份会先估算将被流式传输的数据总量，然后再回过头来发送实际内容。这可能会让备份耗时略长，特别是在发送第一批数据之前所需时间会更久。如果这种估算耗时过长，此选项就很有用，因为它可以避免这段估算时间。\n       \u003c/p\u003e\u003cp\u003e\n        使用 \u003ccode class=\"option\"\u003e--progress\u003c/code\u003e 时，不允许使用此选项。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-36\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-manifest\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        禁止生成备份清单。如果未指定此选项，服务器将生成并发送一个备份清单，可使用 \u003ca class=\"xref\" href=\"/zh/docs/18/app-pgverifybackup.html\" title=\"pg_verifybackup\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_verifybackup\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e 进行验证。该清单列出了备份中的每一个文件，但不包括可能包含在其中的任何 WAL 文件。它还会保存每个文件的大小、最后修改时间以及可选的校验和。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-37\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-slot\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        防止为备份创建临时复制槽。\n       \u003c/p\u003e\u003cp\u003e\n        默认情况下，如果选择了 WAL 流式传输，但没有使用 \u003ccode class=\"option\"\u003e-S\u003c/code\u003e 选项给出槽名，那么会创建一个临时复制槽（如果源服务器支持）。\n       \u003c/p\u003e\u003cp\u003e\n        此选项的主要目的是在服务器没有空闲复制槽时，仍然允许执行基础备份。几乎总是首选使用复制槽，因为它能防止服务器在备份期间移除所需的 WAL。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-38\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-verify-checksums\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        如果获取基础备份的服务器启用了校验和，则禁用对这些校验和的验证。\n       \u003c/p\u003e\u003cp\u003e\n        默认情况下，会验证校验和；校验和验证失败将导致非零退出状态。不过，在这种情况下，基础备份不会被删除，就像使用了 \u003ccode class=\"option\"\u003e--no-clean\u003c/code\u003e 一样。校验和验证失败也会在 \u003ca class=\"link\" href=\"/zh/docs/18/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.17. pg_stat_database\"\u003e\u003ccode class=\"structname\"\u003epg_stat_database\u003c/code\u003e\u003c/a\u003e 视图中报告。\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    以下命令行选项控制到源服务器的连接：\n\n   \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-46\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003econnstr\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--dbname=\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnstr\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        以\u003ca class=\"link\" href=\"/zh/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. 连接字符串\"\u003e连接字符串\u003c/a\u003e的形式指定用于连接服务器的参数；这些参数会覆盖任何相互冲突的命令行选项。\n       \u003c/p\u003e\u003cp\u003e\n        出于与其他客户端应用保持一致的考虑，此选项名为 \u003ccode class=\"literal\"\u003e--dbname\u003c/code\u003e；但由于 \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 并不连接到集簇中的某个特定数据库，连接字符串中包含的数据库名会被服务器忽略。不过，以这种方式提供的数据库名会覆盖默认数据库名（\u003ccode class=\"literal\"\u003ereplication\u003c/code\u003e），从而用于在 \u003ccode class=\"filename\"\u003e~/.pgpass\u003c/code\u003e 中查找复制连接的密码。类似地，连接 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 时使用的中间件或代理，也可能出于连接路由等目的使用该名称。该数据库名也可供\u003ca class=\"link\" href=\"/zh/docs/18/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3. 复制槽同步\"\u003e逻辑复制槽同步\u003c/a\u003e使用。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-47\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定服务器运行所在机器的主机名。如果该值以斜线开头，则它会被用作 Unix 域套接字的目录。默认值取自 \u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e 环境变量（如果已设置）；否则会尝试使用 Unix 域套接字连接。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-48\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定服务器监听连接所使用的 TCP 端口，或本地 Unix 域套接字文件扩展名。默认使用 \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e 环境变量中的值（如果已设置），否则使用编译时确定的默认值。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-49\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s \u003cem class=\"replaceable\"\u003e\u003ccode\u003einterval\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--status-interval=\u003cem class=\"replaceable\"\u003e\u003ccode\u003einterval\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定发送回源服务器的状态包之间相隔的秒数。较小的值可以让服务器端对备份进度的监控更精确。值为零时会完全禁用周期性状态更新，不过当服务器请求时仍会发送更新，以避免因超时而断开连接。默认值是 10 秒。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-50\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        指定连接时使用的用户名。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-51\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        禁止发出密码提示。如果服务器要求密码认证，而又无法通过其他方式（例如\u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e 文件）获得密码，则连接尝试将失败。此选项对于批处理作业和脚本很有用，因为那种场景下通常没有用户在场输入密码。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-52\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        强制 \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 在连接源服务器之前提示输入密码。\n       \u003c/p\u003e\u003cp\u003e\n        此选项绝非必需，因为如果服务器要求密码认证，\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 会自动提示输入密码。不过，\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 会浪费一次连接尝试来发现服务器需要密码。在某些情况下，输入 \u003ccode class=\"option\"\u003e-W\u003c/code\u003e 以避免额外的连接尝试是值得的。\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    其他选项也可用：\n\n   \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-55\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       输出 \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 的版本并退出。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-PG_BASEBACKUP-VARLISTENTRY-56\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr/\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       显示 \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 命令行参数的帮助并退出。\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.7\"\u003e\u003ch2\u003e环境\u003c/h2\u003e\u003cp\u003e\n   与大多数其他 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 工具一样，此工具也使用 \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e 支持的环境变量（见\u003ca class=\"xref\" href=\"/zh/docs/18/libpq-envars.html\" title=\"32.15. 环境变量\"\u003e第 32.15 节\u003c/a\u003e）。\n  \u003c/p\u003e\u003cp\u003e\n   环境变量 \u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e 指定是否在诊断消息中使用颜色。可能的值为 \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e、\u003ccode class=\"literal\"\u003eauto\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003enever\u003c/code\u003e。\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.8\"\u003e\u003ch2\u003e注解\u003c/h2\u003e\u003cp\u003e\n   在备份开始时，需要在源服务器上执行一次检查点。这可能需要一些时间（尤其是在未使用 \u003ccode class=\"literal\"\u003e--checkpoint=fast\u003c/code\u003e 选项时）；在此期间，\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 看起来会处于空闲状态。\n  \u003c/p\u003e\u003cp\u003e\n   备份将包括数据目录和表空间中的所有文件，包括配置文件以及第三方放在这些目录中的任何额外文件，但由 PostgreSQL 管理的某些临时文件和操作系统文件除外。不过，只有普通文件和目录会被复制，但用于表空间的符号链接会被保留。指向 PostgreSQL 已知的某些目录的符号链接会被复制为空目录。其他符号链接和特殊设备文件则会被跳过。具体细节见\u003ca class=\"xref\" href=\"/zh/docs/18/protocol-replication.html\" title=\"54.4. 流复制协议\"\u003e第 54.4 节\u003c/a\u003e。\n\u003c/p\u003e\u003cp\u003e\n   在普通文件格式中，除非使用了 \u003ccode class=\"literal\"\u003e--tablespace-mapping\u003c/code\u003e 选项，否则表空间会备份到其在源服务器上的相同路径。如果不使用此选项，那么当表空间正在使用时，就无法在与服务器相同的主机上执行普通文件格式的基础备份，因为备份将不得不写入与原始表空间相同的目录位置。\n  \u003c/p\u003e\u003cp\u003e\n   使用 tar 格式时，用户有责任在启动使用这些数据的 PostgreSQL 服务器之前解压每一个 tar 文件。如果存在额外表空间，则这些表空间对应的 tar 文件必须解压到正确的位置。在这种情况下，服务器会根据包含在 \u003ccode class=\"filename\"\u003ebase.tar\u003c/code\u003e 文件中的 \u003ccode class=\"filename\"\u003etablespace_map\u003c/code\u003e 文件内容，为这些表空间创建符号链接。\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 可以与相同主版本或更低主版本的服务器配合工作，最低支持到 9.1。不过，WAL 流式传输模式（\u003ccode class=\"literal\"\u003e-X stream\u003c/code\u003e）仅适用于 9.3 及以上版本服务器，tar 格式（\u003ccode class=\"literal\"\u003e--format=tar\u003c/code\u003e）仅适用于 9.5 及以上版本服务器，而增量备份（\u003ccode class=\"literal\"\u003e--incremental\u003c/code\u003e）仅适用于 17 及以上版本服务器。\n  \u003c/p\u003e\u003cp\u003e\n   如果源集簇启用了数据文件的组权限，\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e 会保留这些组权限。\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.9\"\u003e\u003ch2\u003e示例\u003c/h2\u003e\u003cp\u003e\n   要为服务器 \u003ccode class=\"literal\"\u003emydbserver\u003c/code\u003e 创建一个基础备份，并将其存储到本地目录 \u003ccode class=\"filename\"\u003e/usr/local/pgsql/data\u003c/code\u003e 中：\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_basebackup -h mydbserver -D /usr/local/pgsql/data\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   要为本地服务器创建一个备份，为每个表空间各生成一个压缩的 tar 文件，并将其存储在目录 \u003ccode class=\"filename\"\u003ebackup\u003c/code\u003e 中，同时在运行期间显示进度报告：\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_basebackup -D backup -Ft -z -P\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   要为一个仅包含单个表空间的本地数据库创建备份，并使用 \u003cspan class=\"productname\"\u003ebzip2\u003c/span\u003e 进行压缩：\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_basebackup -D - -Ft -X fetch | bzip2 \u0026gt; backup.tar.bz2\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n   （如果该数据库中有多个表空间，此命令将失败。）\n  \u003c/p\u003e\u003cp\u003e\n   要创建一个本地数据库的备份，并将位于 \u003ccode class=\"filename\"\u003e/opt/ts\u003c/code\u003e 中的表空间重定位到\u003ccode class=\"filename\"\u003e./backup/ts\u003c/code\u003e：\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n   要为本地服务器创建一个备份，为每个表空间生成一个 tar 文件，并使用 \u003cspan class=\"application\"\u003egzip\u003c/span\u003e 以 9 级压缩后存储到目录 \u003ccode class=\"filename\"\u003ebackup\u003c/code\u003e 中：\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\n\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_basebackup -D backup -Ft --compress=gzip:9\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.10\"\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/zh/docs/18/app-pgdump.html\" title=\"pg_dump\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.6. 基础备份进度报告\"\u003e第 27.4.6 节\u003c/a\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e","documentation_revision":{"inputs":[{"file":"app-pgbasebackup.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"13cb927aa7152bd5ba5f51e656a401efc7b7f8d75936c10747b7d9b100fa7a45","version":"18.7"},{"file":"reference-client.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"a1c669b9a6dab81388171b696e61109033d96d2c4d5487219c77f62f14aecfa1","version":"18.7"},{"file":"app-pgbasebackup.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"4812551eeb9b21c78166a68e4bca76fd4c2174d986abbc2637a169b113e2bcb4","version":"18.7"},{"file":"reference-client.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"819e1b59b1a011bdaaff0c7cb9162348de1d0b34988a56179dc7ef1fee696a5a","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"},"environment":[],"facts":[{"label":"Documented executable","value":"pg_basebackup"},{"label":"Executable version","value":"18.7"},{"label":"Reference inventory","value":"Client applications"},{"label":"Option definition groups","value":"35"}],"facts_zh":[{"label":"手册中的可执行程序","value":"pg_basebackup"},{"label":"程序版本","value":"18.7"},{"label":"参考清单","value":"客户端程序"},{"label":"选项定义组","value":"35"}],"localization":{"documentation_release":"18.7","language":"en","source_language":"en","source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552","status":"same-version-reviewed-manual"},"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-PGBASEBACKUP\"\u003e\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\u003cdiv class=\"refnamediv\"\u003e\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003cp\u003epg_basebackup — take a base backup of a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e cluster\u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsynopsisdiv\"\u003e\u003ch2\u003eSynopsis\u003c/h2\u003e\u003cdiv class=\"cmdsynopsis\"\u003e\u003cp id=\"id-1.9.4.10.4.1\"\u003e\u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...]\u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.5\"\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e is used to take a base backup of\n   a running \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database cluster. The backup\n   is taken without affecting other clients of the database, and can be used\n   both for point-in-time recovery (see \u003ca class=\"xref\" href=\"/docs/18/continuous-archiving.html\" title=\"25.3. Continuous Archiving and Point-in-Time Recovery (PITR)\"\u003eSection 25.3\u003c/a\u003e)\n   and as the starting point for a log-shipping or streaming-replication standby\n   server (see \u003ca class=\"xref\" href=\"/docs/18/warm-standby.html\" title=\"26.2. Log-Shipping Standby Servers\"\u003eSection 26.2\u003c/a\u003e).\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e can take a full or incremental\n   base backup of the database. When used to take a full backup, it makes an\n   exact copy of the database cluster's files. When used to take an incremental\n   backup, some files that would have been part of a full backup may be\n   replaced with incremental versions of the same files, containing only those\n   blocks that have been modified since the reference backup. An incremental\n   backup cannot be used directly; instead,\n   \u003ca class=\"xref\" href=\"/docs/18/app-pgcombinebackup.html\" title=\"pg_combinebackup\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_combinebackup\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e must first\n   be used to combine it with the previous backups upon which it depends.\n   See \u003ca class=\"xref\" href=\"/docs/18/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" title=\"25.3.3. Making an Incremental Backup\"\u003eSection 25.3.3\u003c/a\u003e for more information\n   about incremental backups, and \u003ca class=\"xref\" href=\"/docs/18/continuous-archiving.html#BACKUP-PITR-RECOVERY\" title=\"25.3.5. Recovering Using a Continuous Archive Backup\"\u003eSection 25.3.5\u003c/a\u003e\n   for steps to recover from a backup.\n  \u003c/p\u003e\u003cp\u003e\n   In any mode, \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e makes sure the server\n   is put into and out of backup mode automatically. Backups are always taken of\n   the entire database cluster; it is not possible to back up individual\n   databases or database objects. For selective backups, another tool such as\n   \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e must be used.\n  \u003c/p\u003e\u003cp\u003e\n   The backup is made over a regular \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e\n   connection that uses the replication protocol. The connection must be made\n   with a user ID that has \u003ccode class=\"literal\"\u003eREPLICATION\u003c/code\u003e permissions\n   (see \u003ca class=\"xref\" href=\"/docs/18/role-attributes.html\" title=\"21.2. Role Attributes\"\u003eSection 21.2\u003c/a\u003e) or is a superuser,\n   and \u003ca class=\"link\" href=\"/docs/18/auth-pg-hba-conf.html\" title=\"20.1. The pg_hba.conf File\"\u003e\u003ccode class=\"filename\"\u003epg_hba.conf\u003c/code\u003e\u003c/a\u003e\n   must permit the replication connection. The server must also be configured\n   with \u003ca class=\"xref\" href=\"/docs/18/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\"\u003emax_wal_senders\u003c/a\u003e set high enough to provide at\n   least one walsender for the backup plus one for WAL streaming (if used).\n  \u003c/p\u003e\u003cp\u003e\n   There can be multiple \u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003es running at the same time, but it is usually\n   better from a performance point of view to take only one backup, and copy\n   the result.\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e can make a base backup from\n   not only a primary server but also a standby. To take a backup from a standby,\n   set up the standby so that it can accept replication connections (that is, set\n   \u003ccode class=\"varname\"\u003emax_wal_senders\u003c/code\u003e and \u003ca class=\"xref\" href=\"/docs/18/runtime-config-replication.html#GUC-HOT-STANDBY\"\u003ehot_standby\u003c/a\u003e,\n   and configure its \u003ccode class=\"filename\"\u003epg_hba.conf\u003c/code\u003e appropriately).\n   You will also need to enable \u003ca class=\"xref\" href=\"/docs/18/runtime-config-wal.html#GUC-FULL-PAGE-WRITES\"\u003efull_page_writes\u003c/a\u003e on the primary.\n  \u003c/p\u003e\u003cp\u003e\n   Note that there are some limitations in taking a backup from a standby:\n\n   \u003c/p\u003e\u003cdiv class=\"itemizedlist\"\u003e\u003cul class=\"itemizedlist\"\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n      The backup history file is not created in the database cluster backed up.\n     \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e cannot force the standby\n      to switch to a new WAL file at the end of backup.\n      When you are using \u003ccode class=\"literal\"\u003e-X none\u003c/code\u003e, if write activity on\n      the primary is low, \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e may\n      need to wait a long time for the last WAL file required for the backup\n      to be switched and archived.  In this case, it may be useful to run\n      \u003ccode class=\"function\"\u003epg_switch_wal\u003c/code\u003e on the primary in order to\n      trigger an immediate WAL file switch.\n     \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n      If the standby is promoted to be primary during backup, the backup fails.\n     \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n      All WAL records required for the backup must contain sufficient full-page writes,\n      which requires you to enable \u003ccode class=\"varname\"\u003efull_page_writes\u003c/code\u003e on the primary.\n     \u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   Whenever \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e is taking a base\n   backup, the server's \u003ccode class=\"structname\"\u003epg_stat_progress_basebackup\u003c/code\u003e\n   view will report the progress of the backup.\n   See \u003ca class=\"xref\" href=\"/docs/18/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.6. Base Backup Progress Reporting\"\u003eSection 27.4.6\u003c/a\u003e for details.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.6\"\u003e\u003ch2\u003eOptions\u003c/h2\u003e\u003cp\u003e\n    The following command-line options control the location and format of the\n    output:\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-D \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--pgdata=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the target directory to write the output to.\n        \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e will create this directory\n        (and any missing parent directories) if it does not exist.  If it\n        already exists, it must be empty.\n       \u003c/p\u003e\u003cp\u003e\n        When the backup is in tar format, the target directory may be\n        specified as \u003ccode class=\"literal\"\u003e-\u003c/code\u003e (dash), causing the tar file to be\n        written to \u003ccode class=\"literal\"\u003estdout\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This option is required.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-F \u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--format=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Selects the format for the output. \u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\n        can be one of the following:\n\n        \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ep\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eplain\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            Write the output as plain files, with the same layout as the\n            source server's data directory and tablespaces. When the cluster has\n            no additional tablespaces, the whole database will be placed in\n            the target directory. If the cluster contains additional\n            tablespaces, the main data directory will be placed in the\n            target directory, but all other tablespaces will be placed\n            in the same absolute path as they have on the source server.\n            (See \u003ccode class=\"option\"\u003e--tablespace-mapping\u003c/code\u003e to change that.)\n           \u003c/p\u003e\u003cp\u003e\n            This is the default format.\n           \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003et\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003etar\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            Write the output as tar files in the target directory. The main\n            data directory's contents will be written to a file named\n            \u003ccode class=\"filename\"\u003ebase.tar\u003c/code\u003e, and each other tablespace will be\n            written to a separate tar file named after that tablespace's OID.\n           \u003c/p\u003e\u003cp\u003e\n            If the target directory is specified as \u003ccode class=\"literal\"\u003e-\u003c/code\u003e\n            (dash), the tar contents will be written to\n            standard output, suitable for piping to (for example)\n            \u003cspan class=\"productname\"\u003egzip\u003c/span\u003e. This is only allowed if\n            the cluster has no additional tablespaces and WAL\n            streaming is not used.\n           \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-i \u003cem class=\"replaceable\"\u003e\u003ccode\u003eold_manifest_file\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--incremental=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eold_manifest_file\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Performs an \u003ca class=\"link\" href=\"/docs/18/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" title=\"25.3.3. Making an Incremental Backup\"\u003eincremental\n        backup\u003c/a\u003e. The backup manifest for the reference\n        backup must be provided, and will be uploaded to the server, which will\n        respond by sending the requested incremental backup.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-R\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--write-recovery-conf\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Creates a\n        \u003ca class=\"link\" href=\"/docs/18/warm-standby.html#FILE-STANDBY-SIGNAL\"\u003e\u003ccode class=\"filename\"\u003estandby.signal\u003c/code\u003e\u003c/a\u003e\n\n        file and appends\n        connection settings to the \u003ccode class=\"filename\"\u003epostgresql.auto.conf\u003c/code\u003e\n        file in the target directory (or within the base archive file when\n        using tar format).  This eases setting up a standby server using the\n        results of the backup.\n       \u003c/p\u003e\u003cp\u003e\n        The \u003ccode class=\"filename\"\u003epostgresql.auto.conf\u003c/code\u003e file will record the connection\n        settings and, if specified, the replication slot\n        that \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e is using, so that\n        streaming replication and \u003ca class=\"link\" href=\"/docs/18/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3. Replication Slot Synchronization\"\u003e\n        logical replication slot synchronization\u003c/a\u003e will use the same\n        settings later on. The dbname will be recorded only if the dbname was\n        specified explicitly in the connection string or \u003ca class=\"link\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003e\n        environment variable\u003c/a\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t \u003cem class=\"replaceable\"\u003e\u003ccode\u003etarget\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--target=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etarget\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Instructs the server where to place the base backup. The default target\n        is \u003ccode class=\"literal\"\u003eclient\u003c/code\u003e, which specifies that the backup should\n        be sent to the machine where \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e\n        is running. If the target is instead set to\n        \u003ccode class=\"literal\"\u003eserver:/some/path\u003c/code\u003e, the backup will be stored on\n        the machine where the server is running in the\n        \u003ccode class=\"literal\"\u003e/some/path\u003c/code\u003e directory. Storing a backup on the\n        server requires superuser privileges or having privileges of the\n        \u003ccode class=\"literal\"\u003epg_write_server_files\u003c/code\u003e role. If the target is set to\n        \u003ccode class=\"literal\"\u003eblackhole\u003c/code\u003e, the contents are discarded and not\n        stored anywhere. This should only be used for testing purposes, as you\n        will not end up with an actual backup.\n       \u003c/p\u003e\u003cp\u003e\n        Since WAL streaming is implemented by\n        \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e rather than by the server,\n        this option cannot be used together with \u003ccode class=\"literal\"\u003e-Xstream\u003c/code\u003e.\n        Since that is the default, when this option is specified, you must also\n        specify either \u003ccode class=\"literal\"\u003e-Xfetch\u003c/code\u003e or \u003ccode class=\"literal\"\u003e-Xnone\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-T \u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--tablespace-mapping=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Relocates the tablespace in directory \u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e\n        to \u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e during the backup.  To be\n        effective, \u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e must exactly match the\n        path specification of the tablespace as it is defined on the source\n        server.  (But it is not an error if there is no tablespace\n        in \u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e on the source server.)\n        Meanwhile \u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e is a directory in the\n        receiving host's filesystem.  As with the main target directory,\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e need not exist already, but if\n        it does exist it must be empty.\n        Both \u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e\n        and \u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e must be absolute paths.  If\n        either path needs to contain an equal sign (\u003ccode class=\"literal\"\u003e=\u003c/code\u003e),\n        precede that with a backslash.  This option can be specified multiple\n        times for multiple tablespaces.\n       \u003c/p\u003e\u003cp\u003e\n        If a tablespace is relocated in this way, the symbolic links inside\n        the main data directory are updated to point to the new location.  So\n        the new data directory is ready to be used for a new server instance\n        with all tablespaces in the updated locations.\n       \u003c/p\u003e\u003cp\u003e\n        Currently, this option only works with plain output format; it is\n        ignored if tar format is selected.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--waldir=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ewaldir\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the directory to write WAL (write-ahead log) files to.\n        By default WAL files will be placed in\n        the \u003ccode class=\"filename\"\u003epg_wal\u003c/code\u003e subdirectory of the target\n        directory, but this option can be used to place them elsewhere.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ewaldir\u003c/code\u003e\u003c/em\u003e must be an absolute path.\n        As with the main target directory,\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ewaldir\u003c/code\u003e\u003c/em\u003e need not exist already, but if\n        it does exist it must be empty.\n        This option can only be specified when\n        the backup is in plain format.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-X \u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--wal-method=\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Includes the required WAL (write-ahead log) files in the\n        backup. This will include all write-ahead logs generated during\n        the backup. Unless the method \u003ccode class=\"literal\"\u003enone\u003c/code\u003e is specified,\n        it is possible to start a postmaster in the target\n        directory without the need to consult the WAL archive, thus\n        making the output a completely standalone backup.\n       \u003c/p\u003e\u003cp\u003e\n        The following \u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003es for collecting the\n        write-ahead logs are supported:\n\n        \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003en\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003enone\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            Don't include write-ahead logs in the backup.\n           \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ef\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003efetch\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            The write-ahead log files are collected at the end of the backup.\n            Therefore, it is necessary for the source server's\n            \u003ca class=\"xref\" href=\"/docs/18/runtime-config-replication.html#GUC-WAL-KEEP-SIZE\"\u003ewal_keep_size\u003c/a\u003e parameter to be set high\n            enough that the required log data is not removed before the end\n            of the backup.  If the required log data has been recycled\n            before it's time to transfer it, the backup will fail and be\n            unusable.\n           \u003c/p\u003e\u003cp\u003e\n            When tar format is used, the write-ahead log files will be\n            included in the \u003ccode class=\"filename\"\u003ebase.tar\u003c/code\u003e file.\n           \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003es\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003estream\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            Stream write-ahead log data while the backup is being taken.\n            This method will open a second connection to the server and\n            start streaming the write-ahead log in parallel while running\n            the backup.  Therefore, it will require two replication\n            connections not just one.  As long as the client can keep up\n            with the write-ahead log data, using this method requires no\n            extra write-ahead logs to be saved on the source server.\n           \u003c/p\u003e\u003cp\u003e\n            When tar format is used, the write-ahead log files will be\n            written to a separate file named \u003ccode class=\"filename\"\u003epg_wal.tar\u003c/code\u003e\n            (if the server is a version earlier than 10, the file will be named\n            \u003ccode class=\"filename\"\u003epg_xlog.tar\u003c/code\u003e).\n           \u003c/p\u003e\u003cp\u003e\n            This value is the default.\n           \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-z\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--gzip\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Enables gzip compression of tar file output, with the default\n        compression level. Compression is only available when using\n        the tar format, and the suffix \u003ccode class=\"filename\"\u003e.gz\u003c/code\u003e will\n        automatically be added to all tar filenames.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-Z \u003cem class=\"replaceable\"\u003e\u003ccode\u003elevel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-Z [{client|server}-]\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e[:\u003cem class=\"replaceable\"\u003e\u003ccode\u003edetail\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--compress=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elevel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--compress=[{client|server}-]\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e[:\u003cem class=\"replaceable\"\u003e\u003ccode\u003edetail\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Requests compression of the backup. If \u003ccode class=\"literal\"\u003eclient\u003c/code\u003e or\n        \u003ccode class=\"literal\"\u003eserver\u003c/code\u003e is included, it specifies where the\n        compression is to be performed. Compressing on the server will reduce\n        transfer bandwidth but will increase server CPU consumption.  The\n        default is \u003ccode class=\"literal\"\u003eclient\u003c/code\u003e except when\n        \u003ccode class=\"literal\"\u003e--target\u003c/code\u003e is used. In that case, the backup is not\n        being sent to the client, so only server compression is sensible.\n        When \u003ccode class=\"literal\"\u003e-Xstream\u003c/code\u003e, which is the default, is used,\n        server-side compression will not be applied to the WAL. To compress\n        the WAL, use client-side compression, or\n        specify \u003ccode class=\"literal\"\u003e-Xfetch\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        The compression method can be set to \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003elz4\u003c/code\u003e, \u003ccode class=\"literal\"\u003ezstd\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003enone\u003c/code\u003e for no compression or an integer (no\n        compression if 0, \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e if greater than 0).\n        A compression detail string can optionally be specified.\n        If the detail string is an integer, it specifies the compression\n        level.  Otherwise, it should be a comma-separated list of items,\n        each of the form\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekeyword\u003c/code\u003e\u003c/em\u003e or\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekeyword=value\u003c/code\u003e\u003c/em\u003e.\n        Currently, the supported keywords are \u003ccode class=\"literal\"\u003elevel\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003elong\u003c/code\u003e, and \u003ccode class=\"literal\"\u003eworkers\u003c/code\u003e.\n        The detail string cannot be used when the compression method\n        is specified as a plain integer.\n       \u003c/p\u003e\u003cp\u003e\n        If no compression level is specified, the default compression level\n        will be used. If only a level is specified without mentioning an\n        algorithm, \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e compression will be used if the\n        level is greater than 0, and no compression will be used if the level\n        is 0.\n       \u003c/p\u003e\u003cp\u003e\n        When the tar format is used with \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003elz4\u003c/code\u003e, or \u003ccode class=\"literal\"\u003ezstd\u003c/code\u003e, the suffix\n        \u003ccode class=\"filename\"\u003e.gz\u003c/code\u003e, \u003ccode class=\"filename\"\u003e.lz4\u003c/code\u003e, or\n        \u003ccode class=\"filename\"\u003e.zst\u003c/code\u003e, respectively, will be automatically added to\n        all tar filenames. When the plain format is used, client-side\n        compression may not be specified, but it is still possible to request\n        server-side compression. If this is done, the server will compress the\n        backup for transmission, and the client will decompress and extract it.\n       \u003c/p\u003e\u003cp\u003e\n        When this option is used in combination with\n        \u003ccode class=\"literal\"\u003e-Xstream\u003c/code\u003e, \u003ccode class=\"literal\"\u003epg_wal.tar\u003c/code\u003e will\n        be compressed using \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e if client-side gzip\n        compression is selected, but will not be compressed if any other\n        compression algorithm is selected, or if server-side compression\n        is selected.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    The following command-line options control the generation of the\n    backup and the invocation of the program:\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c {fast|spread}\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--checkpoint={fast|spread}\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets checkpoint mode to fast (immediate) or spread (the default)\n        (see \u003ca class=\"xref\" href=\"/docs/18/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP\" title=\"25.3.4. Making a Base Backup Using the Low Level API\"\u003eSection 25.3.4\u003c/a\u003e).\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-C\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies that the replication slot named by the\n        \u003ccode class=\"literal\"\u003e--slot\u003c/code\u003e option should be created before starting\n        the backup.  An error is raised if the slot already exists.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l \u003cem class=\"replaceable\"\u003e\u003ccode\u003elabel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--label=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elabel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the label for the backup. If none is specified, a default value of\n        \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e\u003ccode class=\"literal\"\u003epg_basebackup base backup\u003c/code\u003e\u003c/span\u003e”\u003c/span\u003e will be used.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-n\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-clean\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        By default, when \u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e aborts with an\n        error, it removes any directories it might have created before\n        discovering that it cannot finish the job (for example, the target\n        directory and write-ahead log directory). This option inhibits\n        tidying-up and is thus useful for debugging.\n       \u003c/p\u003e\u003cp\u003e\n        Note that tablespace directories are not cleaned up either way.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-N\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        By default, \u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e will wait for all files\n        to be written safely to disk.  This option causes\n        \u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e to return without waiting, which is\n        faster, but means that a subsequent operating system crash can leave\n        the base backup corrupt.  Generally, this option is useful for testing\n        but should not be used when creating a production installation.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-P\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--progress\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Enables progress reporting. Turning this on will deliver an approximate\n        progress report during the backup. Since the database may change during\n        the backup, this is only an approximation and may not end at exactly\n        \u003ccode class=\"literal\"\u003e100%\u003c/code\u003e. In particular, when WAL log is included in the\n        backup, the total amount of data cannot be estimated in advance, and\n        in this case the estimated target size will increase once it passes the\n        total estimate without WAL.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-r \u003cem class=\"replaceable\"\u003e\u003ccode\u003erate\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--max-rate=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erate\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the maximum transfer rate at which data is collected from the\n        source server.  This can be useful to limit the impact\n        of \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e on the server.  Values\n        are in kilobytes per second.  Use a suffix of \u003ccode class=\"literal\"\u003eM\u003c/code\u003e\n        to indicate megabytes per second.  A suffix of \u003ccode class=\"literal\"\u003ek\u003c/code\u003e\n        is also accepted, and has no effect.  Valid values are between 32\n        kilobytes per second and 1024 megabytes per second.\n       \u003c/p\u003e\u003cp\u003e\n        This option always affects transfer of the data directory. Transfer of\n        WAL files is only affected if the collection method\n        is \u003ccode class=\"literal\"\u003efetch\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S \u003cem class=\"replaceable\"\u003e\u003ccode\u003eslotname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--slot=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eslotname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option can only be used together with \u003ccode class=\"literal\"\u003e-X\n        stream\u003c/code\u003e.  It causes WAL streaming to use the specified\n        replication slot.  If the base backup is intended to be used as a\n        streaming-replication standby using a replication slot, the standby\n        should then use the same replication slot name as\n        \u003ca class=\"xref\" href=\"/docs/18/runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME\"\u003eprimary_slot_name\u003c/a\u003e.  This ensures that the\n        primary server does not remove any necessary WAL data in the time\n        between the end of the base backup and the start of streaming\n        replication on the new standby.\n       \u003c/p\u003e\u003cp\u003e\n        The specified replication slot has to exist unless the\n        option \u003ccode class=\"option\"\u003e-C\u003c/code\u003e is also used.\n       \u003c/p\u003e\u003cp\u003e\n        If this option is not specified and the server supports temporary\n        replication slots (version 10 and later), then a temporary replication\n        slot is automatically used for WAL streaming.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--sync-method=\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When set to \u003ccode class=\"literal\"\u003efsync\u003c/code\u003e, which is the default,\n        \u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e will recursively open and synchronize\n        all files in the backup directory.  When the plain format is used, the\n        search for files will follow symbolic links for the WAL directory and\n        each configured tablespace.\n       \u003c/p\u003e\u003cp\u003e\n        On Linux, \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e may be used instead to ask the\n        operating system to synchronize the whole file system that contains the\n        backup directory.  When the plain format is used,\n        \u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e will also synchronize the file systems\n        that contain the WAL files and each tablespace.  See\n        \u003ca class=\"xref\" href=\"/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\"\u003erecovery_init_sync_method\u003c/a\u003e for information about\n        the caveats to be aware of when using \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This option has no effect when \u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e is used.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Enables verbose mode. Will output some extra steps during startup and\n        shutdown, as well as show the exact file name that is currently being\n        processed if progress reporting is also enabled.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--manifest-checksums=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ealgorithm\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the checksum algorithm that should be applied to each file\n        included in the backup manifest. Currently, the available\n        algorithms are \u003ccode class=\"literal\"\u003eNONE\u003c/code\u003e, \u003ccode class=\"literal\"\u003eCRC32C\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003eSHA224\u003c/code\u003e, \u003ccode class=\"literal\"\u003eSHA256\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003eSHA384\u003c/code\u003e, and \u003ccode class=\"literal\"\u003eSHA512\u003c/code\u003e.\n        The default is \u003ccode class=\"literal\"\u003eCRC32C\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        If \u003ccode class=\"literal\"\u003eNONE\u003c/code\u003e is selected, the backup manifest will\n        not contain any checksums. Otherwise, it will contain a checksum\n        of each file in the backup using the specified algorithm. In addition,\n        the manifest will always contain a \u003ccode class=\"literal\"\u003eSHA256\u003c/code\u003e\n        checksum of its own contents. The \u003ccode class=\"literal\"\u003eSHA\u003c/code\u003e algorithms\n        are significantly more CPU-intensive than \u003ccode class=\"literal\"\u003eCRC32C\u003c/code\u003e,\n        so selecting one of them may increase the time required to complete\n        the backup.\n       \u003c/p\u003e\u003cp\u003e\n        Using a SHA hash function provides a cryptographically secure digest\n        of each file for users who wish to verify that the backup has not been\n        tampered with, while the CRC-32C algorithm provides a checksum that is\n        much faster to calculate; it is good at catching errors due to accidental\n        changes but is not resistant to malicious modifications.  Note that, to\n        be useful against an adversary who has access to the backup, the backup\n        manifest would need to be stored securely elsewhere or otherwise\n        verified not to have been modified since the backup was taken.\n       \u003c/p\u003e\u003cp\u003e\n\u003ca class=\"xref\" href=\"/docs/18/app-pgverifybackup.html\" title=\"pg_verifybackup\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_verifybackup\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e can be used to check the\n        integrity of a backup against the backup manifest.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--manifest-force-encode\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Forces all filenames in the backup manifest to be hex-encoded.\n        If this option is not specified, only non-UTF8 filenames are\n        hex-encoded. This option is mostly intended to test that tools which\n        read a backup manifest file properly handle this case.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-estimate-size\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Prevents the server from estimating the total\n        amount of backup data that will be streamed, resulting in the\n        \u003ccode class=\"structfield\"\u003ebackup_total\u003c/code\u003e column in the\n        \u003ccode class=\"structname\"\u003epg_stat_progress_basebackup\u003c/code\u003e view\n        always being \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        Without this option, the backup will start by estimating the total\n        amount of data that will be streamed, and then go back and send\n        the actual contents. This may make the backup take slightly\n        longer, and in particular it will take longer before the first\n        data is sent. This option is useful to avoid such estimation\n        time if it's too long.\n       \u003c/p\u003e\u003cp\u003e\n        This option is not allowed when using \u003ccode class=\"option\"\u003e--progress\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-manifest\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Disables generation of a backup manifest. If this option is not\n        specified, the server will generate and send a backup manifest\n        which can be verified using \u003ca class=\"xref\" href=\"/docs/18/app-pgverifybackup.html\" title=\"pg_verifybackup\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_verifybackup\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e.\n        The manifest is a list of every file present in the backup with the\n        exception of any WAL files that may be included. It also stores the\n        size, last modification time, and an optional checksum for each file.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-slot\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Prevents the creation of a temporary replication slot\n        for the backup.\n       \u003c/p\u003e\u003cp\u003e\n        By default, if log streaming is selected but no slot name is given\n        with the \u003ccode class=\"option\"\u003e-S\u003c/code\u003e option, then a temporary replication\n        slot is created (if supported by the source server).\n       \u003c/p\u003e\u003cp\u003e\n        The main purpose of this option is to allow taking a base backup when\n        the server has no free replication slots.  Using a replication slot\n        is almost always preferred, because it prevents needed WAL from being\n        removed by the server during the backup.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-verify-checksums\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Disables verification of checksums, if they are enabled on the server\n        the base backup is taken from.\n       \u003c/p\u003e\u003cp\u003e\n        By default, checksums are verified and checksum failures will result\n        in a non-zero exit status. However, the base backup will not be\n        removed in such a case, as if the \u003ccode class=\"option\"\u003e--no-clean\u003c/code\u003e option\n        had been used.  Checksum verification failures will also be reported\n        in the \u003ca class=\"link\" href=\"/docs/18/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.17. pg_stat_database\"\u003e\n\u003ccode class=\"structname\"\u003epg_stat_database\u003c/code\u003e\u003c/a\u003e view.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    The following command-line options control the connection to the source\n    server:\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003econnstr\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--dbname=\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnstr\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies parameters used to connect to the server, as a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e;  these\n        will override any conflicting command line options.\n       \u003c/p\u003e\u003cp\u003e\n        This option is called \u003ccode class=\"literal\"\u003e--dbname\u003c/code\u003e for consistency with other\n        client applications, but because \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e\n        doesn't connect to any particular database in the cluster, any database\n        name included in the connection string will be ignored by the server.\n        However, a database name supplied that way overrides the default\n        database name (\u003ccode class=\"literal\"\u003ereplication\u003c/code\u003e) for purposes of\n        looking up the replication connection's password\n        in \u003ccode class=\"filename\"\u003e~/.pgpass\u003c/code\u003e.  Similarly, middleware or proxies\n        used in connecting to \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e might\n        utilize the name for purposes such as connection routing.  The\n        database name can also be used\n        by \u003ca class=\"link\" href=\"/docs/18/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3. Replication Slot Synchronization\"\u003e\n        logical replication slot synchronization\u003c/a\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the host name of the machine on which the server is\n        running.  If the value begins with a slash, it is used as the\n        directory for a Unix domain socket. The default is taken\n        from the \u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e environment variable, if set,\n        else a Unix domain socket connection is attempted.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the TCP port or local Unix domain socket file\n        extension on which the server is listening for connections.\n        Defaults to the \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e environment variable, if\n        set, or a compiled-in default.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s \u003cem class=\"replaceable\"\u003e\u003ccode\u003einterval\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--status-interval=\u003cem class=\"replaceable\"\u003e\u003ccode\u003einterval\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the number of seconds between status packets sent back to\n        the source server. Smaller values allow more accurate monitoring of\n        backup progress from the server.\n        A value of zero disables periodic status updates completely,\n        although an update will still be sent when requested by the server, to\n        avoid timeout-based disconnects. The default value is 10 seconds.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the user name to connect as.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Prevents issuing a password prompt.  If the server requires\n        password authentication and a password is not available by\n        other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the\n        connection attempt will fail.  This option can be useful in\n        batch jobs and scripts where no user is present to enter a\n        password.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Forces \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e to prompt for a\n        password before connecting to the source server.\n       \u003c/p\u003e\u003cp\u003e\n        This option is never essential, since\n        \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e will automatically prompt\n        for a password if the server demands password authentication.\n        However, \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e will waste a\n        connection attempt finding out that the server wants a password.\n        In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra\n        connection attempt.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    Other options are also available:\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Prints the \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e version and exits.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Shows help about \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e command line\n       arguments, and exits.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.7\"\u003e\u003ch2\u003eEnvironment\u003c/h2\u003e\u003cp\u003e\n   This utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities,\n   uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e\n   (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\n  \u003c/p\u003e\u003cp\u003e\n   The environment variable \u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e specifies whether to use\n   color in diagnostic messages. Possible values are\n   \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and\n   \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.8\"\u003e\u003ch2\u003eNotes\u003c/h2\u003e\u003cp\u003e\n   At the beginning of the backup, a checkpoint needs to be performed on the\n   source server.  This can take some time (especially if the option\n   \u003ccode class=\"literal\"\u003e--checkpoint=fast\u003c/code\u003e is not used), during\n   which \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e will appear to be idle.\n  \u003c/p\u003e\u003cp\u003e\n   The backup will include all files in the data directory and tablespaces,\n   including the configuration files and any additional files placed in the\n   directory by third parties, except certain temporary files managed by\n   PostgreSQL and operating system files.  But only regular files and\n   directories are copied, except that\n   symbolic links used for tablespaces are preserved.  Symbolic links pointing\n   to certain directories known to PostgreSQL are copied as empty directories.\n   Other symbolic links and special device files are skipped.\n   See \u003ca class=\"xref\" href=\"/docs/18/protocol-replication.html\" title=\"54.4. Streaming Replication Protocol\"\u003eSection 54.4\u003c/a\u003e for the precise details.\n  \u003c/p\u003e\u003cp\u003e\n   In plain format, tablespaces will be backed up to the same path\n   they have on the source server, unless the\n   option \u003ccode class=\"literal\"\u003e--tablespace-mapping\u003c/code\u003e is used.  Without\n   this option, running a plain format base backup on the same host as the\n   server will not work if tablespaces are in use, because the backup would\n   have to be written to the same directory locations as the original\n   tablespaces.\n  \u003c/p\u003e\u003cp\u003e\n   When tar format is used, it is the user's responsibility to unpack each\n   tar file before starting a PostgreSQL server that uses the data. If there\n   are additional tablespaces, the\n   tar files for them need to be unpacked in the correct locations. In this\n   case the symbolic links for those tablespaces will be created by the server\n   according to the contents of the \u003ccode class=\"filename\"\u003etablespace_map\u003c/code\u003e file that is\n   included in the \u003ccode class=\"filename\"\u003ebase.tar\u003c/code\u003e file.\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e works with servers of the same\n   or older major version, down to 9.1. However, WAL streaming mode (\u003ccode class=\"literal\"\u003e-X\n   stream\u003c/code\u003e) only works with server version 9.3 and later, the tar format\n   (\u003ccode class=\"literal\"\u003e--format=tar\u003c/code\u003e) only works with server version 9.5\n   and later, and incremental backup (\u003ccode class=\"literal\"\u003e--incremental\u003c/code\u003e) only works\n   with server version 17 and later.\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e will preserve group permissions\n   for data files if group permissions are enabled on the source cluster.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.9\"\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cp\u003e\n   To create a base backup of the server at \u003ccode class=\"literal\"\u003emydbserver\u003c/code\u003e\n   and store it in the local directory\n   \u003ccode class=\"filename\"\u003e/usr/local/pgsql/data\u003c/code\u003e:\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_basebackup -h mydbserver -D /usr/local/pgsql/data\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To create a backup of the local server with one compressed\n   tar file for each tablespace, and store it in the directory\n   \u003ccode class=\"filename\"\u003ebackup\u003c/code\u003e, showing a progress report while running:\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_basebackup -D backup -Ft -z -P\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To create a backup of a single-tablespace local database and compress\n   this with \u003cspan class=\"productname\"\u003ebzip2\u003c/span\u003e:\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_basebackup -D - -Ft -X fetch | bzip2 \u0026gt; backup.tar.bz2\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n   (This command will fail if there are multiple tablespaces in the\n   database.)\n  \u003c/p\u003e\u003cp\u003e\n   To create a backup of a local database where the tablespace in\n   \u003ccode class=\"filename\"\u003e/opt/ts\u003c/code\u003e is relocated\n   to \u003ccode class=\"filename\"\u003e./backup/ts\u003c/code\u003e:\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n   To create a backup of the local server with one tar file for each tablespace\n   compressed with \u003cspan class=\"application\"\u003egzip\u003c/span\u003e at level 9, stored in the\n   directory \u003ccode class=\"filename\"\u003ebackup\u003c/code\u003e:\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_basebackup -D backup -Ft --compress=gzip:9\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.10\"\u003e\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.6. Base Backup Progress Reporting\"\u003eSection 27.4.6\u003c/a\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","manual_path":"app-pgbasebackup.html","options":[{"description":"Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty. When the backup is in tar format, the target directory may be specified as - (dash), causing the tar file to be written to stdout . This option is required.","names":["-D directory","--pgdata= directory"],"signature":"-D directory --pgdata= directory","source_url":"/docs/18/app-pgbasebackup.html","summary":"Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty."},{"description":"Selects the format for the output. format can be one of the following: p plain Write the output as plain files, with the same layout as the source server's data directory and tablespaces. When the cluster has no additional tablespaces, the whole database will be placed in the target directory. If the cluster contains additional tablespaces, the main data directory will be placed in the target directory, but all other tablespaces will be placed in the same absolute path as they have on the source server. (See --tablespace-mapping to change that.) This is the default format. t tar Write the output as tar files in the target directory. The main data directory's contents will be written to a file named base.tar , and each other tablespace will be written to a separate tar file named after that tablespace's OID. If the target directory is specified as - (dash), the tar contents will be written to standard output, suitable for piping to (for example) gzip . This is only allowed if the cluster has no additional tablespaces and WAL streaming is not used.","names":["-F format","--format= format"],"signature":"-F format --format= format","source_url":"/docs/18/app-pgbasebackup.html","summary":"Selects the format for the output. format can be one of the following:"},{"description":"Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup.","names":["-i old_manifest_file","--incremental= old_manifest_file"],"signature":"-i old_manifest_file --incremental= old_manifest_file","source_url":"/docs/18/app-pgbasebackup.html","summary":"Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup."},{"description":"Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup. The postgresql.auto.conf file will record the connection settings and, if specified, the replication slot that pg_basebackup is using, so that streaming replication and logical replication slot synchronization will use the same settings later on. The dbname will be recorded only if the dbname was specified explicitly in the connection string or environment variable .","names":["-R","--write-recovery-conf"],"signature":"-R --write-recovery-conf","source_url":"/docs/18/app-pgbasebackup.html","summary":"Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup."},{"description":"Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup. Since WAL streaming is implemented by pg_basebackup rather than by the server, this option cannot be used together with -Xstream . Since that is the default, when this option is specified, you must also specify either -Xfetch or -Xnone .","names":["-t target","--target= target"],"signature":"-t target --target= target","source_url":"/docs/18/app-pgbasebackup.html","summary":"Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup."},{"description":"Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces. If a tablespace is relocated in this way, the symbolic links inside the main data directory are updated to point to the new location. So the new data directory is ready to be used for a new server instance with all tablespaces in the updated locations. Currently, this option only works with plain output format; it is ignored if tar format is selected.","names":["-T olddir = newdir","--tablespace-mapping= olddir = newdir"],"signature":"-T olddir = newdir --tablespace-mapping= olddir = newdir","source_url":"/docs/18/app-pgbasebackup.html","summary":"Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces."},{"description":"Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format.","names":["--waldir= waldir"],"signature":"--waldir= waldir","source_url":"/docs/18/app-pgbasebackup.html","summary":"Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."},{"description":"Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup. The following method s for collecting the write-ahead logs are supported: n none Don't include write-ahead logs in the backup. f fetch The write-ahead log files are collected at the end of the backup. Therefore, it is necessary for the source server's wal_keep_size parameter to be set high enough that the required log data is not removed before the end of the backup. If the required log data has been recycled before it's time to transfer it, the backup will fail and be unusable. When tar format is used, the write-ahead log files will be included in the base.tar file. s stream Stream write-ahead log data while the backup is being taken. This method will open a second connection to the server and start streaming the write-ahead log in parallel while running the backup. Therefore, it will require two replication connections not just one. As long as the client can keep up with the write-ahead log data, using this method requires no extra write-ahead logs to be saved on the source server. When tar format is used, the write-ahead log files will be written to a separate file named pg_wal.tar (if the server is a version earlier than 10, the file will be named pg_xlog.tar ). This value is the default.","names":["-X method","--wal-method= method"],"signature":"-X method --wal-method= method","source_url":"/docs/18/app-pgbasebackup.html","summary":"Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup."},{"description":"Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames.","names":["-z","--gzip"],"signature":"-z --gzip","source_url":"/docs/18/app-pgbasebackup.html","summary":"Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."},{"description":"Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch . The compression method can be set to gzip , lz4 , zstd , none for no compression or an integer (no compression if 0, gzip if greater than 0). A compression detail string can optionally be specified. If the detail string is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form keyword or keyword=value . Currently, the supported keywords are level , long , and workers . The detail string cannot be used when the compression method is specified as a plain integer. If no compression level is specified, the default compression level will be used. If only a level is specified without mentioning an algorithm, gzip compression will be used if the level is greater than 0, and no compression will be used if the level is 0. When the tar format is used with gzip , lz4 , or zstd , the suffix .gz , .lz4 , or .zst , respectively, will be automatically added to all tar filenames. When the plain format is used, client-side compression may not be specified, but it is still possible to request server-side compression. If this is done, the server will compress the backup for transmission, and the client will decompress and extract it. When this option is used in combination with -Xstream , pg_wal.tar will be compressed using gzip if client-side gzip compression is selected, but will not be compressed if any other compression algorithm is selected, or if server-side compression is selected.","names":["-Z level","-Z [{client|server}-] method [: detail ]","--compress= level","--compress=[{client|server}-] method [: detail ]"],"signature":"-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]","source_url":"/docs/18/app-pgbasebackup.html","summary":"Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch ."},{"description":"Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 ).","names":["-c {fast|spread}","--checkpoint={fast|spread}"],"signature":"-c {fast|spread} --checkpoint={fast|spread}","source_url":"/docs/18/app-pgbasebackup.html","summary":"Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 )."},{"description":"Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists.","names":["-C","--create-slot"],"signature":"-C --create-slot","source_url":"/docs/18/app-pgbasebackup.html","summary":"Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."},{"description":"Sets the label for the backup. If none is specified, a default value of “ pg_basebackup base backup ” will be used.","names":["-l label","--label= label"],"signature":"-l label --label= label","source_url":"/docs/18/app-pgbasebackup.html","summary":"Sets the label for the backup. If none is specified, a default value of “ pg_basebackup base backup ” will be used."},{"description":"By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging. Note that tablespace directories are not cleaned up either way.","names":["-n","--no-clean"],"signature":"-n --no-clean","source_url":"/docs/18/app-pgbasebackup.html","summary":"By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging."},{"description":"By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation.","names":["-N","--no-sync"],"signature":"-N --no-sync","source_url":"/docs/18/app-pgbasebackup.html","summary":"By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."},{"description":"Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL.","names":["-P","--progress"],"signature":"-P --progress","source_url":"/docs/18/app-pgbasebackup.html","summary":"Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."},{"description":"Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second. This option always affects transfer of the data directory. Transfer of WAL files is only affected if the collection method is fetch .","names":["-r rate","--max-rate= rate"],"signature":"-r rate --max-rate= rate","source_url":"/docs/18/app-pgbasebackup.html","summary":"Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second."},{"description":"This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby. The specified replication slot has to exist unless the option -C is also used. If this option is not specified and the server supports temporary replication slots (version 10 and later), then a temporary replication slot is automatically used for WAL streaming.","names":["-S slotname","--slot= slotname"],"signature":"-S slotname --slot= slotname","source_url":"/docs/18/app-pgbasebackup.html","summary":"This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby."},{"description":"When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file system that contains the backup directory. When the plain format is used, pg_basebackup will also synchronize the file systems that contain the WAL files and each tablespace. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used.","names":["--sync-method= method"],"signature":"--sync-method= method","source_url":"/docs/18/app-pgbasebackup.html","summary":"When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace."},{"description":"Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled.","names":["-v","--verbose"],"signature":"-v --verbose","source_url":"/docs/18/app-pgbasebackup.html","summary":"Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."},{"description":"Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C . If NONE is selected, the backup manifest will not contain any checksums. Otherwise, it will contain a checksum of each file in the backup using the specified algorithm. In addition, the manifest will always contain a SHA256 checksum of its own contents. The SHA algorithms are significantly more CPU-intensive than CRC32C , so selecting one of them may increase the time required to complete the backup. Using a SHA hash function provides a cryptographically secure digest of each file for users who wish to verify that the backup has not been tampered with, while the CRC-32C algorithm provides a checksum that is much faster to calculate; it is good at catching errors due to accidental changes but is not resistant to malicious modifications. Note that, to be useful against an adversary who has access to the backup, the backup manifest would need to be stored securely elsewhere or otherwise verified not to have been modified since the backup was taken. pg_verifybackup can be used to check the integrity of a backup against the backup manifest.","names":["--manifest-checksums= algorithm"],"signature":"--manifest-checksums= algorithm","source_url":"/docs/18/app-pgbasebackup.html","summary":"Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C ."},{"description":"Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case.","names":["--manifest-force-encode"],"signature":"--manifest-force-encode","source_url":"/docs/18/app-pgbasebackup.html","summary":"Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."},{"description":"Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL . Without this option, the backup will start by estimating the total amount of data that will be streamed, and then go back and send the actual contents. This may make the backup take slightly longer, and in particular it will take longer before the first data is sent. This option is useful to avoid such estimation time if it's too long. This option is not allowed when using --progress .","names":["--no-estimate-size"],"signature":"--no-estimate-size","source_url":"/docs/18/app-pgbasebackup.html","summary":"Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL ."},{"description":"Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file.","names":["--no-manifest"],"signature":"--no-manifest","source_url":"/docs/18/app-pgbasebackup.html","summary":"Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."},{"description":"Prevents the creation of a temporary replication slot for the backup. By default, if log streaming is selected but no slot name is given with the -S option, then a temporary replication slot is created (if supported by the source server). The main purpose of this option is to allow taking a base backup when the server has no free replication slots. Using a replication slot is almost always preferred, because it prevents needed WAL from being removed by the server during the backup.","names":["--no-slot"],"signature":"--no-slot","source_url":"/docs/18/app-pgbasebackup.html","summary":"Prevents the creation of a temporary replication slot for the backup."},{"description":"Disables verification of checksums, if they are enabled on the server the base backup is taken from. By default, checksums are verified and checksum failures will result in a non-zero exit status. However, the base backup will not be removed in such a case, as if the --no-clean option had been used. Checksum verification failures will also be reported in the pg_stat_database view.","names":["--no-verify-checksums"],"signature":"--no-verify-checksums","source_url":"/docs/18/app-pgbasebackup.html","summary":"Disables verification of checksums, if they are enabled on the server the base backup is taken from."},{"description":"Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options. This option is called --dbname for consistency with other client applications, but because pg_basebackup doesn't connect to any particular database in the cluster, any database name included in the connection string will be ignored by the server. However, a database name supplied that way overrides the default database name ( replication ) for purposes of looking up the replication connection's password in ~/.pgpass . Similarly, middleware or proxies used in connecting to PostgreSQL might utilize the name for purposes such as connection routing. The database name can also be used by logical replication slot synchronization .","names":["-d connstr","--dbname= connstr"],"signature":"-d connstr --dbname= connstr","source_url":"/docs/18/app-pgbasebackup.html","summary":"Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options."},{"description":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.","names":["-h host","--host= host"],"signature":"-h host --host= host","source_url":"/docs/18/app-pgbasebackup.html","summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."},{"description":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.","names":["-p port","--port= port"],"signature":"-p port --port= port","source_url":"/docs/18/app-pgbasebackup.html","summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."},{"description":"Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds.","names":["-s interval","--status-interval= interval"],"signature":"-s interval --status-interval= interval","source_url":"/docs/18/app-pgbasebackup.html","summary":"Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."},{"description":"Specifies the user name to connect as.","names":["-U username","--username= username"],"signature":"-U username --username= username","source_url":"/docs/18/app-pgbasebackup.html","summary":"Specifies the user name to connect as."},{"description":"Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.","names":["-w","--no-password"],"signature":"-w --no-password","source_url":"/docs/18/app-pgbasebackup.html","summary":"Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"description":"Forces pg_basebackup to prompt for a password before connecting to the source server. This option is never essential, since pg_basebackup will automatically prompt for a password if the server demands password authentication. However, pg_basebackup will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.","names":["-W","--password"],"signature":"-W --password","source_url":"/docs/18/app-pgbasebackup.html","summary":"Forces pg_basebackup to prompt for a password before connecting to the source server."},{"description":"Prints the pg_basebackup version and exits.","names":["-V","--version"],"signature":"-V --version","source_url":"/docs/18/app-pgbasebackup.html","summary":"Prints the pg_basebackup version and exits."},{"description":"Shows help about pg_basebackup command line arguments, and exits.","names":["-?","--help"],"signature":"-? --help","source_url":"/docs/18/app-pgbasebackup.html","summary":"Shows help about pg_basebackup command line arguments, and exits."}],"related":[{"label":"libpq connection parameters","url":"/wiki/conn/?v=18"}],"related_zh":[{"label":"libpq 连接参数","url":"/wiki/conn/?v=18"}],"release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.7","major":"18","manifest":{"major":"18","release":"18.7","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd","source_url":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2"},"ref":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2","revision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd"},"sections":[],"sections_zh":[],"signature":"pg_basebackup [ option ...]","sources":[{"anchor":"","file":"app-pgbasebackup.html","label":"18.7 English manual · app-pgbasebackup.html","sha256":"13cb927aa7152bd5ba5f51e656a401efc7b7f8d75936c10747b7d9b100fa7a45","url":"/docs/18/app-pgbasebackup.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"a1c669b9a6dab81388171b696e61109033d96d2c4d5487219c77f62f14aecfa1","url":"/docs/18/reference-client.html"}],"synopsis":["pg_basebackup [ option ...]"],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-D directory --pgdata= directory","url":"/docs/18/app-pgbasebackup.html"},"summary":"Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty."},{"signature":{"text":"-F format --format= format","url":"/docs/18/app-pgbasebackup.html"},"summary":"Selects the format for the output. format can be one of the following:"},{"signature":{"text":"-i old_manifest_file --incremental= old_manifest_file","url":"/docs/18/app-pgbasebackup.html"},"summary":"Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup."},{"signature":{"text":"-R --write-recovery-conf","url":"/docs/18/app-pgbasebackup.html"},"summary":"Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup."},{"signature":{"text":"-t target --target= target","url":"/docs/18/app-pgbasebackup.html"},"summary":"Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup."},{"signature":{"text":"-T olddir = newdir --tablespace-mapping= olddir = newdir","url":"/docs/18/app-pgbasebackup.html"},"summary":"Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces."},{"signature":{"text":"--waldir= waldir","url":"/docs/18/app-pgbasebackup.html"},"summary":"Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."},{"signature":{"text":"-X method --wal-method= method","url":"/docs/18/app-pgbasebackup.html"},"summary":"Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup."},{"signature":{"text":"-z --gzip","url":"/docs/18/app-pgbasebackup.html"},"summary":"Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."},{"signature":{"text":"-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]","url":"/docs/18/app-pgbasebackup.html"},"summary":"Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch ."},{"signature":{"text":"-c {fast|spread} --checkpoint={fast|spread}","url":"/docs/18/app-pgbasebackup.html"},"summary":"Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 )."},{"signature":{"text":"-C --create-slot","url":"/docs/18/app-pgbasebackup.html"},"summary":"Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."},{"signature":{"text":"-l label --label= label","url":"/docs/18/app-pgbasebackup.html"},"summary":"Sets the label for the backup. If none is specified, a default value of “ pg_basebackup base backup ” will be used."},{"signature":{"text":"-n --no-clean","url":"/docs/18/app-pgbasebackup.html"},"summary":"By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging."},{"signature":{"text":"-N --no-sync","url":"/docs/18/app-pgbasebackup.html"},"summary":"By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."},{"signature":{"text":"-P --progress","url":"/docs/18/app-pgbasebackup.html"},"summary":"Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."},{"signature":{"text":"-r rate --max-rate= rate","url":"/docs/18/app-pgbasebackup.html"},"summary":"Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second."},{"signature":{"text":"-S slotname --slot= slotname","url":"/docs/18/app-pgbasebackup.html"},"summary":"This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby."},{"signature":{"text":"--sync-method= method","url":"/docs/18/app-pgbasebackup.html"},"summary":"When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace."},{"signature":{"text":"-v --verbose","url":"/docs/18/app-pgbasebackup.html"},"summary":"Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."},{"signature":{"text":"--manifest-checksums= algorithm","url":"/docs/18/app-pgbasebackup.html"},"summary":"Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C ."},{"signature":{"text":"--manifest-force-encode","url":"/docs/18/app-pgbasebackup.html"},"summary":"Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."},{"signature":{"text":"--no-estimate-size","url":"/docs/18/app-pgbasebackup.html"},"summary":"Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL ."},{"signature":{"text":"--no-manifest","url":"/docs/18/app-pgbasebackup.html"},"summary":"Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."},{"signature":{"text":"--no-slot","url":"/docs/18/app-pgbasebackup.html"},"summary":"Prevents the creation of a temporary replication slot for the backup."},{"signature":{"text":"--no-verify-checksums","url":"/docs/18/app-pgbasebackup.html"},"summary":"Disables verification of checksums, if they are enabled on the server the base backup is taken from."},{"signature":{"text":"-d connstr --dbname= connstr","url":"/docs/18/app-pgbasebackup.html"},"summary":"Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options."},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-pgbasebackup.html"},"summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-pgbasebackup.html"},"summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."},{"signature":{"text":"-s interval --status-interval= interval","url":"/docs/18/app-pgbasebackup.html"},"summary":"Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-pgbasebackup.html"},"summary":"Specifies the user name to connect as."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-pgbasebackup.html"},"summary":"Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"signature":{"text":"-W --password","url":"/docs/18/app-pgbasebackup.html"},"summary":"Forces pg_basebackup to prompt for a password before connecting to the source server."},{"signature":{"text":"-V --version","url":"/docs/18/app-pgbasebackup.html"},"summary":"Prints the pg_basebackup version and exits."},{"signature":{"text":"-? --help","url":"/docs/18/app-pgbasebackup.html"},"summary":"Shows help about pg_basebackup command line arguments, and exits."}],"title":"Documented options"}],"tables_zh":[{"columns":[{"key":"signature","label":"选项与参数"},{"key":"summary","label":"说明"}],"key":"options","rows":[{"signature":{"text":"-D directory --pgdata= directory","url":"/docs/18/app-pgbasebackup.html"},"summary":"设置写入输出的目标目录。如果该目录不存在， pg_basebackup 会创建它（以及所有缺失的父目录）。如果该目录已经存在，则必须为空。"},{"signature":{"text":"-F format --format= format","url":"/docs/18/app-pgbasebackup.html"},"summary":"选择输出格式。 format 可以是以下值之一："},{"signature":{"text":"-i old_manifest_file --incremental= old_manifest_file","url":"/docs/18/app-pgbasebackup.html"},"summary":"执行 增量备份 。必须提供参考备份的备份清单；该文件将被上传到服务器，随后服务器会返回所请求的增量备份。"},{"signature":{"text":"-R --write-recovery-conf","url":"/docs/18/app-pgbasebackup.html"},"summary":"创建 standby.signal 文件，并将连接设置追加到目标目录中的 postgresql.auto.conf 文件中（如果使用 tar 格式，则追加到基础归档文件内）。这样可以更方便地利用备份结果搭建备库。"},{"signature":{"text":"-t target --target= target","url":"/docs/18/app-pgbasebackup.html"},"summary":"指示服务器将基础备份放到哪里。默认目标是 client ，表示备份应发送到运行 pg_basebackup 的那台机器。如果目标改为 server:/some/path ，则备份会存储在服务器运行所在机器的 /some/path 目录中。将备份存储在服务器上需要超级用户权限，或拥有 pg_write_server_files 角色的权限。如果目标设置为 blackhole ，则内容会被丢弃，不会存储到任何地方。这只应用于测试目的，因为最终不会得到实际备份。"},{"signature":{"text":"-T olddir = newdir --tablespace-mapping= olddir = newdir","url":"/docs/18/app-pgbasebackup.html"},"summary":"在备份期间，将目录 olddir 中的表空间重定位到 newdir 。要使此选项生效， olddir 必须与源服务器上定义的该表空间路径完全一致。（但如果源服务器上在 olddir 中没有表空间，也不算错误。）与此同时， newdir 是接收主机文件系统中的一个目录。与主目标目录一样， newdir 不必事先存在，但如果存在则必须为空。 olddir 和 newdir 都必须是绝对路径。如果任一路径中需要包含等号（ = ），请在其前面加上反斜杠。可以多次指定此选项，以处理多个表空间。"},{"signature":{"text":"--waldir= waldir","url":"/docs/18/app-pgbasebackup.html"},"summary":"设置写入 WAL（预写式日志）文件的目录。默认情况下，WAL 文件会放在目标目录的 pg_wal 子目录中，但此选项可用于将其放在其他位置。 waldir 必须是绝对路径。与主目标目录一样， waldir 不必事先存在，但如果存在则必须为空。只有当备份采用普通文件格式时，才能指定此选项。"},{"signature":{"text":"-X method --wal-method= method","url":"/docs/18/app-pgbasebackup.html"},"summary":"在备份中包含所需的 WAL（预写式日志）文件。这将包括备份期间生成的所有预写式日志。除非指定方法 none ，否则就可以在目标目录中启动 postmaster，而无需查阅 WAL 归档，从而使输出成为一个完全独立的备份。"},{"signature":{"text":"-z --gzip","url":"/docs/18/app-pgbasebackup.html"},"summary":"启用 tar 文件输出的 gzip 压缩，使用默认压缩级别。压缩仅在使用 tar 格式时可用，并且所有 tar 文件名都会自动添加 .gz 后缀。"},{"signature":{"text":"-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]","url":"/docs/18/app-pgbasebackup.html"},"summary":"请求对备份进行压缩。如果包含 client 或 server ，则指定压缩执行的位置。在服务器端压缩会减少传输带宽占用，但会增加服务器 CPU 消耗。默认值是 client ，但使用 --target 时除外；此时备份不会发送到客户端，因此只有服务器端压缩才有意义。使用默认的 -Xstream 时，服务器端压缩不会应用于 WAL。若要压缩 WAL，请使用客户端压缩，或者指定 -Xfetch 。"},{"signature":{"text":"-c {fast|spread} --checkpoint={fast|spread}","url":"/docs/18/app-pgbasebackup.html"},"summary":"将检查点模式设置为 fast（立即）或 spread（默认）（见 第 25.3.4 节 ）。"},{"signature":{"text":"-C --create-slot","url":"/docs/18/app-pgbasebackup.html"},"summary":"指定在开始备份之前，应创建由 --slot 选项指定名称的复制槽。如果该槽已经存在，则会报错。"},{"signature":{"text":"-l label --label= label","url":"/docs/18/app-pgbasebackup.html"},"summary":"设置备份标签。如果未指定，则使用默认值 “ pg_basebackup base backup ” 。"},{"signature":{"text":"-n --no-clean","url":"/docs/18/app-pgbasebackup.html"},"summary":"默认情况下，当 pg_basebackup 因错误中止时，它会删除在发现自己无法完成任务之前可能已创建的所有目录（例如目标目录和预写式日志目录）。此选项会禁止这种清理，因此对调试很有帮助。"},{"signature":{"text":"-N --no-sync","url":"/docs/18/app-pgbasebackup.html"},"summary":"默认情况下， pg_basebackup 会等待所有文件都被安全写入磁盘。此选项会使 pg_basebackup 不经等待就直接返回，因此速度更快，但这意味着如果随后操作系统崩溃，基础备份可能会损坏。通常，此选项适合测试，但不应用于创建生产环境安装。"},{"signature":{"text":"-P --progress","url":"/docs/18/app-pgbasebackup.html"},"summary":"启用进度报告。打开此选项后，会在备份过程中给出一个近似的进度报告。由于数据库在备份过程中可能发生变化，因此这只是近似值，最终未必恰好结束在 100% 。特别是当备份中包含 WAL 时，总数据量无法预先估计；在这种情况下，一旦进度超过不含 WAL 时的总估计值，估计目标大小就会继续增加。"},{"signature":{"text":"-r rate --max-rate= rate","url":"/docs/18/app-pgbasebackup.html"},"summary":"设置从源服务器收集数据时允许的最大传输速率。这有助于限制 pg_basebackup 对服务器的影响。取值单位为每秒千字节。使用后缀 M 表示每秒兆字节。也接受后缀 k ，但没有实际影响。有效取值范围为每秒 32 千字节到每秒 1024 兆字节。"},{"signature":{"text":"-S slotname --slot= slotname","url":"/docs/18/app-pgbasebackup.html"},"summary":"此选项只能与 -X stream 一起使用。它会使 WAL 流式传输使用指定的复制槽。如果此基础备份打算用作使用复制槽的流复制备库，那么该备库应将同一个复制槽名称用作 primary_slot_name 的值。这样可以确保主库在基础备份结束与新备库开始流复制之间的这段时间内，不会移除任何必需的 WAL 数据。"},{"signature":{"text":"--sync-method= method","url":"/docs/18/app-pgbasebackup.html"},"summary":"设置为 fsync （默认）时， pg_basebackup 会递归打开并同步备份目录中的所有文件。使用普通文件格式时，查找文件会跟随 WAL 目录和各已配置表空间的符号链接。"},{"signature":{"text":"-v --verbose","url":"/docs/18/app-pgbasebackup.html"},"summary":"启用详细模式。它会在启动和关闭过程中输出一些额外步骤；如果同时启用了进度报告，还会显示当前正在处理的确切文件名。"},{"signature":{"text":"--manifest-checksums= algorithm","url":"/docs/18/app-pgbasebackup.html"},"summary":"指定应用到备份清单中每个文件的校验和算法。目前可用的算法有 NONE 、 CRC32C 、 SHA224 、 SHA256 、 SHA384 和 SHA512 。默认值为 CRC32C 。"},{"signature":{"text":"--manifest-force-encode","url":"/docs/18/app-pgbasebackup.html"},"summary":"强制将备份清单中的所有文件名编码为十六进制。如果未指定此选项，则只对非 UTF8 文件名进行十六进制编码。此选项主要用于测试读取备份清单文件的工具是否能正确处理这种情况。"},{"signature":{"text":"--no-estimate-size","url":"/docs/18/app-pgbasebackup.html"},"summary":"禁止服务器估算将要流式传输的备份数据总量，因此 pg_stat_progress_basebackup 视图中的 backup_total 列始终为 NULL。"},{"signature":{"text":"--no-manifest","url":"/docs/18/app-pgbasebackup.html"},"summary":"禁止生成备份清单。如果未指定此选项，服务器将生成并发送一个备份清单，可使用 pg_verifybackup 进行验证。该清单列出了备份中的每一个文件，但不包括可能包含在其中的任何 WAL 文件。它还会保存每个文件的大小、最后修改时间以及可选的校验和。"},{"signature":{"text":"--no-slot","url":"/docs/18/app-pgbasebackup.html"},"summary":"防止为备份创建临时复制槽。"},{"signature":{"text":"--no-verify-checksums","url":"/docs/18/app-pgbasebackup.html"},"summary":"如果获取基础备份的服务器启用了校验和，则禁用对这些校验和的验证。"},{"signature":{"text":"-d connstr --dbname= connstr","url":"/docs/18/app-pgbasebackup.html"},"summary":"以 连接字符串 的形式指定用于连接服务器的参数；这些参数会覆盖任何相互冲突的命令行选项。"},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-pgbasebackup.html"},"summary":"指定服务器运行所在机器的主机名。如果该值以斜线开头，则它会被用作 Unix 域套接字的目录。默认值取自 PGHOST 环境变量（如果已设置）；否则会尝试使用 Unix 域套接字连接。"},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-pgbasebackup.html"},"summary":"指定服务器监听连接所使用的 TCP 端口，或本地 Unix 域套接字文件扩展名。默认使用 PGPORT 环境变量中的值（如果已设置），否则使用编译时确定的默认值。"},{"signature":{"text":"-s interval --status-interval= interval","url":"/docs/18/app-pgbasebackup.html"},"summary":"指定发送回源服务器的状态包之间相隔的秒数。较小的值可以让服务器端对备份进度的监控更精确。值为零时会完全禁用周期性状态更新，不过当服务器请求时仍会发送更新，以避免因超时而断开连接。默认值是 10 秒。"},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-pgbasebackup.html"},"summary":"指定连接时使用的用户名。"},{"signature":{"text":"-w --no-password","url":"/docs/18/app-pgbasebackup.html"},"summary":"禁止发出密码提示。如果服务器要求密码认证，而又无法通过其他方式（例如 .pgpass 文件）获得密码，则连接尝试将失败。此选项对于批处理作业和脚本很有用，因为那种场景下通常没有用户在场输入密码。"},{"signature":{"text":"-W --password","url":"/docs/18/app-pgbasebackup.html"},"summary":"强制 pg_basebackup 在连接源服务器之前提示输入密码。"},{"signature":{"text":"-V --version","url":"/docs/18/app-pgbasebackup.html"},"summary":"输出 pg_basebackup 的版本并退出。"},{"signature":{"text":"-? --help","url":"/docs/18/app-pgbasebackup.html"},"summary":"显示 pg_basebackup 命令行参数的帮助并退出。"}],"title":"手册中的选项"}],"zh_from":"same-version-manual"},"ManualEvidence":{"manual_path":"app-pgbasebackup.html","release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.7","major":"18","manifest":{"major":"18","release":"18.7","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd","source_url":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2"},"ref":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2","revision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd"},"sources":[{"anchor":"","file":"app-pgbasebackup.html","label":"18.7 English manual · app-pgbasebackup.html","sha256":"13cb927aa7152bd5ba5f51e656a401efc7b7f8d75936c10747b7d9b100fa7a45","url":"/docs/18/app-pgbasebackup.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"a1c669b9a6dab81388171b696e61109033d96d2c4d5487219c77f62f14aecfa1","url":"/docs/18/reference-client.html"}]},"MeasuredEvidence":{}},"Text":{"Collection":"tool","Key":"pg-basebackup","SourceDatabase":"center","Version":"18","Locale":"en","Title":"pg_basebackup","Summary":"pg_basebackup — take a base backup of a PostgreSQL cluster","BodyHTML":"\u003cdiv\u003e\u003cdiv id=\"APP-PGBASEBACKUP\"\u003e\u003cdiv\u003e\u003c/div\u003e\u003cdiv\u003e\u003ch2\u003e\u003cspan\u003e\u003cspan\u003epg_basebackup\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003cp\u003epg_basebackup — take a base backup of a \u003cspan\u003ePostgreSQL\u003c/span\u003e cluster\u003c/p\u003e\u003c/div\u003e\u003cdiv\u003e\u003ch2\u003eSynopsis\u003c/h2\u003e\u003cdiv\u003e\u003cp id=\"id-1.9.4.10.4.1\"\u003e\u003ccode\u003epg_basebackup\u003c/code\u003e [\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...]\u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\"id-1.9.4.10.5\"\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\n\u003cspan\u003epg_basebackup\u003c/span\u003e is used to take a base backup of\n   a running \u003cspan\u003ePostgreSQL\u003c/span\u003e database cluster. The backup\n   is taken without affecting other clients of the database, and can be used\n   both for point-in-time recovery (see \u003ca href=\"/docs/18/continuous-archiving.html\" rel=\"nofollow\"\u003eSection 25.3\u003c/a\u003e)\n   and as the starting point for a log-shipping or streaming-replication standby\n   server (see \u003ca href=\"/docs/18/warm-standby.html\" rel=\"nofollow\"\u003eSection 26.2\u003c/a\u003e).\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan\u003epg_basebackup\u003c/span\u003e can take a full or incremental\n   base backup of the database. When used to take a full backup, it makes an\n   exact copy of the database cluster\u0026#39;s files. When used to take an incremental\n   backup, some files that would have been part of a full backup may be\n   replaced with incremental versions of the same files, containing only those\n   blocks that have been modified since the reference backup. An incremental\n   backup cannot be used directly; instead,\n   \u003ca href=\"/docs/18/app-pgcombinebackup.html\" title=\"pg_combinebackup\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_combinebackup\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e must first\n   be used to combine it with the previous backups upon which it depends.\n   See \u003ca href=\"/docs/18/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" rel=\"nofollow\"\u003eSection 25.3.3\u003c/a\u003e for more information\n   about incremental backups, and \u003ca href=\"/docs/18/continuous-archiving.html#BACKUP-PITR-RECOVERY\" rel=\"nofollow\"\u003eSection 25.3.5\u003c/a\u003e\n   for steps to recover from a backup.\n  \u003c/p\u003e\u003cp\u003e\n   In any mode, \u003cspan\u003epg_basebackup\u003c/span\u003e makes sure the server\n   is put into and out of backup mode automatically. Backups are always taken of\n   the entire database cluster; it is not possible to back up individual\n   databases or database objects. For selective backups, another tool such as\n   \u003ca href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e must be used.\n  \u003c/p\u003e\u003cp\u003e\n   The backup is made over a regular \u003cspan\u003ePostgreSQL\u003c/span\u003e\n   connection that uses the replication protocol. The connection must be made\n   with a user ID that has \u003ccode\u003eREPLICATION\u003c/code\u003e permissions\n   (see \u003ca href=\"/docs/18/role-attributes.html\" rel=\"nofollow\"\u003eSection 21.2\u003c/a\u003e) or is a superuser,\n   and \u003ca href=\"/docs/18/auth-pg-hba-conf.html\" rel=\"nofollow\"\u003e\u003ccode\u003epg_hba.conf\u003c/code\u003e\u003c/a\u003e\n   must permit the replication connection. The server must also be configured\n   with \u003ca href=\"/docs/18/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\" rel=\"nofollow\"\u003emax_wal_senders\u003c/a\u003e set high enough to provide at\n   least one walsender for the backup plus one for WAL streaming (if used).\n  \u003c/p\u003e\u003cp\u003e\n   There can be multiple \u003ccode\u003epg_basebackup\u003c/code\u003es running at the same time, but it is usually\n   better from a performance point of view to take only one backup, and copy\n   the result.\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan\u003epg_basebackup\u003c/span\u003e can make a base backup from\n   not only a primary server but also a standby. To take a backup from a standby,\n   set up the standby so that it can accept replication connections (that is, set\n   \u003ccode\u003emax_wal_senders\u003c/code\u003e and \u003ca href=\"/docs/18/runtime-config-replication.html#GUC-HOT-STANDBY\" rel=\"nofollow\"\u003ehot_standby\u003c/a\u003e,\n   and configure its \u003ccode\u003epg_hba.conf\u003c/code\u003e appropriately).\n   You will also need to enable \u003ca href=\"/docs/18/runtime-config-wal.html#GUC-FULL-PAGE-WRITES\" rel=\"nofollow\"\u003efull_page_writes\u003c/a\u003e on the primary.\n  \u003c/p\u003e\u003cp\u003e\n   Note that there are some limitations in taking a backup from a standby:\n\n   \u003c/p\u003e\u003cdiv\u003e\u003cul\u003e\u003cli\u003e\u003cp\u003e\n      The backup history file is not created in the database cluster backed up.\n     \u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\n\u003cspan\u003epg_basebackup\u003c/span\u003e cannot force the standby\n      to switch to a new WAL file at the end of backup.\n      When you are using \u003ccode\u003e-X none\u003c/code\u003e, if write activity on\n      the primary is low, \u003cspan\u003epg_basebackup\u003c/span\u003e may\n      need to wait a long time for the last WAL file required for the backup\n      to be switched and archived.  In this case, it may be useful to run\n      \u003ccode\u003epg_switch_wal\u003c/code\u003e on the primary in order to\n      trigger an immediate WAL file switch.\n     \u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\n      If the standby is promoted to be primary during backup, the backup fails.\n     \u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\n      All WAL records required for the backup must contain sufficient full-page writes,\n      which requires you to enable \u003ccode\u003efull_page_writes\u003c/code\u003e on the primary.\n     \u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   Whenever \u003cspan\u003epg_basebackup\u003c/span\u003e is taking a base\n   backup, the server\u0026#39;s \u003ccode\u003epg_stat_progress_basebackup\u003c/code\u003e\n   view will report the progress of the backup.\n   See \u003ca href=\"/docs/18/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" rel=\"nofollow\"\u003eSection 27.4.6\u003c/a\u003e for details.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"id-1.9.4.10.6\"\u003e\u003ch2\u003eOptions\u003c/h2\u003e\u003cp\u003e\n    The following command-line options control the location and format of the\n    output:\n\n    \u003c/p\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-D \u003cem\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--pgdata=\u003cem\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the target directory to write the output to.\n        \u003cspan\u003epg_basebackup\u003c/span\u003e will create this directory\n        (and any missing parent directories) if it does not exist.  If it\n        already exists, it must be empty.\n       \u003c/p\u003e\u003cp\u003e\n        When the backup is in tar format, the target directory may be\n        specified as \u003ccode\u003e-\u003c/code\u003e (dash), causing the tar file to be\n        written to \u003ccode\u003estdout\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This option is required.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-F \u003cem\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--format=\u003cem\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Selects the format for the output. \u003cem\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\n        can be one of the following:\n\n        \u003c/p\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ep\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003eplain\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            Write the output as plain files, with the same layout as the\n            source server\u0026#39;s data directory and tablespaces. When the cluster has\n            no additional tablespaces, the whole database will be placed in\n            the target directory. If the cluster contains additional\n            tablespaces, the main data directory will be placed in the\n            target directory, but all other tablespaces will be placed\n            in the same absolute path as they have on the source server.\n            (See \u003ccode\u003e--tablespace-mapping\u003c/code\u003e to change that.)\n           \u003c/p\u003e\u003cp\u003e\n            This is the default format.\n           \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003et\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003etar\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            Write the output as tar files in the target directory. The main\n            data directory\u0026#39;s contents will be written to a file named\n            \u003ccode\u003ebase.tar\u003c/code\u003e, and each other tablespace will be\n            written to a separate tar file named after that tablespace\u0026#39;s OID.\n           \u003c/p\u003e\u003cp\u003e\n            If the target directory is specified as \u003ccode\u003e-\u003c/code\u003e\n            (dash), the tar contents will be written to\n            standard output, suitable for piping to (for example)\n            \u003cspan\u003egzip\u003c/span\u003e. This is only allowed if\n            the cluster has no additional tablespaces and WAL\n            streaming is not used.\n           \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-i \u003cem\u003e\u003ccode\u003eold_manifest_file\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--incremental=\u003cem\u003e\u003ccode\u003eold_manifest_file\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Performs an \u003ca href=\"/docs/18/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" rel=\"nofollow\"\u003eincremental\n        backup\u003c/a\u003e. The backup manifest for the reference\n        backup must be provided, and will be uploaded to the server, which will\n        respond by sending the requested incremental backup.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-R\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--write-recovery-conf\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Creates a\n        \u003ca href=\"/docs/18/warm-standby.html#FILE-STANDBY-SIGNAL\" rel=\"nofollow\"\u003e\u003ccode\u003estandby.signal\u003c/code\u003e\u003c/a\u003e\n\n        file and appends\n        connection settings to the \u003ccode\u003epostgresql.auto.conf\u003c/code\u003e\n        file in the target directory (or within the base archive file when\n        using tar format).  This eases setting up a standby server using the\n        results of the backup.\n       \u003c/p\u003e\u003cp\u003e\n        The \u003ccode\u003epostgresql.auto.conf\u003c/code\u003e file will record the connection\n        settings and, if specified, the replication slot\n        that \u003cspan\u003epg_basebackup\u003c/span\u003e is using, so that\n        streaming replication and \u003ca href=\"/docs/18/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" rel=\"nofollow\"\u003e\n        logical replication slot synchronization\u003c/a\u003e will use the same\n        settings later on. The dbname will be recorded only if the dbname was\n        specified explicitly in the connection string or \u003ca href=\"/docs/18/libpq-envars.html\" rel=\"nofollow\"\u003e\n        environment variable\u003c/a\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-t \u003cem\u003e\u003ccode\u003etarget\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--target=\u003cem\u003e\u003ccode\u003etarget\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Instructs the server where to place the base backup. The default target\n        is \u003ccode\u003eclient\u003c/code\u003e, which specifies that the backup should\n        be sent to the machine where \u003cspan\u003epg_basebackup\u003c/span\u003e\n        is running. If the target is instead set to\n        \u003ccode\u003eserver:/some/path\u003c/code\u003e, the backup will be stored on\n        the machine where the server is running in the\n        \u003ccode\u003e/some/path\u003c/code\u003e directory. Storing a backup on the\n        server requires superuser privileges or having privileges of the\n        \u003ccode\u003epg_write_server_files\u003c/code\u003e role. If the target is set to\n        \u003ccode\u003eblackhole\u003c/code\u003e, the contents are discarded and not\n        stored anywhere. This should only be used for testing purposes, as you\n        will not end up with an actual backup.\n       \u003c/p\u003e\u003cp\u003e\n        Since WAL streaming is implemented by\n        \u003cspan\u003epg_basebackup\u003c/span\u003e rather than by the server,\n        this option cannot be used together with \u003ccode\u003e-Xstream\u003c/code\u003e.\n        Since that is the default, when this option is specified, you must also\n        specify either \u003ccode\u003e-Xfetch\u003c/code\u003e or \u003ccode\u003e-Xnone\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-T \u003cem\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e=\u003cem\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--tablespace-mapping=\u003cem\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e=\u003cem\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Relocates the tablespace in directory \u003cem\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e\n        to \u003cem\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e during the backup.  To be\n        effective, \u003cem\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e must exactly match the\n        path specification of the tablespace as it is defined on the source\n        server.  (But it is not an error if there is no tablespace\n        in \u003cem\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e on the source server.)\n        Meanwhile \u003cem\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e is a directory in the\n        receiving host\u0026#39;s filesystem.  As with the main target directory,\n        \u003cem\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e need not exist already, but if\n        it does exist it must be empty.\n        Both \u003cem\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e\n        and \u003cem\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e must be absolute paths.  If\n        either path needs to contain an equal sign (\u003ccode\u003e=\u003c/code\u003e),\n        precede that with a backslash.  This option can be specified multiple\n        times for multiple tablespaces.\n       \u003c/p\u003e\u003cp\u003e\n        If a tablespace is relocated in this way, the symbolic links inside\n        the main data directory are updated to point to the new location.  So\n        the new data directory is ready to be used for a new server instance\n        with all tablespaces in the updated locations.\n       \u003c/p\u003e\u003cp\u003e\n        Currently, this option only works with plain output format; it is\n        ignored if tar format is selected.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--waldir=\u003cem\u003e\u003ccode\u003ewaldir\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the directory to write WAL (write-ahead log) files to.\n        By default WAL files will be placed in\n        the \u003ccode\u003epg_wal\u003c/code\u003e subdirectory of the target\n        directory, but this option can be used to place them elsewhere.\n        \u003cem\u003e\u003ccode\u003ewaldir\u003c/code\u003e\u003c/em\u003e must be an absolute path.\n        As with the main target directory,\n        \u003cem\u003e\u003ccode\u003ewaldir\u003c/code\u003e\u003c/em\u003e need not exist already, but if\n        it does exist it must be empty.\n        This option can only be specified when\n        the backup is in plain format.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-X \u003cem\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--wal-method=\u003cem\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Includes the required WAL (write-ahead log) files in the\n        backup. This will include all write-ahead logs generated during\n        the backup. Unless the method \u003ccode\u003enone\u003c/code\u003e is specified,\n        it is possible to start a postmaster in the target\n        directory without the need to consult the WAL archive, thus\n        making the output a completely standalone backup.\n       \u003c/p\u003e\u003cp\u003e\n        The following \u003cem\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003es for collecting the\n        write-ahead logs are supported:\n\n        \u003c/p\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003en\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003enone\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            Don\u0026#39;t include write-ahead logs in the backup.\n           \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ef\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003efetch\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            The write-ahead log files are collected at the end of the backup.\n            Therefore, it is necessary for the source server\u0026#39;s\n            \u003ca href=\"/docs/18/runtime-config-replication.html#GUC-WAL-KEEP-SIZE\" rel=\"nofollow\"\u003ewal_keep_size\u003c/a\u003e parameter to be set high\n            enough that the required log data is not removed before the end\n            of the backup.  If the required log data has been recycled\n            before it\u0026#39;s time to transfer it, the backup will fail and be\n            unusable.\n           \u003c/p\u003e\u003cp\u003e\n            When tar format is used, the write-ahead log files will be\n            included in the \u003ccode\u003ebase.tar\u003c/code\u003e file.\n           \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003es\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003estream\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            Stream write-ahead log data while the backup is being taken.\n            This method will open a second connection to the server and\n            start streaming the write-ahead log in parallel while running\n            the backup.  Therefore, it will require two replication\n            connections not just one.  As long as the client can keep up\n            with the write-ahead log data, using this method requires no\n            extra write-ahead logs to be saved on the source server.\n           \u003c/p\u003e\u003cp\u003e\n            When tar format is used, the write-ahead log files will be\n            written to a separate file named \u003ccode\u003epg_wal.tar\u003c/code\u003e\n            (if the server is a version earlier than 10, the file will be named\n            \u003ccode\u003epg_xlog.tar\u003c/code\u003e).\n           \u003c/p\u003e\u003cp\u003e\n            This value is the default.\n           \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-z\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--gzip\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Enables gzip compression of tar file output, with the default\n        compression level. Compression is only available when using\n        the tar format, and the suffix \u003ccode\u003e.gz\u003c/code\u003e will\n        automatically be added to all tar filenames.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-Z \u003cem\u003e\u003ccode\u003elevel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e-Z [{client|server}-]\u003cem\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e[:\u003cem\u003e\u003ccode\u003edetail\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--compress=\u003cem\u003e\u003ccode\u003elevel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--compress=[{client|server}-]\u003cem\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e[:\u003cem\u003e\u003ccode\u003edetail\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Requests compression of the backup. If \u003ccode\u003eclient\u003c/code\u003e or\n        \u003ccode\u003eserver\u003c/code\u003e is included, it specifies where the\n        compression is to be performed. Compressing on the server will reduce\n        transfer bandwidth but will increase server CPU consumption.  The\n        default is \u003ccode\u003eclient\u003c/code\u003e except when\n        \u003ccode\u003e--target\u003c/code\u003e is used. In that case, the backup is not\n        being sent to the client, so only server compression is sensible.\n        When \u003ccode\u003e-Xstream\u003c/code\u003e, which is the default, is used,\n        server-side compression will not be applied to the WAL. To compress\n        the WAL, use client-side compression, or\n        specify \u003ccode\u003e-Xfetch\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        The compression method can be set to \u003ccode\u003egzip\u003c/code\u003e,\n        \u003ccode\u003elz4\u003c/code\u003e, \u003ccode\u003ezstd\u003c/code\u003e,\n        \u003ccode\u003enone\u003c/code\u003e for no compression or an integer (no\n        compression if 0, \u003ccode\u003egzip\u003c/code\u003e if greater than 0).\n        A compression detail string can optionally be specified.\n        If the detail string is an integer, it specifies the compression\n        level.  Otherwise, it should be a comma-separated list of items,\n        each of the form\n        \u003cem\u003e\u003ccode\u003ekeyword\u003c/code\u003e\u003c/em\u003e or\n        \u003cem\u003e\u003ccode\u003ekeyword=value\u003c/code\u003e\u003c/em\u003e.\n        Currently, the supported keywords are \u003ccode\u003elevel\u003c/code\u003e,\n        \u003ccode\u003elong\u003c/code\u003e, and \u003ccode\u003eworkers\u003c/code\u003e.\n        The detail string cannot be used when the compression method\n        is specified as a plain integer.\n       \u003c/p\u003e\u003cp\u003e\n        If no compression level is specified, the default compression level\n        will be used. If only a level is specified without mentioning an\n        algorithm, \u003ccode\u003egzip\u003c/code\u003e compression will be used if the\n        level is greater than 0, and no compression will be used if the level\n        is 0.\n       \u003c/p\u003e\u003cp\u003e\n        When the tar format is used with \u003ccode\u003egzip\u003c/code\u003e,\n        \u003ccode\u003elz4\u003c/code\u003e, or \u003ccode\u003ezstd\u003c/code\u003e, the suffix\n        \u003ccode\u003e.gz\u003c/code\u003e, \u003ccode\u003e.lz4\u003c/code\u003e, or\n        \u003ccode\u003e.zst\u003c/code\u003e, respectively, will be automatically added to\n        all tar filenames. When the plain format is used, client-side\n        compression may not be specified, but it is still possible to request\n        server-side compression. If this is done, the server will compress the\n        backup for transmission, and the client will decompress and extract it.\n       \u003c/p\u003e\u003cp\u003e\n        When this option is used in combination with\n        \u003ccode\u003e-Xstream\u003c/code\u003e, \u003ccode\u003epg_wal.tar\u003c/code\u003e will\n        be compressed using \u003ccode\u003egzip\u003c/code\u003e if client-side gzip\n        compression is selected, but will not be compressed if any other\n        compression algorithm is selected, or if server-side compression\n        is selected.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    The following command-line options control the generation of the\n    backup and the invocation of the program:\n\n    \u003c/p\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-c {fast|spread}\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--checkpoint={fast|spread}\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets checkpoint mode to fast (immediate) or spread (the default)\n        (see \u003ca href=\"/docs/18/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP\" rel=\"nofollow\"\u003eSection 25.3.4\u003c/a\u003e).\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-C\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--create-slot\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies that the replication slot named by the\n        \u003ccode\u003e--slot\u003c/code\u003e option should be created before starting\n        the backup.  An error is raised if the slot already exists.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-l \u003cem\u003e\u003ccode\u003elabel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--label=\u003cem\u003e\u003ccode\u003elabel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the label for the backup. If none is specified, a default value of\n        \u003cspan\u003e“\u003cspan\u003e\u003ccode\u003epg_basebackup base backup\u003c/code\u003e\u003c/span\u003e”\u003c/span\u003e will be used.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-n\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-clean\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        By default, when \u003ccode\u003epg_basebackup\u003c/code\u003e aborts with an\n        error, it removes any directories it might have created before\n        discovering that it cannot finish the job (for example, the target\n        directory and write-ahead log directory). This option inhibits\n        tidying-up and is thus useful for debugging.\n       \u003c/p\u003e\u003cp\u003e\n        Note that tablespace directories are not cleaned up either way.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-N\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-sync\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        By default, \u003ccode\u003epg_basebackup\u003c/code\u003e will wait for all files\n        to be written safely to disk.  This option causes\n        \u003ccode\u003epg_basebackup\u003c/code\u003e to return without waiting, which is\n        faster, but means that a subsequent operating system crash can leave\n        the base backup corrupt.  Generally, this option is useful for testing\n        but should not be used when creating a production installation.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-P\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--progress\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Enables progress reporting. Turning this on will deliver an approximate\n        progress report during the backup. Since the database may change during\n        the backup, this is only an approximation and may not end at exactly\n        \u003ccode\u003e100%\u003c/code\u003e. In particular, when WAL log is included in the\n        backup, the total amount of data cannot be estimated in advance, and\n        in this case the estimated target size will increase once it passes the\n        total estimate without WAL.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-r \u003cem\u003e\u003ccode\u003erate\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--max-rate=\u003cem\u003e\u003ccode\u003erate\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the maximum transfer rate at which data is collected from the\n        source server.  This can be useful to limit the impact\n        of \u003cspan\u003epg_basebackup\u003c/span\u003e on the server.  Values\n        are in kilobytes per second.  Use a suffix of \u003ccode\u003eM\u003c/code\u003e\n        to indicate megabytes per second.  A suffix of \u003ccode\u003ek\u003c/code\u003e\n        is also accepted, and has no effect.  Valid values are between 32\n        kilobytes per second and 1024 megabytes per second.\n       \u003c/p\u003e\u003cp\u003e\n        This option always affects transfer of the data directory. Transfer of\n        WAL files is only affected if the collection method\n        is \u003ccode\u003efetch\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-S \u003cem\u003e\u003ccode\u003eslotname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--slot=\u003cem\u003e\u003ccode\u003eslotname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option can only be used together with \u003ccode\u003e-X\n        stream\u003c/code\u003e.  It causes WAL streaming to use the specified\n        replication slot.  If the base backup is intended to be used as a\n        streaming-replication standby using a replication slot, the standby\n        should then use the same replication slot name as\n        \u003ca href=\"/docs/18/runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME\" rel=\"nofollow\"\u003eprimary_slot_name\u003c/a\u003e.  This ensures that the\n        primary server does not remove any necessary WAL data in the time\n        between the end of the base backup and the start of streaming\n        replication on the new standby.\n       \u003c/p\u003e\u003cp\u003e\n        The specified replication slot has to exist unless the\n        option \u003ccode\u003e-C\u003c/code\u003e is also used.\n       \u003c/p\u003e\u003cp\u003e\n        If this option is not specified and the server supports temporary\n        replication slots (version 10 and later), then a temporary replication\n        slot is automatically used for WAL streaming.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--sync-method=\u003cem\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When set to \u003ccode\u003efsync\u003c/code\u003e, which is the default,\n        \u003ccode\u003epg_basebackup\u003c/code\u003e will recursively open and synchronize\n        all files in the backup directory.  When the plain format is used, the\n        search for files will follow symbolic links for the WAL directory and\n        each configured tablespace.\n       \u003c/p\u003e\u003cp\u003e\n        On Linux, \u003ccode\u003esyncfs\u003c/code\u003e may be used instead to ask the\n        operating system to synchronize the whole file system that contains the\n        backup directory.  When the plain format is used,\n        \u003ccode\u003epg_basebackup\u003c/code\u003e will also synchronize the file systems\n        that contain the WAL files and each tablespace.  See\n        \u003ca href=\"/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\" rel=\"nofollow\"\u003erecovery_init_sync_method\u003c/a\u003e for information about\n        the caveats to be aware of when using \u003ccode\u003esyncfs\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This option has no effect when \u003ccode\u003e--no-sync\u003c/code\u003e is used.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-v\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Enables verbose mode. Will output some extra steps during startup and\n        shutdown, as well as show the exact file name that is currently being\n        processed if progress reporting is also enabled.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--manifest-checksums=\u003cem\u003e\u003ccode\u003ealgorithm\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the checksum algorithm that should be applied to each file\n        included in the backup manifest. Currently, the available\n        algorithms are \u003ccode\u003eNONE\u003c/code\u003e, \u003ccode\u003eCRC32C\u003c/code\u003e,\n        \u003ccode\u003eSHA224\u003c/code\u003e, \u003ccode\u003eSHA256\u003c/code\u003e,\n        \u003ccode\u003eSHA384\u003c/code\u003e, and \u003ccode\u003eSHA512\u003c/code\u003e.\n        The default is \u003ccode\u003eCRC32C\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        If \u003ccode\u003eNONE\u003c/code\u003e is selected, the backup manifest will\n        not contain any checksums. Otherwise, it will contain a checksum\n        of each file in the backup using the specified algorithm. In addition,\n        the manifest will always contain a \u003ccode\u003eSHA256\u003c/code\u003e\n        checksum of its own contents. The \u003ccode\u003eSHA\u003c/code\u003e algorithms\n        are significantly more CPU-intensive than \u003ccode\u003eCRC32C\u003c/code\u003e,\n        so selecting one of them may increase the time required to complete\n        the backup.\n       \u003c/p\u003e\u003cp\u003e\n        Using a SHA hash function provides a cryptographically secure digest\n        of each file for users who wish to verify that the backup has not been\n        tampered with, while the CRC-32C algorithm provides a checksum that is\n        much faster to calculate; it is good at catching errors due to accidental\n        changes but is not resistant to malicious modifications.  Note that, to\n        be useful against an adversary who has access to the backup, the backup\n        manifest would need to be stored securely elsewhere or otherwise\n        verified not to have been modified since the backup was taken.\n       \u003c/p\u003e\u003cp\u003e\n\u003ca href=\"/docs/18/app-pgverifybackup.html\" title=\"pg_verifybackup\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_verifybackup\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e can be used to check the\n        integrity of a backup against the backup manifest.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--manifest-force-encode\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Forces all filenames in the backup manifest to be hex-encoded.\n        If this option is not specified, only non-UTF8 filenames are\n        hex-encoded. This option is mostly intended to test that tools which\n        read a backup manifest file properly handle this case.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-estimate-size\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Prevents the server from estimating the total\n        amount of backup data that will be streamed, resulting in the\n        \u003ccode\u003ebackup_total\u003c/code\u003e column in the\n        \u003ccode\u003epg_stat_progress_basebackup\u003c/code\u003e view\n        always being \u003ccode\u003eNULL\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        Without this option, the backup will start by estimating the total\n        amount of data that will be streamed, and then go back and send\n        the actual contents. This may make the backup take slightly\n        longer, and in particular it will take longer before the first\n        data is sent. This option is useful to avoid such estimation\n        time if it\u0026#39;s too long.\n       \u003c/p\u003e\u003cp\u003e\n        This option is not allowed when using \u003ccode\u003e--progress\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-manifest\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Disables generation of a backup manifest. If this option is not\n        specified, the server will generate and send a backup manifest\n        which can be verified using \u003ca href=\"/docs/18/app-pgverifybackup.html\" title=\"pg_verifybackup\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_verifybackup\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e.\n        The manifest is a list of every file present in the backup with the\n        exception of any WAL files that may be included. It also stores the\n        size, last modification time, and an optional checksum for each file.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-slot\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Prevents the creation of a temporary replication slot\n        for the backup.\n       \u003c/p\u003e\u003cp\u003e\n        By default, if log streaming is selected but no slot name is given\n        with the \u003ccode\u003e-S\u003c/code\u003e option, then a temporary replication\n        slot is created (if supported by the source server).\n       \u003c/p\u003e\u003cp\u003e\n        The main purpose of this option is to allow taking a base backup when\n        the server has no free replication slots.  Using a replication slot\n        is almost always preferred, because it prevents needed WAL from being\n        removed by the server during the backup.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--no-verify-checksums\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Disables verification of checksums, if they are enabled on the server\n        the base backup is taken from.\n       \u003c/p\u003e\u003cp\u003e\n        By default, checksums are verified and checksum failures will result\n        in a non-zero exit status. However, the base backup will not be\n        removed in such a case, as if the \u003ccode\u003e--no-clean\u003c/code\u003e option\n        had been used.  Checksum verification failures will also be reported\n        in the \u003ca href=\"/docs/18/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" rel=\"nofollow\"\u003e\n\u003ccode\u003epg_stat_database\u003c/code\u003e\u003c/a\u003e view.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    The following command-line options control the connection to the source\n    server:\n\n    \u003c/p\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-d \u003cem\u003e\u003ccode\u003econnstr\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--dbname=\u003cem\u003e\u003ccode\u003econnstr\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies parameters used to connect to the server, as a \u003ca href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" rel=\"nofollow\"\u003econnection string\u003c/a\u003e;  these\n        will override any conflicting command line options.\n       \u003c/p\u003e\u003cp\u003e\n        This option is called \u003ccode\u003e--dbname\u003c/code\u003e for consistency with other\n        client applications, but because \u003cspan\u003epg_basebackup\u003c/span\u003e\n        doesn\u0026#39;t connect to any particular database in the cluster, any database\n        name included in the connection string will be ignored by the server.\n        However, a database name supplied that way overrides the default\n        database name (\u003ccode\u003ereplication\u003c/code\u003e) for purposes of\n        looking up the replication connection\u0026#39;s password\n        in \u003ccode\u003e~/.pgpass\u003c/code\u003e.  Similarly, middleware or proxies\n        used in connecting to \u003cspan\u003ePostgreSQL\u003c/span\u003e might\n        utilize the name for purposes such as connection routing.  The\n        database name can also be used\n        by \u003ca href=\"/docs/18/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" rel=\"nofollow\"\u003e\n        logical replication slot synchronization\u003c/a\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-h \u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--host=\u003cem\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the host name of the machine on which the server is\n        running.  If the value begins with a slash, it is used as the\n        directory for a Unix domain socket. The default is taken\n        from the \u003ccode\u003ePGHOST\u003c/code\u003e environment variable, if set,\n        else a Unix domain socket connection is attempted.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-p \u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--port=\u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the TCP port or local Unix domain socket file\n        extension on which the server is listening for connections.\n        Defaults to the \u003ccode\u003ePGPORT\u003c/code\u003e environment variable, if\n        set, or a compiled-in default.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-s \u003cem\u003e\u003ccode\u003einterval\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--status-interval=\u003cem\u003e\u003ccode\u003einterval\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the number of seconds between status packets sent back to\n        the source server. Smaller values allow more accurate monitoring of\n        backup progress from the server.\n        A value of zero disables periodic status updates completely,\n        although an update will still be sent when requested by the server, to\n        avoid timeout-based disconnects. The default value is 10 seconds.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-U \u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--username=\u003cem\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the user name to connect as.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Prevents issuing a password prompt.  If the server requires\n        password authentication and a password is not available by\n        other means such as a \u003ccode\u003e.pgpass\u003c/code\u003e file, the\n        connection attempt will fail.  This option can be useful in\n        batch jobs and scripts where no user is present to enter a\n        password.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Forces \u003cspan\u003epg_basebackup\u003c/span\u003e to prompt for a\n        password before connecting to the source server.\n       \u003c/p\u003e\u003cp\u003e\n        This option is never essential, since\n        \u003cspan\u003epg_basebackup\u003c/span\u003e will automatically prompt\n        for a password if the server demands password authentication.\n        However, \u003cspan\u003epg_basebackup\u003c/span\u003e will waste a\n        connection attempt finding out that the server wants a password.\n        In some cases it is worth typing \u003ccode\u003e-W\u003c/code\u003e to avoid the extra\n        connection attempt.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    Other options are also available:\n\n    \u003c/p\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Prints the \u003cspan\u003epg_basebackup\u003c/span\u003e version and exits.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Shows help about \u003cspan\u003epg_basebackup\u003c/span\u003e command line\n       arguments, and exits.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"id-1.9.4.10.7\"\u003e\u003ch2\u003eEnvironment\u003c/h2\u003e\u003cp\u003e\n   This utility, like most other \u003cspan\u003ePostgreSQL\u003c/span\u003e utilities,\n   uses the environment variables supported by \u003cspan\u003elibpq\u003c/span\u003e\n   (see \u003ca href=\"/docs/18/libpq-envars.html\" rel=\"nofollow\"\u003eSection 32.15\u003c/a\u003e).\n  \u003c/p\u003e\u003cp\u003e\n   The environment variable \u003ccode\u003ePG_COLOR\u003c/code\u003e specifies whether to use\n   color in diagnostic messages. Possible values are\n   \u003ccode\u003ealways\u003c/code\u003e, \u003ccode\u003eauto\u003c/code\u003e and\n   \u003ccode\u003enever\u003c/code\u003e.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"id-1.9.4.10.8\"\u003e\u003ch2\u003eNotes\u003c/h2\u003e\u003cp\u003e\n   At the beginning of the backup, a checkpoint needs to be performed on the\n   source server.  This can take some time (especially if the option\n   \u003ccode\u003e--checkpoint=fast\u003c/code\u003e is not used), during\n   which \u003cspan\u003epg_basebackup\u003c/span\u003e will appear to be idle.\n  \u003c/p\u003e\u003cp\u003e\n   The backup will include all files in the data directory and tablespaces,\n   including the configuration files and any additional files placed in the\n   directory by third parties, except certain temporary files managed by\n   PostgreSQL and operating system files.  But only regular files and\n   directories are copied, except that\n   symbolic links used for tablespaces are preserved.  Symbolic links pointing\n   to certain directories known to PostgreSQL are copied as empty directories.\n   Other symbolic links and special device files are skipped.\n   See \u003ca href=\"/docs/18/protocol-replication.html\" rel=\"nofollow\"\u003eSection 54.4\u003c/a\u003e for the precise details.\n  \u003c/p\u003e\u003cp\u003e\n   In plain format, tablespaces will be backed up to the same path\n   they have on the source server, unless the\n   option \u003ccode\u003e--tablespace-mapping\u003c/code\u003e is used.  Without\n   this option, running a plain format base backup on the same host as the\n   server will not work if tablespaces are in use, because the backup would\n   have to be written to the same directory locations as the original\n   tablespaces.\n  \u003c/p\u003e\u003cp\u003e\n   When tar format is used, it is the user\u0026#39;s responsibility to unpack each\n   tar file before starting a PostgreSQL server that uses the data. If there\n   are additional tablespaces, the\n   tar files for them need to be unpacked in the correct locations. In this\n   case the symbolic links for those tablespaces will be created by the server\n   according to the contents of the \u003ccode\u003etablespace_map\u003c/code\u003e file that is\n   included in the \u003ccode\u003ebase.tar\u003c/code\u003e file.\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan\u003epg_basebackup\u003c/span\u003e works with servers of the same\n   or older major version, down to 9.1. However, WAL streaming mode (\u003ccode\u003e-X\n   stream\u003c/code\u003e) only works with server version 9.3 and later, the tar format\n   (\u003ccode\u003e--format=tar\u003c/code\u003e) only works with server version 9.5\n   and later, and incremental backup (\u003ccode\u003e--incremental\u003c/code\u003e) only works\n   with server version 17 and later.\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan\u003epg_basebackup\u003c/span\u003e will preserve group permissions\n   for data files if group permissions are enabled on the source cluster.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv id=\"id-1.9.4.10.9\"\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cp\u003e\n   To create a base backup of the server at \u003ccode\u003emydbserver\u003c/code\u003e\n   and store it in the local directory\n   \u003ccode\u003e/usr/local/pgsql/data\u003c/code\u003e:\n\u003c/p\u003e\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_basebackup -h mydbserver -D /usr/local/pgsql/data\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To create a backup of the local server with one compressed\n   tar file for each tablespace, and store it in the directory\n   \u003ccode\u003ebackup\u003c/code\u003e, showing a progress report while running:\n\u003c/p\u003e\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_basebackup -D backup -Ft -z -P\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To create a backup of a single-tablespace local database and compress\n   this with \u003cspan\u003ebzip2\u003c/span\u003e:\n\u003c/p\u003e\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_basebackup -D - -Ft -X fetch | bzip2 \u0026gt; backup.tar.bz2\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n   (This command will fail if there are multiple tablespaces in the\n   database.)\n  \u003c/p\u003e\u003cp\u003e\n   To create a backup of a local database where the tablespace in\n   \u003ccode\u003e/opt/ts\u003c/code\u003e is relocated\n   to \u003ccode\u003e./backup/ts\u003c/code\u003e:\n\u003c/p\u003e\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n   To create a backup of the local server with one tar file for each tablespace\n   compressed with \u003cspan\u003egzip\u003c/span\u003e at level 9, stored in the\n   directory \u003ccode\u003ebackup\u003c/code\u003e:\n\u003c/p\u003e\u003cpre\u003e\u003ccode\u003e$\u003c/code\u003e \u003cstrong\u003e\u003ccode\u003epg_basebackup -D backup -Ft --compress=gzip:9\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003c/div\u003e\u003cdiv id=\"id-1.9.4.10.10\"\u003e\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" rel=\"nofollow\"\u003eSection 27.4.6\u003c/a\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","SourceRevision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","ContentHash":"305236880a0a8a8d99635b0f679318002d6b462eb7606f7edd3cb4efa2e2450d","Payload":{"description":["pg_basebackup — take a base backup of a PostgreSQL cluster"],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-PGBASEBACKUP\"\u003e\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\u003cdiv class=\"refnamediv\"\u003e\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003cp\u003epg_basebackup — take a base backup of a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e cluster\u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsynopsisdiv\"\u003e\u003ch2\u003eSynopsis\u003c/h2\u003e\u003cdiv class=\"cmdsynopsis\"\u003e\u003cp id=\"id-1.9.4.10.4.1\"\u003e\u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...]\u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.5\"\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e is used to take a base backup of\n   a running \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e database cluster. The backup\n   is taken without affecting other clients of the database, and can be used\n   both for point-in-time recovery (see \u003ca class=\"xref\" href=\"/docs/18/continuous-archiving.html\" title=\"25.3. Continuous Archiving and Point-in-Time Recovery (PITR)\"\u003eSection 25.3\u003c/a\u003e)\n   and as the starting point for a log-shipping or streaming-replication standby\n   server (see \u003ca class=\"xref\" href=\"/docs/18/warm-standby.html\" title=\"26.2. Log-Shipping Standby Servers\"\u003eSection 26.2\u003c/a\u003e).\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e can take a full or incremental\n   base backup of the database. When used to take a full backup, it makes an\n   exact copy of the database cluster's files. When used to take an incremental\n   backup, some files that would have been part of a full backup may be\n   replaced with incremental versions of the same files, containing only those\n   blocks that have been modified since the reference backup. An incremental\n   backup cannot be used directly; instead,\n   \u003ca class=\"xref\" href=\"/docs/18/app-pgcombinebackup.html\" title=\"pg_combinebackup\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_combinebackup\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e must first\n   be used to combine it with the previous backups upon which it depends.\n   See \u003ca class=\"xref\" href=\"/docs/18/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" title=\"25.3.3. Making an Incremental Backup\"\u003eSection 25.3.3\u003c/a\u003e for more information\n   about incremental backups, and \u003ca class=\"xref\" href=\"/docs/18/continuous-archiving.html#BACKUP-PITR-RECOVERY\" title=\"25.3.5. Recovering Using a Continuous Archive Backup\"\u003eSection 25.3.5\u003c/a\u003e\n   for steps to recover from a backup.\n  \u003c/p\u003e\u003cp\u003e\n   In any mode, \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e makes sure the server\n   is put into and out of backup mode automatically. Backups are always taken of\n   the entire database cluster; it is not possible to back up individual\n   databases or database objects. For selective backups, another tool such as\n   \u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e must be used.\n  \u003c/p\u003e\u003cp\u003e\n   The backup is made over a regular \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e\n   connection that uses the replication protocol. The connection must be made\n   with a user ID that has \u003ccode class=\"literal\"\u003eREPLICATION\u003c/code\u003e permissions\n   (see \u003ca class=\"xref\" href=\"/docs/18/role-attributes.html\" title=\"21.2. Role Attributes\"\u003eSection 21.2\u003c/a\u003e) or is a superuser,\n   and \u003ca class=\"link\" href=\"/docs/18/auth-pg-hba-conf.html\" title=\"20.1. The pg_hba.conf File\"\u003e\u003ccode class=\"filename\"\u003epg_hba.conf\u003c/code\u003e\u003c/a\u003e\n   must permit the replication connection. The server must also be configured\n   with \u003ca class=\"xref\" href=\"/docs/18/runtime-config-replication.html#GUC-MAX-WAL-SENDERS\"\u003emax_wal_senders\u003c/a\u003e set high enough to provide at\n   least one walsender for the backup plus one for WAL streaming (if used).\n  \u003c/p\u003e\u003cp\u003e\n   There can be multiple \u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003es running at the same time, but it is usually\n   better from a performance point of view to take only one backup, and copy\n   the result.\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e can make a base backup from\n   not only a primary server but also a standby. To take a backup from a standby,\n   set up the standby so that it can accept replication connections (that is, set\n   \u003ccode class=\"varname\"\u003emax_wal_senders\u003c/code\u003e and \u003ca class=\"xref\" href=\"/docs/18/runtime-config-replication.html#GUC-HOT-STANDBY\"\u003ehot_standby\u003c/a\u003e,\n   and configure its \u003ccode class=\"filename\"\u003epg_hba.conf\u003c/code\u003e appropriately).\n   You will also need to enable \u003ca class=\"xref\" href=\"/docs/18/runtime-config-wal.html#GUC-FULL-PAGE-WRITES\"\u003efull_page_writes\u003c/a\u003e on the primary.\n  \u003c/p\u003e\u003cp\u003e\n   Note that there are some limitations in taking a backup from a standby:\n\n   \u003c/p\u003e\u003cdiv class=\"itemizedlist\"\u003e\u003cul class=\"itemizedlist\"\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n      The backup history file is not created in the database cluster backed up.\n     \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e cannot force the standby\n      to switch to a new WAL file at the end of backup.\n      When you are using \u003ccode class=\"literal\"\u003e-X none\u003c/code\u003e, if write activity on\n      the primary is low, \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e may\n      need to wait a long time for the last WAL file required for the backup\n      to be switched and archived.  In this case, it may be useful to run\n      \u003ccode class=\"function\"\u003epg_switch_wal\u003c/code\u003e on the primary in order to\n      trigger an immediate WAL file switch.\n     \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n      If the standby is promoted to be primary during backup, the backup fails.\n     \u003c/p\u003e\u003c/li\u003e\u003cli class=\"listitem\"\u003e\u003cp\u003e\n      All WAL records required for the backup must contain sufficient full-page writes,\n      which requires you to enable \u003ccode class=\"varname\"\u003efull_page_writes\u003c/code\u003e on the primary.\n     \u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   Whenever \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e is taking a base\n   backup, the server's \u003ccode class=\"structname\"\u003epg_stat_progress_basebackup\u003c/code\u003e\n   view will report the progress of the backup.\n   See \u003ca class=\"xref\" href=\"/docs/18/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.6. Base Backup Progress Reporting\"\u003eSection 27.4.6\u003c/a\u003e for details.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.6\"\u003e\u003ch2\u003eOptions\u003c/h2\u003e\u003cp\u003e\n    The following command-line options control the location and format of the\n    output:\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-D \u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--pgdata=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edirectory\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the target directory to write the output to.\n        \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e will create this directory\n        (and any missing parent directories) if it does not exist.  If it\n        already exists, it must be empty.\n       \u003c/p\u003e\u003cp\u003e\n        When the backup is in tar format, the target directory may be\n        specified as \u003ccode class=\"literal\"\u003e-\u003c/code\u003e (dash), causing the tar file to be\n        written to \u003ccode class=\"literal\"\u003estdout\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This option is required.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-F \u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--format=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Selects the format for the output. \u003cem class=\"replaceable\"\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/em\u003e\n        can be one of the following:\n\n        \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ep\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eplain\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            Write the output as plain files, with the same layout as the\n            source server's data directory and tablespaces. When the cluster has\n            no additional tablespaces, the whole database will be placed in\n            the target directory. If the cluster contains additional\n            tablespaces, the main data directory will be placed in the\n            target directory, but all other tablespaces will be placed\n            in the same absolute path as they have on the source server.\n            (See \u003ccode class=\"option\"\u003e--tablespace-mapping\u003c/code\u003e to change that.)\n           \u003c/p\u003e\u003cp\u003e\n            This is the default format.\n           \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003et\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003etar\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            Write the output as tar files in the target directory. The main\n            data directory's contents will be written to a file named\n            \u003ccode class=\"filename\"\u003ebase.tar\u003c/code\u003e, and each other tablespace will be\n            written to a separate tar file named after that tablespace's OID.\n           \u003c/p\u003e\u003cp\u003e\n            If the target directory is specified as \u003ccode class=\"literal\"\u003e-\u003c/code\u003e\n            (dash), the tar contents will be written to\n            standard output, suitable for piping to (for example)\n            \u003cspan class=\"productname\"\u003egzip\u003c/span\u003e. This is only allowed if\n            the cluster has no additional tablespaces and WAL\n            streaming is not used.\n           \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-i \u003cem class=\"replaceable\"\u003e\u003ccode\u003eold_manifest_file\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--incremental=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eold_manifest_file\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Performs an \u003ca class=\"link\" href=\"/docs/18/continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP\" title=\"25.3.3. Making an Incremental Backup\"\u003eincremental\n        backup\u003c/a\u003e. The backup manifest for the reference\n        backup must be provided, and will be uploaded to the server, which will\n        respond by sending the requested incremental backup.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-R\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--write-recovery-conf\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Creates a\n        \u003ca class=\"link\" href=\"/docs/18/warm-standby.html#FILE-STANDBY-SIGNAL\"\u003e\u003ccode class=\"filename\"\u003estandby.signal\u003c/code\u003e\u003c/a\u003e\n\n        file and appends\n        connection settings to the \u003ccode class=\"filename\"\u003epostgresql.auto.conf\u003c/code\u003e\n        file in the target directory (or within the base archive file when\n        using tar format).  This eases setting up a standby server using the\n        results of the backup.\n       \u003c/p\u003e\u003cp\u003e\n        The \u003ccode class=\"filename\"\u003epostgresql.auto.conf\u003c/code\u003e file will record the connection\n        settings and, if specified, the replication slot\n        that \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e is using, so that\n        streaming replication and \u003ca class=\"link\" href=\"/docs/18/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3. Replication Slot Synchronization\"\u003e\n        logical replication slot synchronization\u003c/a\u003e will use the same\n        settings later on. The dbname will be recorded only if the dbname was\n        specified explicitly in the connection string or \u003ca class=\"link\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003e\n        environment variable\u003c/a\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t \u003cem class=\"replaceable\"\u003e\u003ccode\u003etarget\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--target=\u003cem class=\"replaceable\"\u003e\u003ccode\u003etarget\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Instructs the server where to place the base backup. The default target\n        is \u003ccode class=\"literal\"\u003eclient\u003c/code\u003e, which specifies that the backup should\n        be sent to the machine where \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e\n        is running. If the target is instead set to\n        \u003ccode class=\"literal\"\u003eserver:/some/path\u003c/code\u003e, the backup will be stored on\n        the machine where the server is running in the\n        \u003ccode class=\"literal\"\u003e/some/path\u003c/code\u003e directory. Storing a backup on the\n        server requires superuser privileges or having privileges of the\n        \u003ccode class=\"literal\"\u003epg_write_server_files\u003c/code\u003e role. If the target is set to\n        \u003ccode class=\"literal\"\u003eblackhole\u003c/code\u003e, the contents are discarded and not\n        stored anywhere. This should only be used for testing purposes, as you\n        will not end up with an actual backup.\n       \u003c/p\u003e\u003cp\u003e\n        Since WAL streaming is implemented by\n        \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e rather than by the server,\n        this option cannot be used together with \u003ccode class=\"literal\"\u003e-Xstream\u003c/code\u003e.\n        Since that is the default, when this option is specified, you must also\n        specify either \u003ccode class=\"literal\"\u003e-Xfetch\u003c/code\u003e or \u003ccode class=\"literal\"\u003e-Xnone\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-T \u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--tablespace-mapping=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e=\u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Relocates the tablespace in directory \u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e\n        to \u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e during the backup.  To be\n        effective, \u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e must exactly match the\n        path specification of the tablespace as it is defined on the source\n        server.  (But it is not an error if there is no tablespace\n        in \u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e on the source server.)\n        Meanwhile \u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e is a directory in the\n        receiving host's filesystem.  As with the main target directory,\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e need not exist already, but if\n        it does exist it must be empty.\n        Both \u003cem class=\"replaceable\"\u003e\u003ccode\u003eolddir\u003c/code\u003e\u003c/em\u003e\n        and \u003cem class=\"replaceable\"\u003e\u003ccode\u003enewdir\u003c/code\u003e\u003c/em\u003e must be absolute paths.  If\n        either path needs to contain an equal sign (\u003ccode class=\"literal\"\u003e=\u003c/code\u003e),\n        precede that with a backslash.  This option can be specified multiple\n        times for multiple tablespaces.\n       \u003c/p\u003e\u003cp\u003e\n        If a tablespace is relocated in this way, the symbolic links inside\n        the main data directory are updated to point to the new location.  So\n        the new data directory is ready to be used for a new server instance\n        with all tablespaces in the updated locations.\n       \u003c/p\u003e\u003cp\u003e\n        Currently, this option only works with plain output format; it is\n        ignored if tar format is selected.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--waldir=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ewaldir\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the directory to write WAL (write-ahead log) files to.\n        By default WAL files will be placed in\n        the \u003ccode class=\"filename\"\u003epg_wal\u003c/code\u003e subdirectory of the target\n        directory, but this option can be used to place them elsewhere.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ewaldir\u003c/code\u003e\u003c/em\u003e must be an absolute path.\n        As with the main target directory,\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ewaldir\u003c/code\u003e\u003c/em\u003e need not exist already, but if\n        it does exist it must be empty.\n        This option can only be specified when\n        the backup is in plain format.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-X \u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--wal-method=\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Includes the required WAL (write-ahead log) files in the\n        backup. This will include all write-ahead logs generated during\n        the backup. Unless the method \u003ccode class=\"literal\"\u003enone\u003c/code\u003e is specified,\n        it is possible to start a postmaster in the target\n        directory without the need to consult the WAL archive, thus\n        making the output a completely standalone backup.\n       \u003c/p\u003e\u003cp\u003e\n        The following \u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003es for collecting the\n        write-ahead logs are supported:\n\n        \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003en\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003enone\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            Don't include write-ahead logs in the backup.\n           \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ef\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003efetch\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            The write-ahead log files are collected at the end of the backup.\n            Therefore, it is necessary for the source server's\n            \u003ca class=\"xref\" href=\"/docs/18/runtime-config-replication.html#GUC-WAL-KEEP-SIZE\"\u003ewal_keep_size\u003c/a\u003e parameter to be set high\n            enough that the required log data is not removed before the end\n            of the backup.  If the required log data has been recycled\n            before it's time to transfer it, the backup will fail and be\n            unusable.\n           \u003c/p\u003e\u003cp\u003e\n            When tar format is used, the write-ahead log files will be\n            included in the \u003ccode class=\"filename\"\u003ebase.tar\u003c/code\u003e file.\n           \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003es\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003estream\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n            Stream write-ahead log data while the backup is being taken.\n            This method will open a second connection to the server and\n            start streaming the write-ahead log in parallel while running\n            the backup.  Therefore, it will require two replication\n            connections not just one.  As long as the client can keep up\n            with the write-ahead log data, using this method requires no\n            extra write-ahead logs to be saved on the source server.\n           \u003c/p\u003e\u003cp\u003e\n            When tar format is used, the write-ahead log files will be\n            written to a separate file named \u003ccode class=\"filename\"\u003epg_wal.tar\u003c/code\u003e\n            (if the server is a version earlier than 10, the file will be named\n            \u003ccode class=\"filename\"\u003epg_xlog.tar\u003c/code\u003e).\n           \u003c/p\u003e\u003cp\u003e\n            This value is the default.\n           \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-z\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--gzip\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Enables gzip compression of tar file output, with the default\n        compression level. Compression is only available when using\n        the tar format, and the suffix \u003ccode class=\"filename\"\u003e.gz\u003c/code\u003e will\n        automatically be added to all tar filenames.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-Z \u003cem class=\"replaceable\"\u003e\u003ccode\u003elevel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-Z [{client|server}-]\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e[:\u003cem class=\"replaceable\"\u003e\u003ccode\u003edetail\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--compress=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elevel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--compress=[{client|server}-]\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e[:\u003cem class=\"replaceable\"\u003e\u003ccode\u003edetail\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Requests compression of the backup. If \u003ccode class=\"literal\"\u003eclient\u003c/code\u003e or\n        \u003ccode class=\"literal\"\u003eserver\u003c/code\u003e is included, it specifies where the\n        compression is to be performed. Compressing on the server will reduce\n        transfer bandwidth but will increase server CPU consumption.  The\n        default is \u003ccode class=\"literal\"\u003eclient\u003c/code\u003e except when\n        \u003ccode class=\"literal\"\u003e--target\u003c/code\u003e is used. In that case, the backup is not\n        being sent to the client, so only server compression is sensible.\n        When \u003ccode class=\"literal\"\u003e-Xstream\u003c/code\u003e, which is the default, is used,\n        server-side compression will not be applied to the WAL. To compress\n        the WAL, use client-side compression, or\n        specify \u003ccode class=\"literal\"\u003e-Xfetch\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        The compression method can be set to \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003elz4\u003c/code\u003e, \u003ccode class=\"literal\"\u003ezstd\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003enone\u003c/code\u003e for no compression or an integer (no\n        compression if 0, \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e if greater than 0).\n        A compression detail string can optionally be specified.\n        If the detail string is an integer, it specifies the compression\n        level.  Otherwise, it should be a comma-separated list of items,\n        each of the form\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekeyword\u003c/code\u003e\u003c/em\u003e or\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ekeyword=value\u003c/code\u003e\u003c/em\u003e.\n        Currently, the supported keywords are \u003ccode class=\"literal\"\u003elevel\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003elong\u003c/code\u003e, and \u003ccode class=\"literal\"\u003eworkers\u003c/code\u003e.\n        The detail string cannot be used when the compression method\n        is specified as a plain integer.\n       \u003c/p\u003e\u003cp\u003e\n        If no compression level is specified, the default compression level\n        will be used. If only a level is specified without mentioning an\n        algorithm, \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e compression will be used if the\n        level is greater than 0, and no compression will be used if the level\n        is 0.\n       \u003c/p\u003e\u003cp\u003e\n        When the tar format is used with \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003elz4\u003c/code\u003e, or \u003ccode class=\"literal\"\u003ezstd\u003c/code\u003e, the suffix\n        \u003ccode class=\"filename\"\u003e.gz\u003c/code\u003e, \u003ccode class=\"filename\"\u003e.lz4\u003c/code\u003e, or\n        \u003ccode class=\"filename\"\u003e.zst\u003c/code\u003e, respectively, will be automatically added to\n        all tar filenames. When the plain format is used, client-side\n        compression may not be specified, but it is still possible to request\n        server-side compression. If this is done, the server will compress the\n        backup for transmission, and the client will decompress and extract it.\n       \u003c/p\u003e\u003cp\u003e\n        When this option is used in combination with\n        \u003ccode class=\"literal\"\u003e-Xstream\u003c/code\u003e, \u003ccode class=\"literal\"\u003epg_wal.tar\u003c/code\u003e will\n        be compressed using \u003ccode class=\"literal\"\u003egzip\u003c/code\u003e if client-side gzip\n        compression is selected, but will not be compressed if any other\n        compression algorithm is selected, or if server-side compression\n        is selected.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    The following command-line options control the generation of the\n    backup and the invocation of the program:\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-c {fast|spread}\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--checkpoint={fast|spread}\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets checkpoint mode to fast (immediate) or spread (the default)\n        (see \u003ca class=\"xref\" href=\"/docs/18/continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP\" title=\"25.3.4. Making a Base Backup Using the Low Level API\"\u003eSection 25.3.4\u003c/a\u003e).\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-C\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies that the replication slot named by the\n        \u003ccode class=\"literal\"\u003e--slot\u003c/code\u003e option should be created before starting\n        the backup.  An error is raised if the slot already exists.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-l \u003cem class=\"replaceable\"\u003e\u003ccode\u003elabel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--label=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elabel\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the label for the backup. If none is specified, a default value of\n        \u003cspan class=\"quote\"\u003e“\u003cspan class=\"quote\"\u003e\u003ccode class=\"literal\"\u003epg_basebackup base backup\u003c/code\u003e\u003c/span\u003e”\u003c/span\u003e will be used.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-n\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-clean\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        By default, when \u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e aborts with an\n        error, it removes any directories it might have created before\n        discovering that it cannot finish the job (for example, the target\n        directory and write-ahead log directory). This option inhibits\n        tidying-up and is thus useful for debugging.\n       \u003c/p\u003e\u003cp\u003e\n        Note that tablespace directories are not cleaned up either way.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-N\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        By default, \u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e will wait for all files\n        to be written safely to disk.  This option causes\n        \u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e to return without waiting, which is\n        faster, but means that a subsequent operating system crash can leave\n        the base backup corrupt.  Generally, this option is useful for testing\n        but should not be used when creating a production installation.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-P\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--progress\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Enables progress reporting. Turning this on will deliver an approximate\n        progress report during the backup. Since the database may change during\n        the backup, this is only an approximation and may not end at exactly\n        \u003ccode class=\"literal\"\u003e100%\u003c/code\u003e. In particular, when WAL log is included in the\n        backup, the total amount of data cannot be estimated in advance, and\n        in this case the estimated target size will increase once it passes the\n        total estimate without WAL.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-r \u003cem class=\"replaceable\"\u003e\u003ccode\u003erate\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--max-rate=\u003cem class=\"replaceable\"\u003e\u003ccode\u003erate\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Sets the maximum transfer rate at which data is collected from the\n        source server.  This can be useful to limit the impact\n        of \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e on the server.  Values\n        are in kilobytes per second.  Use a suffix of \u003ccode class=\"literal\"\u003eM\u003c/code\u003e\n        to indicate megabytes per second.  A suffix of \u003ccode class=\"literal\"\u003ek\u003c/code\u003e\n        is also accepted, and has no effect.  Valid values are between 32\n        kilobytes per second and 1024 megabytes per second.\n       \u003c/p\u003e\u003cp\u003e\n        This option always affects transfer of the data directory. Transfer of\n        WAL files is only affected if the collection method\n        is \u003ccode class=\"literal\"\u003efetch\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S \u003cem class=\"replaceable\"\u003e\u003ccode\u003eslotname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--slot=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eslotname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        This option can only be used together with \u003ccode class=\"literal\"\u003e-X\n        stream\u003c/code\u003e.  It causes WAL streaming to use the specified\n        replication slot.  If the base backup is intended to be used as a\n        streaming-replication standby using a replication slot, the standby\n        should then use the same replication slot name as\n        \u003ca class=\"xref\" href=\"/docs/18/runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME\"\u003eprimary_slot_name\u003c/a\u003e.  This ensures that the\n        primary server does not remove any necessary WAL data in the time\n        between the end of the base backup and the start of streaming\n        replication on the new standby.\n       \u003c/p\u003e\u003cp\u003e\n        The specified replication slot has to exist unless the\n        option \u003ccode class=\"option\"\u003e-C\u003c/code\u003e is also used.\n       \u003c/p\u003e\u003cp\u003e\n        If this option is not specified and the server supports temporary\n        replication slots (version 10 and later), then a temporary replication\n        slot is automatically used for WAL streaming.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--sync-method=\u003cem class=\"replaceable\"\u003e\u003ccode\u003emethod\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        When set to \u003ccode class=\"literal\"\u003efsync\u003c/code\u003e, which is the default,\n        \u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e will recursively open and synchronize\n        all files in the backup directory.  When the plain format is used, the\n        search for files will follow symbolic links for the WAL directory and\n        each configured tablespace.\n       \u003c/p\u003e\u003cp\u003e\n        On Linux, \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e may be used instead to ask the\n        operating system to synchronize the whole file system that contains the\n        backup directory.  When the plain format is used,\n        \u003ccode class=\"command\"\u003epg_basebackup\u003c/code\u003e will also synchronize the file systems\n        that contain the WAL files and each tablespace.  See\n        \u003ca class=\"xref\" href=\"/docs/18/runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD\"\u003erecovery_init_sync_method\u003c/a\u003e for information about\n        the caveats to be aware of when using \u003ccode class=\"literal\"\u003esyncfs\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        This option has no effect when \u003ccode class=\"option\"\u003e--no-sync\u003c/code\u003e is used.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Enables verbose mode. Will output some extra steps during startup and\n        shutdown, as well as show the exact file name that is currently being\n        processed if progress reporting is also enabled.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--manifest-checksums=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ealgorithm\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the checksum algorithm that should be applied to each file\n        included in the backup manifest. Currently, the available\n        algorithms are \u003ccode class=\"literal\"\u003eNONE\u003c/code\u003e, \u003ccode class=\"literal\"\u003eCRC32C\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003eSHA224\u003c/code\u003e, \u003ccode class=\"literal\"\u003eSHA256\u003c/code\u003e,\n        \u003ccode class=\"literal\"\u003eSHA384\u003c/code\u003e, and \u003ccode class=\"literal\"\u003eSHA512\u003c/code\u003e.\n        The default is \u003ccode class=\"literal\"\u003eCRC32C\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        If \u003ccode class=\"literal\"\u003eNONE\u003c/code\u003e is selected, the backup manifest will\n        not contain any checksums. Otherwise, it will contain a checksum\n        of each file in the backup using the specified algorithm. In addition,\n        the manifest will always contain a \u003ccode class=\"literal\"\u003eSHA256\u003c/code\u003e\n        checksum of its own contents. The \u003ccode class=\"literal\"\u003eSHA\u003c/code\u003e algorithms\n        are significantly more CPU-intensive than \u003ccode class=\"literal\"\u003eCRC32C\u003c/code\u003e,\n        so selecting one of them may increase the time required to complete\n        the backup.\n       \u003c/p\u003e\u003cp\u003e\n        Using a SHA hash function provides a cryptographically secure digest\n        of each file for users who wish to verify that the backup has not been\n        tampered with, while the CRC-32C algorithm provides a checksum that is\n        much faster to calculate; it is good at catching errors due to accidental\n        changes but is not resistant to malicious modifications.  Note that, to\n        be useful against an adversary who has access to the backup, the backup\n        manifest would need to be stored securely elsewhere or otherwise\n        verified not to have been modified since the backup was taken.\n       \u003c/p\u003e\u003cp\u003e\n\u003ca class=\"xref\" href=\"/docs/18/app-pgverifybackup.html\" title=\"pg_verifybackup\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_verifybackup\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e can be used to check the\n        integrity of a backup against the backup manifest.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--manifest-force-encode\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Forces all filenames in the backup manifest to be hex-encoded.\n        If this option is not specified, only non-UTF8 filenames are\n        hex-encoded. This option is mostly intended to test that tools which\n        read a backup manifest file properly handle this case.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-estimate-size\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Prevents the server from estimating the total\n        amount of backup data that will be streamed, resulting in the\n        \u003ccode class=\"structfield\"\u003ebackup_total\u003c/code\u003e column in the\n        \u003ccode class=\"structname\"\u003epg_stat_progress_basebackup\u003c/code\u003e view\n        always being \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e.\n       \u003c/p\u003e\u003cp\u003e\n        Without this option, the backup will start by estimating the total\n        amount of data that will be streamed, and then go back and send\n        the actual contents. This may make the backup take slightly\n        longer, and in particular it will take longer before the first\n        data is sent. This option is useful to avoid such estimation\n        time if it's too long.\n       \u003c/p\u003e\u003cp\u003e\n        This option is not allowed when using \u003ccode class=\"option\"\u003e--progress\u003c/code\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-manifest\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Disables generation of a backup manifest. If this option is not\n        specified, the server will generate and send a backup manifest\n        which can be verified using \u003ca class=\"xref\" href=\"/docs/18/app-pgverifybackup.html\" title=\"pg_verifybackup\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_verifybackup\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e.\n        The manifest is a list of every file present in the backup with the\n        exception of any WAL files that may be included. It also stores the\n        size, last modification time, and an optional checksum for each file.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-slot\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Prevents the creation of a temporary replication slot\n        for the backup.\n       \u003c/p\u003e\u003cp\u003e\n        By default, if log streaming is selected but no slot name is given\n        with the \u003ccode class=\"option\"\u003e-S\u003c/code\u003e option, then a temporary replication\n        slot is created (if supported by the source server).\n       \u003c/p\u003e\u003cp\u003e\n        The main purpose of this option is to allow taking a base backup when\n        the server has no free replication slots.  Using a replication slot\n        is almost always preferred, because it prevents needed WAL from being\n        removed by the server during the backup.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-verify-checksums\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Disables verification of checksums, if they are enabled on the server\n        the base backup is taken from.\n       \u003c/p\u003e\u003cp\u003e\n        By default, checksums are verified and checksum failures will result\n        in a non-zero exit status. However, the base backup will not be\n        removed in such a case, as if the \u003ccode class=\"option\"\u003e--no-clean\u003c/code\u003e option\n        had been used.  Checksum verification failures will also be reported\n        in the \u003ca class=\"link\" href=\"/docs/18/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW\" title=\"27.2.17. pg_stat_database\"\u003e\n\u003ccode class=\"structname\"\u003epg_stat_database\u003c/code\u003e\u003c/a\u003e view.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    The following command-line options control the connection to the source\n    server:\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003econnstr\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--dbname=\u003cem class=\"replaceable\"\u003e\u003ccode\u003econnstr\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies parameters used to connect to the server, as a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e;  these\n        will override any conflicting command line options.\n       \u003c/p\u003e\u003cp\u003e\n        This option is called \u003ccode class=\"literal\"\u003e--dbname\u003c/code\u003e for consistency with other\n        client applications, but because \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e\n        doesn't connect to any particular database in the cluster, any database\n        name included in the connection string will be ignored by the server.\n        However, a database name supplied that way overrides the default\n        database name (\u003ccode class=\"literal\"\u003ereplication\u003c/code\u003e) for purposes of\n        looking up the replication connection's password\n        in \u003ccode class=\"filename\"\u003e~/.pgpass\u003c/code\u003e.  Similarly, middleware or proxies\n        used in connecting to \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e might\n        utilize the name for purposes such as connection routing.  The\n        database name can also be used\n        by \u003ca class=\"link\" href=\"/docs/18/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION\" title=\"47.2.3. Replication Slot Synchronization\"\u003e\n        logical replication slot synchronization\u003c/a\u003e.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehost\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the host name of the machine on which the server is\n        running.  If the value begins with a slash, it is used as the\n        directory for a Unix domain socket. The default is taken\n        from the \u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e environment variable, if set,\n        else a Unix domain socket connection is attempted.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the TCP port or local Unix domain socket file\n        extension on which the server is listening for connections.\n        Defaults to the \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e environment variable, if\n        set, or a compiled-in default.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s \u003cem class=\"replaceable\"\u003e\u003ccode\u003einterval\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--status-interval=\u003cem class=\"replaceable\"\u003e\u003ccode\u003einterval\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the number of seconds between status packets sent back to\n        the source server. Smaller values allow more accurate monitoring of\n        backup progress from the server.\n        A value of zero disables periodic status updates completely,\n        although an update will still be sent when requested by the server, to\n        avoid timeout-based disconnects. The default value is 10 seconds.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eusername\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Specifies the user name to connect as.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Prevents issuing a password prompt.  If the server requires\n        password authentication and a password is not available by\n        other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the\n        connection attempt will fail.  This option can be useful in\n        batch jobs and scripts where no user is present to enter a\n        password.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Forces \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e to prompt for a\n        password before connecting to the source server.\n       \u003c/p\u003e\u003cp\u003e\n        This option is never essential, since\n        \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e will automatically prompt\n        for a password if the server demands password authentication.\n        However, \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e will waste a\n        connection attempt finding out that the server wants a password.\n        In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra\n        connection attempt.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    Other options are also available:\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Prints the \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e version and exits.\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n       Shows help about \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e command line\n       arguments, and exits.\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.7\"\u003e\u003ch2\u003eEnvironment\u003c/h2\u003e\u003cp\u003e\n   This utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities,\n   uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e\n   (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\n  \u003c/p\u003e\u003cp\u003e\n   The environment variable \u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e specifies whether to use\n   color in diagnostic messages. Possible values are\n   \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and\n   \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.8\"\u003e\u003ch2\u003eNotes\u003c/h2\u003e\u003cp\u003e\n   At the beginning of the backup, a checkpoint needs to be performed on the\n   source server.  This can take some time (especially if the option\n   \u003ccode class=\"literal\"\u003e--checkpoint=fast\u003c/code\u003e is not used), during\n   which \u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e will appear to be idle.\n  \u003c/p\u003e\u003cp\u003e\n   The backup will include all files in the data directory and tablespaces,\n   including the configuration files and any additional files placed in the\n   directory by third parties, except certain temporary files managed by\n   PostgreSQL and operating system files.  But only regular files and\n   directories are copied, except that\n   symbolic links used for tablespaces are preserved.  Symbolic links pointing\n   to certain directories known to PostgreSQL are copied as empty directories.\n   Other symbolic links and special device files are skipped.\n   See \u003ca class=\"xref\" href=\"/docs/18/protocol-replication.html\" title=\"54.4. Streaming Replication Protocol\"\u003eSection 54.4\u003c/a\u003e for the precise details.\n  \u003c/p\u003e\u003cp\u003e\n   In plain format, tablespaces will be backed up to the same path\n   they have on the source server, unless the\n   option \u003ccode class=\"literal\"\u003e--tablespace-mapping\u003c/code\u003e is used.  Without\n   this option, running a plain format base backup on the same host as the\n   server will not work if tablespaces are in use, because the backup would\n   have to be written to the same directory locations as the original\n   tablespaces.\n  \u003c/p\u003e\u003cp\u003e\n   When tar format is used, it is the user's responsibility to unpack each\n   tar file before starting a PostgreSQL server that uses the data. If there\n   are additional tablespaces, the\n   tar files for them need to be unpacked in the correct locations. In this\n   case the symbolic links for those tablespaces will be created by the server\n   according to the contents of the \u003ccode class=\"filename\"\u003etablespace_map\u003c/code\u003e file that is\n   included in the \u003ccode class=\"filename\"\u003ebase.tar\u003c/code\u003e file.\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e works with servers of the same\n   or older major version, down to 9.1. However, WAL streaming mode (\u003ccode class=\"literal\"\u003e-X\n   stream\u003c/code\u003e) only works with server version 9.3 and later, the tar format\n   (\u003ccode class=\"literal\"\u003e--format=tar\u003c/code\u003e) only works with server version 9.5\n   and later, and incremental backup (\u003ccode class=\"literal\"\u003e--incremental\u003c/code\u003e) only works\n   with server version 17 and later.\n  \u003c/p\u003e\u003cp\u003e\n\u003cspan class=\"application\"\u003epg_basebackup\u003c/span\u003e will preserve group permissions\n   for data files if group permissions are enabled on the source cluster.\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.9\"\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cp\u003e\n   To create a base backup of the server at \u003ccode class=\"literal\"\u003emydbserver\u003c/code\u003e\n   and store it in the local directory\n   \u003ccode class=\"filename\"\u003e/usr/local/pgsql/data\u003c/code\u003e:\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_basebackup -h mydbserver -D /usr/local/pgsql/data\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To create a backup of the local server with one compressed\n   tar file for each tablespace, and store it in the directory\n   \u003ccode class=\"filename\"\u003ebackup\u003c/code\u003e, showing a progress report while running:\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_basebackup -D backup -Ft -z -P\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   To create a backup of a single-tablespace local database and compress\n   this with \u003cspan class=\"productname\"\u003ebzip2\u003c/span\u003e:\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_basebackup -D - -Ft -X fetch | bzip2 \u0026gt; backup.tar.bz2\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n   (This command will fail if there are multiple tablespaces in the\n   database.)\n  \u003c/p\u003e\u003cp\u003e\n   To create a backup of a local database where the tablespace in\n   \u003ccode class=\"filename\"\u003e/opt/ts\u003c/code\u003e is relocated\n   to \u003ccode class=\"filename\"\u003e./backup/ts\u003c/code\u003e:\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003cp\u003e\n   To create a backup of the local server with one tar file for each tablespace\n   compressed with \u003cspan class=\"application\"\u003egzip\u003c/span\u003e at level 9, stored in the\n   directory \u003ccode class=\"filename\"\u003ebackup\u003c/code\u003e:\n\u003c/p\u003e\u003cpre class=\"screen\"\u003e\u003ccode class=\"prompt\"\u003e$\u003c/code\u003e \u003cstrong class=\"userinput\"\u003e\u003ccode\u003epg_basebackup -D backup -Ft --compress=gzip:9\u003c/code\u003e\u003c/strong\u003e\n\u003c/pre\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\" id=\"id-1.9.4.10.10\"\u003e\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/app-pgdump.html\" title=\"pg_dump\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING\" title=\"27.4.6. Base Backup Progress Reporting\"\u003eSection 27.4.6\u003c/a\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","related":[{"label":"libpq connection parameters","url":"/wiki/conn/?v=18"}],"sections":[],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"-D directory --pgdata= directory","url":"/docs/18/app-pgbasebackup.html"},"summary":"Sets the target directory to write the output to. pg_basebackup will create this directory (and any missing parent directories) if it does not exist. If it already exists, it must be empty."},{"signature":{"text":"-F format --format= format","url":"/docs/18/app-pgbasebackup.html"},"summary":"Selects the format for the output. format can be one of the following:"},{"signature":{"text":"-i old_manifest_file --incremental= old_manifest_file","url":"/docs/18/app-pgbasebackup.html"},"summary":"Performs an incremental backup . The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup."},{"signature":{"text":"-R --write-recovery-conf","url":"/docs/18/app-pgbasebackup.html"},"summary":"Creates a standby.signal file and appends connection settings to the postgresql.auto.conf file in the target directory (or within the base archive file when using tar format). This eases setting up a standby server using the results of the backup."},{"signature":{"text":"-t target --target= target","url":"/docs/18/app-pgbasebackup.html"},"summary":"Instructs the server where to place the base backup. The default target is client , which specifies that the backup should be sent to the machine where pg_basebackup is running. If the target is instead set to server:/some/path , the backup will be stored on the machine where the server is running in the /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to blackhole , the contents are discarded and not stored anywhere. This should only be used for testing purposes, as you will not end up with an actual backup."},{"signature":{"text":"-T olddir = newdir --tablespace-mapping= olddir = newdir","url":"/docs/18/app-pgbasebackup.html"},"summary":"Relocates the tablespace in directory olddir to newdir during the backup. To be effective, olddir must exactly match the path specification of the tablespace as it is defined on the source server. (But it is not an error if there is no tablespace in olddir on the source server.) Meanwhile newdir is a directory in the receiving host's filesystem. As with the main target directory, newdir need not exist already, but if it does exist it must be empty. Both olddir and newdir must be absolute paths. If either path needs to contain an equal sign ( = ), precede that with a backslash. This option can be specified multiple times for multiple tablespaces."},{"signature":{"text":"--waldir= waldir","url":"/docs/18/app-pgbasebackup.html"},"summary":"Sets the directory to write WAL (write-ahead log) files to. By default WAL files will be placed in the pg_wal subdirectory of the target directory, but this option can be used to place them elsewhere. waldir must be an absolute path. As with the main target directory, waldir need not exist already, but if it does exist it must be empty. This option can only be specified when the backup is in plain format."},{"signature":{"text":"-X method --wal-method= method","url":"/docs/18/app-pgbasebackup.html"},"summary":"Includes the required WAL (write-ahead log) files in the backup. This will include all write-ahead logs generated during the backup. Unless the method none is specified, it is possible to start a postmaster in the target directory without the need to consult the WAL archive, thus making the output a completely standalone backup."},{"signature":{"text":"-z --gzip","url":"/docs/18/app-pgbasebackup.html"},"summary":"Enables gzip compression of tar file output, with the default compression level. Compression is only available when using the tar format, and the suffix .gz will automatically be added to all tar filenames."},{"signature":{"text":"-Z level -Z [{client|server}-] method [: detail ] --compress= level --compress=[{client|server}-] method [: detail ]","url":"/docs/18/app-pgbasebackup.html"},"summary":"Requests compression of the backup. If client or server is included, it specifies where the compression is to be performed. Compressing on the server will reduce transfer bandwidth but will increase server CPU consumption. The default is client except when --target is used. In that case, the backup is not being sent to the client, so only server compression is sensible. When -Xstream , which is the default, is used, server-side compression will not be applied to the WAL. To compress the WAL, use client-side compression, or specify -Xfetch ."},{"signature":{"text":"-c {fast|spread} --checkpoint={fast|spread}","url":"/docs/18/app-pgbasebackup.html"},"summary":"Sets checkpoint mode to fast (immediate) or spread (the default) (see Section 25.3.4 )."},{"signature":{"text":"-C --create-slot","url":"/docs/18/app-pgbasebackup.html"},"summary":"Specifies that the replication slot named by the --slot option should be created before starting the backup. An error is raised if the slot already exists."},{"signature":{"text":"-l label --label= label","url":"/docs/18/app-pgbasebackup.html"},"summary":"Sets the label for the backup. If none is specified, a default value of “ pg_basebackup base backup ” will be used."},{"signature":{"text":"-n --no-clean","url":"/docs/18/app-pgbasebackup.html"},"summary":"By default, when pg_basebackup aborts with an error, it removes any directories it might have created before discovering that it cannot finish the job (for example, the target directory and write-ahead log directory). This option inhibits tidying-up and is thus useful for debugging."},{"signature":{"text":"-N --no-sync","url":"/docs/18/app-pgbasebackup.html"},"summary":"By default, pg_basebackup will wait for all files to be written safely to disk. This option causes pg_basebackup to return without waiting, which is faster, but means that a subsequent operating system crash can leave the base backup corrupt. Generally, this option is useful for testing but should not be used when creating a production installation."},{"signature":{"text":"-P --progress","url":"/docs/18/app-pgbasebackup.html"},"summary":"Enables progress reporting. Turning this on will deliver an approximate progress report during the backup. Since the database may change during the backup, this is only an approximation and may not end at exactly 100% . In particular, when WAL log is included in the backup, the total amount of data cannot be estimated in advance, and in this case the estimated target size will increase once it passes the total estimate without WAL."},{"signature":{"text":"-r rate --max-rate= rate","url":"/docs/18/app-pgbasebackup.html"},"summary":"Sets the maximum transfer rate at which data is collected from the source server. This can be useful to limit the impact of pg_basebackup on the server. Values are in kilobytes per second. Use a suffix of M to indicate megabytes per second. A suffix of k is also accepted, and has no effect. Valid values are between 32 kilobytes per second and 1024 megabytes per second."},{"signature":{"text":"-S slotname --slot= slotname","url":"/docs/18/app-pgbasebackup.html"},"summary":"This option can only be used together with -X stream . It causes WAL streaming to use the specified replication slot. If the base backup is intended to be used as a streaming-replication standby using a replication slot, the standby should then use the same replication slot name as primary_slot_name . This ensures that the primary server does not remove any necessary WAL data in the time between the end of the base backup and the start of streaming replication on the new standby."},{"signature":{"text":"--sync-method= method","url":"/docs/18/app-pgbasebackup.html"},"summary":"When set to fsync , which is the default, pg_basebackup will recursively open and synchronize all files in the backup directory. When the plain format is used, the search for files will follow symbolic links for the WAL directory and each configured tablespace."},{"signature":{"text":"-v --verbose","url":"/docs/18/app-pgbasebackup.html"},"summary":"Enables verbose mode. Will output some extra steps during startup and shutdown, as well as show the exact file name that is currently being processed if progress reporting is also enabled."},{"signature":{"text":"--manifest-checksums= algorithm","url":"/docs/18/app-pgbasebackup.html"},"summary":"Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are NONE , CRC32C , SHA224 , SHA256 , SHA384 , and SHA512 . The default is CRC32C ."},{"signature":{"text":"--manifest-force-encode","url":"/docs/18/app-pgbasebackup.html"},"summary":"Forces all filenames in the backup manifest to be hex-encoded. If this option is not specified, only non-UTF8 filenames are hex-encoded. This option is mostly intended to test that tools which read a backup manifest file properly handle this case."},{"signature":{"text":"--no-estimate-size","url":"/docs/18/app-pgbasebackup.html"},"summary":"Prevents the server from estimating the total amount of backup data that will be streamed, resulting in the backup_total column in the pg_stat_progress_basebackup view always being NULL ."},{"signature":{"text":"--no-manifest","url":"/docs/18/app-pgbasebackup.html"},"summary":"Disables generation of a backup manifest. If this option is not specified, the server will generate and send a backup manifest which can be verified using pg_verifybackup . The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and an optional checksum for each file."},{"signature":{"text":"--no-slot","url":"/docs/18/app-pgbasebackup.html"},"summary":"Prevents the creation of a temporary replication slot for the backup."},{"signature":{"text":"--no-verify-checksums","url":"/docs/18/app-pgbasebackup.html"},"summary":"Disables verification of checksums, if they are enabled on the server the base backup is taken from."},{"signature":{"text":"-d connstr --dbname= connstr","url":"/docs/18/app-pgbasebackup.html"},"summary":"Specifies parameters used to connect to the server, as a connection string ; these will override any conflicting command line options."},{"signature":{"text":"-h host --host= host","url":"/docs/18/app-pgbasebackup.html"},"summary":"Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for a Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-pgbasebackup.html"},"summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."},{"signature":{"text":"-s interval --status-interval= interval","url":"/docs/18/app-pgbasebackup.html"},"summary":"Specifies the number of seconds between status packets sent back to the source server. Smaller values allow more accurate monitoring of backup progress from the server. A value of zero disables periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout-based disconnects. The default value is 10 seconds."},{"signature":{"text":"-U username --username= username","url":"/docs/18/app-pgbasebackup.html"},"summary":"Specifies the user name to connect as."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-pgbasebackup.html"},"summary":"Prevents issuing a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"signature":{"text":"-W --password","url":"/docs/18/app-pgbasebackup.html"},"summary":"Forces pg_basebackup to prompt for a password before connecting to the source server."},{"signature":{"text":"-V --version","url":"/docs/18/app-pgbasebackup.html"},"summary":"Prints the pg_basebackup version and exits."},{"signature":{"text":"-? --help","url":"/docs/18/app-pgbasebackup.html"},"summary":"Shows help about pg_basebackup command line arguments, and exits."}],"title":"Documented options"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
