.\" 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 DUMP" "1" "Mar 15, 2023" "0.11" "pgcopydb" .SH NAME pgcopydb dump \- pgcopydb dump .sp pgcopydb dump \- Dump database objects from a Postgres instance .sp This command prefixes the following sub\-commands: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C pgcopydb dump schema Dump source database schema as custom files in target directory pre\-data Dump source database pre\-data schema as custom files in target directory post\-data Dump source database post\-data schema as custom files in target directory roles Dump source database roles as custome file in work directory .ft P .fi .UNINDENT .UNINDENT .SH PGCOPYDB DUMP SCHEMA .sp pgcopydb dump schema \- Dump source database schema as custom files in target directory .sp The command \fBpgcopydb dump schema\fP uses pg_dump to export SQL schema definitions from the given source Postgres instance. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C pgcopydb dump schema: Dump source database schema as custom files in target directory usage: pgcopydb dump schema \-\-source \-\-target \-\-source Postgres URI to the source database \-\-target Directory where to save the dump files \-\-dir Work directory to use \-\-snapshot Use snapshot obtained with pg_export_snapshot .ft P .fi .UNINDENT .UNINDENT .SH PGCOPYDB DUMP PRE-DATA .sp pgcopydb dump pre\-data \- Dump source database pre\-data schema as custom files in target directory .sp The command \fBpgcopydb dump pre\-data\fP uses pg_dump to export SQL schema \fIpre\-data\fP definitions from the given source Postgres instance. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C pgcopydb dump pre\-data: Dump source database pre\-data schema as custom files in target directory usage: pgcopydb dump schema \-\-source \-\-target \-\-source Postgres URI to the source database \-\-target Directory where to save the dump files \-\-dir Work directory to use \-\-snapshot Use snapshot obtained with pg_export_snapshot .ft P .fi .UNINDENT .UNINDENT .SH PGCOPYDB DUMP POST-DATA .sp pgcopydb dump post\-data \- Dump source database post\-data schema as custom files in target directory .sp The command \fBpgcopydb dump post\-data\fP uses pg_dump to export SQL schema \fIpost\-data\fP definitions from the given source Postgres instance. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C pgcopydb dump post\-data: Dump source database post\-data schema as custom files in target directory usage: pgcopydb dump schema \-\-source \-\-target \-\-source Postgres URI to the source database \-\-target Directory where to save the dump files \-\-dir Work directory to use \-\-snapshot Use snapshot obtained with pg_export_snapshot .ft P .fi .UNINDENT .UNINDENT .SH PGCOPYDB DUMP ROLES .sp pgcopydb dump roles \- Dump source database roles as custome file in work directory .sp The command \fBpgcopydb dump roles\fP uses pg_dumpall \-\-roles\-only to export SQL definitions of the roles found on the source Postgres instance. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C pgcopydb dump roles: Dump source database roles as custome file in work directory usage: pgcopydb dump roles \-\-source \-\-source Postgres URI to the source database \-\-target Directory where to save the dump files \-\-dir Work directory to use \-\-no\-role\-passwords Do not dump passwords for roles .ft P .fi .UNINDENT .UNINDENT .sp The \fBpg_dumpall \-\-roles\-only\fP is used to fetch the list of roles from the source database, and this command includes support for passwords. As a result, this operation requires the superuser privileges. .sp It is possible to use the option \fB\-\-no\-role\-passwords\fP to operate without superuser privileges. In that case though, the passwords are not part of the dump and authentication might fail until passwords have been setup properly. .SH DESCRIPTION .sp The \fBpgcopydb dump schema\fP command implements the first step of the full database migration and fetches the schema definitions from the source database. .sp When the command runs, it calls \fBpg_dump\fP to get first the pre\-data schema output in a Postgres custom file, and then again to get the post\-data schema output in another Postgres custom file. .sp The output files are written to the \fBschema\fP sub\-directory of the \fB\-\-target\fP directory. .sp The \fBpgcopydb dump pre\-data\fP and \fBpgcopydb dump post\-data\fP are limiting their action to respectively the pre\-data and the post\-data sections of the pg_dump. .SH OPTIONS .sp The following options are available to \fBpgcopydb dump schema\fP: .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\(dqhost=... dbname=...\(dq\fP and the URI form \fBpostgres://user@host:5432/dbname\fP are supported. .TP .B \-\-target Connection string to the target Postgres instance. .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 \-\-no\-role\-passwords Do not dump passwords for roles. When restored, roles will have a null password, and password authentication will always fail until the password is set. Since password values aren\(aqt needed when this option is specified, the role information is read from the catalog view pg_roles instead of pg_authid. Therefore, this option also helps if access to pg_authid is restricted by some security policy. .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 \-\-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 First, using \fBpgcopydb dump schema\fP .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ pgcopydb dump schema \-\-source \(dqport=5501 dbname=demo\(dq \-\-target /tmp/target 09:35:21 3926 INFO Dumping database from \(dqport=5501 dbname=demo\(dq 09:35:21 3926 INFO Dumping database into directory \(dq/tmp/target\(dq 09:35:21 3926 INFO Found a stale pidfile at \(dq/tmp/target/pgcopydb.pid\(dq 09:35:21 3926 WARN Removing the stale pid file \(dq/tmp/target/pgcopydb.pid\(dq 09:35:21 3926 INFO Using pg_dump for Postgres \(dq12.9\(dq at \(dq/Applications/Postgres.app/Contents/Versions/12/bin/pg_dump\(dq 09:35:21 3926 INFO /Applications/Postgres.app/Contents/Versions/12/bin/pg_dump \-Fc \-\-section pre\-data \-\-file /tmp/target/schema/pre.dump \(aqport=5501 dbname=demo\(aq 09:35:22 3926 INFO /Applications/Postgres.app/Contents/Versions/12/bin/pg_dump \-Fc \-\-section post\-data \-\-file /tmp/target/schema/post.dump \(aqport=5501 dbname=demo\(aq .ft P .fi .UNINDENT .UNINDENT .sp Once the previous command is finished, the pg_dump output files can be found in \fB/tmp/target/schema\fP and are named \fBpre.dump\fP and \fBpost.dump\fP\&. Other files and directories have been created. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ find /tmp/target /tmp/target /tmp/target/pgcopydb.pid /tmp/target/schema /tmp/target/schema/post.dump /tmp/target/schema/pre.dump /tmp/target/run /tmp/target/run/tables /tmp/target/run/indexes .ft P .fi .UNINDENT .UNINDENT .sp Then we have almost the same thing when using the other forms. .sp We can see that \fBpgcopydb dump pre\-data\fP only does the pre\-data section of the dump. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ pgcopydb dump pre\-data \-\-source \(dqport=5501 dbname=demo\(dq \-\-target /tmp/target 09:35:21 3926 INFO Dumping database from \(dqport=5501 dbname=demo\(dq 09:35:21 3926 INFO Dumping database into directory \(dq/tmp/target\(dq 09:35:21 3926 INFO Found a stale pidfile at \(dq/tmp/target/pgcopydb.pid\(dq 09:35:21 3926 WARN Removing the stale pid file \(dq/tmp/target/pgcopydb.pid\(dq 09:35:21 3926 INFO Using pg_dump for Postgres \(dq12.9\(dq at \(dq/Applications/Postgres.app/Contents/Versions/12/bin/pg_dump\(dq 09:35:21 3926 INFO /Applications/Postgres.app/Contents/Versions/12/bin/pg_dump \-Fc \-\-section pre\-data \-\-file /tmp/target/schema/pre.dump \(aqport=5501 dbname=demo\(aq .ft P .fi .UNINDENT .UNINDENT .sp And then \fBpgcopydb dump post\-data\fP only does the post\-data section of the dump. .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ pgcopydb dump post\-data \-\-source \(dqport=5501 dbname=demo\(dq \-\-target /tmp/target 09:35:21 3926 INFO Dumping database from \(dqport=5501 dbname=demo\(dq 09:35:21 3926 INFO Dumping database into directory \(dq/tmp/target\(dq 09:35:21 3926 INFO Found a stale pidfile at \(dq/tmp/target/pgcopydb.pid\(dq 09:35:21 3926 WARN Removing the stale pid file \(dq/tmp/target/pgcopydb.pid\(dq 09:35:21 3926 INFO Using pg_dump for Postgres \(dq12.9\(dq at \(dq/Applications/Postgres.app/Contents/Versions/12/bin/pg_dump\(dq 09:35:21 3926 INFO /Applications/Postgres.app/Contents/Versions/12/bin/pg_dump \-Fc \-\-section post\-data \-\-file /tmp/target/schema/post.dump \(aqport=5501 dbname=demo\(aq .ft P .fi .UNINDENT .UNINDENT .SH AUTHOR Dimitri Fontaine .SH COPYRIGHT 2023, Dimitri Fontaine .\" Generated by docutils manpage writer. .