.\" 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 SNAPSHOT" "1" "Nov 03, 2022" "0.10" "pgcopydb" .SH NAME pgcopydb snapshot \- pgcopydb snapshot .sp pgcopydb snapshot \- Create and exports a snapshot on the source database .sp The command \fBpgcopydb snapshot\fP connects to the source database and executes a SQL query to export a snapshot. The obtained snapshot is both printed on stdout and also in a file where other pgcopydb commands might expect to find it. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C pgcopydb snapshot: Create and exports a snapshot on the source database usage: pgcopydb snapshot \-\-source ... \-\-source Postgres URI to the source database \-\-dir Work directory to use .ft P .fi .UNINDENT .UNINDENT .SH OPTIONS .sp The following options are available to \fBpgcopydb create\fP and \fBpgcopydb drop\fP subcommands: .INDENT 0.0 .TP .B \-\-source Connection string to the source Postgres instance. See the Postgres documentation for \fI\%connection strings\fP for the details. In short both the quoted form \fB"host=... dbname=..."\fP and the URI form \fBpostgres://user@host:5432/dbname\fP are supported. .TP .B \-\-dir During its normal operations pgcopydb creates a lot of temporary files to track sub\-processes progress. Temporary files are created in the directory location given by this option, or defaults to \fB${TMPDIR}/pgcopydb\fP when the environment variable is set, or then to \fB/tmp/pgcopydb\fP\&. .TP .B \-\-snapshot Instead of exporting its own snapshot by calling the PostgreSQL function \fBpg_export_snapshot()\fP it is possible for pgcopydb to re\-use an already exported snapshot. .TP .B \-\-slot\-name Logical replication slot name to use, default to \fBpgcopydb\fP\&. The slot should be created within the same transaction snapshot as the initial data copy. .sp Must be using the \fI\%wal2json\fP output plugin, available with format\-version 2. .TP .B \-\-origin Logical replication target system needs to track the transactions that have been applied already, so that in case we get disconnected or need to resume operations we can skip already replayed transaction. .sp Postgres uses a notion of an origin node name as documented in \fI\%Replication Progress Tracking\fP\&. This option allows to pick your own node name and defaults to "pgcopydb". Picking a different name is useful in some advanced scenarios like migrating several sources in the same target, where each source should have their own unique origin node name. .TP .B \-\-startpos Logical replication target system registers progress by assigning a current LSN to the \fB\-\-origin\fP node name. When creating an origin on the target database system, it is required to provide the current LSN from the source database system, in order to properly bootstrap pgcopydb logical decoding. .TP .B \-\-verbose Increase current verbosity. The default level of verbosity is INFO. In ascending order pgcopydb knows about the following verbosity levels: FATAL, ERROR, WARN, INFO, NOTICE, DEBUG, TRACE. .TP .B \-\-debug Set current verbosity to DEBUG level. .TP .B \-\-trace Set current verbosity to TRACE level. .TP .B \-\-quiet Set current verbosity to ERROR level. .UNINDENT .SH ENVIRONMENT .sp PGCOPYDB_SOURCE_PGURI .INDENT 0.0 .INDENT 3.5 Connection string to the source Postgres instance. When \fB\-\-source\fP is ommitted from the command line, then this environment variable is used. .UNINDENT .UNINDENT .SH EXAMPLES .sp Create a snapshot on the source database in the background: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ pgcopydb snapshot & [1] 72938 17:31:52 72938 INFO Running pgcopydb version 0.7.13.gcbf2d16.dirty from "/Users/dim/dev/PostgreSQL/pgcopydb/./src/bin/pgcopydb/pgcopydb" 17:31:52 72938 INFO Using work dir "/var/folders/d7/zzxmgs9s16gdxxcm0hs0sssw0000gn/T//pgcopydb" 17:31:52 72938 INFO Removing the stale pid file "/var/folders/d7/zzxmgs9s16gdxxcm0hs0sssw0000gn/T//pgcopydb/pgcopydb.aux.pid" 17:31:52 72938 INFO Work directory "/var/folders/d7/zzxmgs9s16gdxxcm0hs0sssw0000gn/T//pgcopydb" already exists 17:31:52 72938 INFO Exported snapshot "00000003\-000CB5FE\-1" from the source database 00000003\-000CB5FE\-1 .ft P .fi .UNINDENT .UNINDENT .sp And when the process is done, stop maintaining the snapshot in the background: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ kill %1 17:31:56 72938 INFO Asked to terminate, aborting [1]+ Done pgcopydb snapshot .ft P .fi .UNINDENT .UNINDENT .SH AUTHOR Dimitri Fontaine .SH COPYRIGHT 2022, Dimitri Fontaine .\" Generated by docutils manpage writer. .