pg_dumpall.sgml
来自「postgresql8.3.4源码,开源数据库」· SGML 代码 · 共 490 行 · 第 1/2 页
SGML
490 行
</para> </listitem> </varlistentry> <varlistentry> <term><option>-v</></term> <term><option>--verbose</></term> <listitem> <para> Specifies verbose mode. This will cause <application>pg_dumpall</application> to output start/stop times to the dump file, and progress messages to standard error. It will also enable verbose output in <application>pg_dump</>. </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_dumpall</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> </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. </para> </listitem> </varlistentry> </variablelist> </para> <para> The following command-line options control the database connection parameters. <variablelist> <varlistentry> <term>-h <replaceable>host</replaceable></term> <term>--host=<replaceable>host</replaceable></term> <listitem> <para> Specifies the host name of the machine on which the database server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the <envar>PGHOST</envar> environment variable, if set, else a Unix domain socket connection is attempted. </para> </listitem> </varlistentry> <varlistentry> <term>-l <replaceable>dbname</replaceable></term> <term>--database=<replaceable>dbname</replaceable></term> <listitem> <para> Specifies the name of the database to connect to to dump global objects and discover what other databases should be dumped. If not specified, the <quote>postgres</quote> database will be used, and if that does not exist, <quote>template1</quote> will be used. </para> </listitem> </varlistentry> <varlistentry> <term>-p <replaceable>port</replaceable></term> <term>--port=<replaceable>port</replaceable></term> <listitem> <para> Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the <envar>PGPORT</envar> environment variable, if set, or a compiled-in default. </para> </listitem> </varlistentry> <varlistentry> <term>-U <replaceable>username</replaceable></term> <term>--username=<replaceable>username</replaceable></term> <listitem> <para> User name to connect as. </para> </listitem> </varlistentry> <varlistentry> <term>-W</term> <term>--password</term> <listitem> <para> Force <application>pg_dumpall</application> to prompt for a password before connecting to a database. </para> <para> This option is never essential, since <application>pg_dumpall</application> will automatically prompt for a password if the server demands password authentication. However, <application>pg_dumpall</application> will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing <option>-W</> to avoid the extra connection attempt. </para> <para> Note that the password prompt will occur again for each database to be dumped. Usually, it's better to set up a <filename>~/.pgpass</> file than to rely on manual password entry. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1> <title>Environment</title> <variablelist> <varlistentry> <term><envar>PGHOST</envar></term> <term><envar>PGPORT</envar></term> <term><envar>PGUSER</envar></term> <listitem> <para> Default connection parameters </para> </listitem> </varlistentry> </variablelist> <para> This utility, like most other <productname>PostgreSQL</> utilities, also uses the environment variables supported by <application>libpq</> (see <xref linkend="libpq-envars">). </para> </refsect1> <refsect1> <title>Notes</title> <para> Since <application>pg_dumpall</application> calls <application>pg_dump</application> internally, some diagnostic messages will refer to <application>pg_dump</application>. </para> <para> Once restored, it is wise to run <command>ANALYZE</> on each database so the optimizer has useful statistics. You can also run <command>vacuumdb -a -z</> to analyze all databases. </para> <para> <application>pg_dumpall</application> requires all needed tablespace directories to exist before the restore or database creation will fail for databases in non-default locations. </para> </refsect1> <refsect1 id="app-pg-dumpall-ex"> <title>Examples</title> <para> To dump all databases:<screen><prompt>$</prompt> <userinput>pg_dumpall > db.out</userinput></screen> </para> <para> To reload this database use, for example:<screen><prompt>$</prompt> <userinput>psql -f db.out postgres</userinput></screen> (It is not important to which database you connect here since the script file created by <application>pg_dumpall</application> will contain the appropriate commands to create and connect to the saved databases.) </para> </refsect1> <refsect1> <title>See Also</title> <para> Check <xref linkend="app-pgdump"> for details on possible error conditions. </para> </refsect1> </refentry>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?