📄 pg_dump.sgml
字号:
<para> Ignore version mismatch between <application>pg_dump</application> and the database server. </para> <para> <application>pg_dump</application> can dump from servers running previous releases of <productname>PostgreSQL</>, but very old versions are not supported anymore (currently, those prior to 7.0). Dumping from a server newer than <application>pg_dump</application> is likely not to work at all. Use this option if you need to override the version check (and if <application>pg_dump</application> then fails, don't say you weren't warned). </para> </listitem> </varlistentry> <varlistentry> <term><option>-n <replaceable class="parameter">schema</replaceable></option></term> <term><option>--schema=<replaceable class="parameter">schema</replaceable></option></term> <listitem> <para> Dump only schemas matching <replaceable class="parameter">schema</replaceable>; this selects both the schema itself, and all its contained objects. When this option is not specified, all non-system schemas in the target database will be dumped. Multiple schemas can be selected by writing multiple <option>-n</> switches. Also, the <replaceable class="parameter">schema</replaceable> parameter is interpreted as a pattern according to the same rules used by <application>psql</>'s <literal>\d</> commands (see <xref linkend="APP-PSQL-patterns" endterm="APP-PSQL-patterns-title">), so multiple schemas can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards. </para> <note> <para> When <option>-n</> is specified, <application>pg_dump</application> makes no attempt to dump any other database objects that the selected schema(s) might depend upon. Therefore, there is no guarantee that the results of a specific-schema dump can be successfully restored by themselves into a clean database. </para> </note> <note> <para> Non-schema objects such as blobs are not dumped when <option>-n</> is specified. You can add blobs back to the dump with the <option>--blobs</> switch. </para> </note> </listitem> </varlistentry> <varlistentry> <term><option>-N <replaceable class="parameter">schema</replaceable></option></term> <term><option>--exclude-schema=<replaceable class="parameter">schema</replaceable></option></term> <listitem> <para> Do not dump any schemas matching the <replaceable class="parameter">schema</replaceable> pattern. The pattern is interpreted according to the same rules as for <option>-n</>. <option>-N</> can be given more than once to exclude schemas matching any of several patterns. </para> <para> When both <option>-n</> and <option>-N</> are given, the behavior is to dump just the schemas that match at least one <option>-n</> switch but no <option>-N</> switches. If <option>-N</> appears without <option>-n</>, then schemas matching <option>-N</> are excluded from what is otherwise a normal dump. </para> </listitem> </varlistentry> <varlistentry> <term><option>-o</></term> <term><option>--oids</></term> <listitem> <para> Dump object identifiers (<acronym>OID</acronym>s) as part of the data for every table. Use this option if your application references the <acronym>OID</> columns in some way (e.g., in a foreign key constraint). Otherwise, this option should not be used. </para> </listitem> </varlistentry> <varlistentry> <term><option>-O</></term> <term><option>--no-owner</option></term> <listitem> <para> Do not output commands to set ownership of objects to match the original database. By default, <application>pg_dump</application> issues <command>ALTER OWNER</> or <command>SET SESSION AUTHORIZATION</command> statements to set ownership of created database objects. These statements will fail when the script is run unless it is started by a superuser (or the same user that owns all of the objects in the script). To make a script that can be restored by any user, but will give that user ownership of all the objects, specify <option>-O</>. </para> <para> This option is only meaningful for the plain-text format. For the archive formats, you can specify the option when you call <command>pg_restore</command>. </para> </listitem> </varlistentry> <varlistentry> <term><option>-R</option></term> <term><option>--no-reconnect</option></term> <listitem> <para> This option is obsolete but still accepted for backwards compatibility. </para> </listitem> </varlistentry> <varlistentry> <term><option>-s</option></term> <term><option>--schema-only</option></term> <listitem> <para> Dump only the object definitions (schema), not data. </para> </listitem> </varlistentry> <varlistentry> <term><option>-S <replaceable class="parameter">username</replaceable></option></term> <term><option>--superuser=<replaceable class="parameter">username</replaceable></option></term> <listitem> <para> Specify the superuser user name to use when disabling triggers. This is only relevant if <option>--disable-triggers</> is used. (Usually, it's better to leave this out, and instead start the resulting script as superuser.) </para> </listitem> </varlistentry> <varlistentry> <term><option>-t <replaceable class="parameter">table</replaceable></option></term> <term><option>--table=<replaceable class="parameter">table</replaceable></option></term> <listitem> <para> Dump only tables (or views or sequences) matching <replaceable class="parameter">table</replaceable>. Multiple tables can be selected by writing multiple <option>-t</> switches. Also, the <replaceable class="parameter">table</replaceable> parameter is interpreted as a pattern according to the same rules used by <application>psql</>'s <literal>\d</> commands (see <xref linkend="APP-PSQL-patterns" endterm="APP-PSQL-patterns-title">), so multiple tables can also be selected by writing wildcard characters in the pattern. When using wildcards, be careful to quote the pattern if needed to prevent the shell from expanding the wildcards. </para> <para> The <option>-n</> and <option>-N</> switches have no effect when <option>-t</> is used, because tables selected by <option>-t</> will be dumped regardless of those switches, and non-table objects will not be dumped. </para> <note> <para> When <option>-t</> is specified, <application>pg_dump</application> makes no attempt to dump any other database objects that the selected table(s) might depend upon. Therefore, there is no guarantee that the results of a specific-table dump can be successfully restored by themselves into a clean database. </para> </note> <note> <para> The behavior of the <option>-t</> switch is not entirely upward compatible with pre-8.2 <productname>PostgreSQL</productname> versions. Formerly, writing <literal>-t tab</> would dump all tables named <literal>tab</>, but now it just dumps whichever one is visible in your default search path. To get the old behavior you can write <literal>-t '*.tab'</>. Also, you must write something like <literal>-t sch.tab</> to select a table in a particular schema, rather than the old locution of <literal>-n sch -t tab</>. </para> </note> </listitem> </varlistentry> <varlistentry> <term><option>-T <replaceable class="parameter">table</replaceable></option></term> <term><option>--exclude-table=<replaceable class="parameter">table</replaceable></option></term> <listitem> <para> Do not dump any tables matching the <replaceable class="parameter">table</replaceable> pattern. The pattern is interpreted according to the same rules as for <option>-t</>. <option>-T</> can be given more than once to exclude tables matching any of several patterns. </para> <para> When both <option>-t</> and <option>-T</> are given, the behavior is to dump just the tables that match at least one <option>-t</> switch but no <option>-T</> switches. If <option>-T</> appears without <option>-t</>, then tables matching <option>-T</> are excluded from what is otherwise a normal dump. </para> </listitem> </varlistentry> <varlistentry> <term><option>-v</></term> <term><option>--verbose</></term> <listitem> <para> Specifies verbose mode. This will cause <application>pg_dump</application> to output detailed object comments and start/stop times to the dump file, and progress messages to standard error. </para> </listitem> </varlistentry> <varlistentry> <term><option>-x</></term> <term><option>--no-privileges</></term> <term><option>--no-acl</></term> <listitem> <para> Prevent dumping of access privileges (grant/revoke commands). </para> </listitem> </varlistentry> <varlistentry> <term><option>--disable-dollar-quoting</></term> <listitem> <para> This option disables the use of dollar quoting for function bodies, and forces them to be quoted using SQL standard string syntax. </para> </listitem> </varlistentry> <varlistentry> <term><option>--disable-triggers</></term> <listitem> <para> This option is only relevant when creating a data-only dump. It instructs <application>pg_dump</application> to include commands to temporarily disable triggers on the target tables while the data is reloaded. Use this if you have referential integrity checks or other triggers on the tables that you do not want to invoke during data reload. </para> <para> Presently, the commands emitted for <option>--disable-triggers</> must be done as superuser. So, you should also specify a superuser name with <option>-S</>, or preferably be careful to start the resulting script as a superuser. </para> <para> This option is only meaningful for the plain-text format. For the archive formats, you can specify the option when you call <command>pg_restore</command>. </para> </listitem> </varlistentry> <varlistentry> <term><option>--use-set-session-authorization</></term> <listitem> <para> Output SQL-standard <command>SET SESSION AUTHORIZATION</> commands instead of <command>ALTER OWNER</> commands to determine object ownership. This makes the dump more standards compatible, but depending on the history of the objects in the dump, might not restore properly. Also, a dump using <command>SET SESSION AUTHORIZATION</> will certainly require superuser privileges to restore correctly,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -