.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "PGCOPYDB" "1" "Mar 15, 2023" "0.11" "pgcopydb" .SH NAME pgcopydb \- pgcopydb .sp pgcopydb \- copy an entire Postgres database from source to target .SH SYNOPSIS .sp pgcopydb provides the following commands: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C pgcopydb clone Clone an entire database from source to target fork Clone an entire database from source to target follow Replay changes from the source database to the target database snapshot Create and exports a snapshot on the source database + copy Implement the data section of the database copy + dump Dump database objects from a Postgres instance + restore Restore database objects into a Postgres instance + list List database objects from a Postgres instance + stream Stream changes from the source database help print help message version print pgcopydb version .ft P .fi .UNINDENT .UNINDENT .SH DESCRIPTION .sp The pgcopydb command implements a full migration of an entire Postgres database from a source instance to a target instance. Both the Postgres instances must be available for the entire duration of the command. .sp The pgcopydb command also implements a full \fI\%Logical Decoding\fP client for Postgres, allowing Change Data Capture to replay data changes (DML) happening on the source database after the base copy snapshot. The pgcopydb logical decoding client code is compatible with both \fI\%test_decoding\fP and \fI\%wal2json\fP output plugins, and defaults to using test_decoding. .SH PGCOPYDB HELP .sp The \fBpgcopydb help\fP command lists all the supported sub\-commands: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ pgcopydb help pgcopydb clone Clone an entire database from source to target fork Clone an entire database from source to target follow Replay changes from the source database to the target database copy\-db Clone an entire database from source to target snapshot Create and exports a snapshot on the source database + copy Implement the data section of the database copy + dump Dump database objects from a Postgres instance + restore Restore database objects into a Postgres instance + list List database objects from a Postgres instance + stream Stream changes from the source database ping Copy the roles from the source instance to the target instance help print help message version print pgcopydb version pgcopydb copy db Copy an entire database from source to target roles Copy the roles from the source instance to the target instance extensions Copy the extensions from the source instance to the target instance schema Copy the database schema from source to target data Copy the data section from source to target table\-data Copy the data from all tables in database from source to target blobs Copy the blob data from ther source database to the target sequences Copy the current value from all sequences in database from source to target indexes Create all the indexes found in the source database in the target constraints Create all the constraints found in the source database in the target pgcopydb dump schema Dump source database schema as custom files in work directory pre\-data Dump source database pre\-data schema as custom files in work directory post\-data Dump source database post\-data schema as custom files in work directory roles Dump source database roles as custome file in work directory pgcopydb restore schema Restore a database schema from custom files to target database pre\-data Restore a database pre\-data schema from custom file to target database post\-data Restore a database post\-data schema from custom file to target database roles Restore database roles from SQL file to target database parse\-list Parse pg_restore \-\-list output from custom file pgcopydb list extensions List all the source extensions to copy collations List all the source collations to copy tables List all the source tables to copy data from table\-parts List a source table copy partitions sequences List all the source sequences to copy data from indexes List all the indexes to create again after copying the data depends List all the dependencies to filter\-out schema List the schema to migrate, formatted in JSON progress List the progress pgcopydb stream setup Setup source and target systems for logical decoding cleanup cleanup source and target systems for logical decoding prefetch Stream JSON changes from the source database and transform them to SQL catchup Apply prefetched changes from SQL files to the target database replay Replay changes from the source to the target database, live + create Create resources needed for pgcopydb + drop Drop resources needed for pgcopydb + sentinel Maintain a sentinel table on the source database receive Stream changes from the source database transform Transform changes from the source database into SQL commands apply Apply changes from the source database into the target database pgcopydb stream create slot Create a replication slot in the source database origin Create a replication origin in the target database pgcopydb stream drop slot Drop a replication slot in the source database origin Drop a replication origin in the target database pgcopydb stream sentinel create Create the sentinel table on the source database drop Drop the sentinel table on the source database get Get the sentinel table values on the source database + set Maintain a sentinel table on the source database pgcopydb stream sentinel set startpos Set the sentinel start position LSN on the source database endpos Set the sentinel end position LSN on the source database apply Set the sentinel apply mode on the source database prefetch Set the sentinel prefetch mode on the source database .ft P .fi .UNINDENT .UNINDENT .SH PGCOPYDB VERSION .sp The \fBpgcopydb version\fP command outputs the version string of the version of pgcopydb used, and can do that in the JSON format when using the \fB\-\-json\fP option. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ pgcopydb version pgcopydb version 0.8 compiled with PostgreSQL 12.12 on x86_64\-apple\-darwin16.7.0, compiled by Apple LLVM version 8.1.0 (clang\-802.0.42), 64\-bit compatible with Postgres 10, 11, 12, 13, and 14 .ft P .fi .UNINDENT .UNINDENT .sp In JSON: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ pgcopydb version \-\-json { \(dqpgcopydb\(dq: \(dq0.8\(dq, \(dqpg_major\(dq: \(dq12\(dq, \(dqpg_version\(dq: \(dq12.12\(dq, \(dqpg_version_str\(dq: \(dqPostgreSQL 12.12 on x86_64\-apple\-darwin16.7.0, compiled by Apple LLVM version 8.1.0 (clang\-802.0.42), 64\-bit\(dq, \(dqpg_version_num\(dq: 120012 } .ft P .fi .UNINDENT .UNINDENT .sp The details about the Postgres version applies to the version that\(aqs been used to build pgcopydb from sources, so that\(aqs the version of the client library \fBlibpq\fP really. .SH PGCOPYDB PING .sp The \fBpgcopydb ping\fP command attempts to connect to both the source and the target Postgres databases, concurrently. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C pgcopydb ping: Copy the roles from the source instance to the target instance usage: pgcopydb ping \-\-source ... \-\-target ... \-\-source Postgres URI to the source database \-\-target Postgres URI to the target database .ft P .fi .UNINDENT .UNINDENT .sp An example output looks like the following: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ pgcopydb ping 18:04:48 84679 INFO Running pgcopydb version 0.10.31.g7e5fbb8.dirty from \(dq/Users/dim/dev/PostgreSQL/pgcopydb/src/bin/pgcopydb/pgcopydb\(dq 18:04:48 84683 INFO Successfully could connect to target database at \(dqpostgres://@:/plop?\(dq 18:04:48 84682 INFO Successfully could connect t source database at \(dqpostgres://@:/pagila?\(dq .ft P .fi .UNINDENT .UNINDENT .sp This command implements a retry policy (named \fIDecorrelated Jitter\fP) and can be used in automation to make sure that the databases are ready to accept connections. .SH AUTHOR Dimitri Fontaine .SH COPYRIGHT 2023, Dimitri Fontaine .\" Generated by docutils manpage writer. .