hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject [11/36] incubator-hawq-docs git commit: moving book configuration to new 'book' branch, for HAWQ-1027
Date Mon, 29 Aug 2016 16:46:46 GMT
http://git-wip-us.apache.org/repos/asf/incubator-hawq-docs/blob/7514e193/reference/cli/client_utilities/dropuser.html.md.erb
----------------------------------------------------------------------
diff --git a/reference/cli/client_utilities/dropuser.html.md.erb b/reference/cli/client_utilities/dropuser.html.md.erb
new file mode 100644
index 0000000..9d888ae
--- /dev/null
+++ b/reference/cli/client_utilities/dropuser.html.md.erb
@@ -0,0 +1,78 @@
+---
+title: dropuser
+---
+
+Removes a database role.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+dropuser [<connection_options>] [-e | --echo] [-i | --interactive] <role_name>
+
+dropuser --help 
+
+dropuser --version
+```
+
+## <a id="topic1__section3"></a>Description
+
+`dropuser` removes an existing role from HAWQ. Only superusers and users with the `CREATEROLE`
privilege can remove roles. To remove a superuser role, you must yourself be a superuser.
+
+`dropuser` is a wrapper around the SQL command `DROP ROLE`.
+
+## <a id="args"></a>Arguments
+
+<dt>**\<role\_name\>**  </dt>
+<dd>The name of the role to be removed. You will be prompted for a name if not specified
on the command line.</dd>
+
+
+## <a id="topic1__section4"></a>Options
+
+<dt>-i, -\\\-interactive  </dt>
+<dd>Prompt for confirmation before actually removing the role.</dd>
+
+<dt>-e, -\\\-echo  </dt>
+<dd>Echo the commands that `dropuser` generates and sends to the server.</dd>
+
+**\<connection_options\>**
+
+<dt>-h, -\\\-host \<host\>  </dt>
+<dd>The host name of the machine on which the HAWQ master database server is running.
If not specified, reads from the environment variable `PGHOST` or defaults to localhost.</dd>
+
+<dt>-p, -\\\-port \<port\>  </dt>
+<dd>The TCP port on which the HAWQ master database server is listening for connections.
If not specified, reads from the environment variable `PGPORT` or defaults to 5432.</dd>
+
+<dt>-U, -\\\-username \<username\>  </dt>
+<dd>The database role name to connect as. If not specified, reads from the environment
variable `PGUSER` or defaults to the current system role name.</dd>
+
+<dt>-w, -\\\-no-password  </dt>
+<dd>Never issue a password prompt. If the server requires password authentication and
a password is not available by other means such as a `.pgpass` file, the connection attempt
will fail. This option can be useful in batch jobs and scripts where no user is present to
enter a password.</dd>
+
+<dt>-W, -\\\-password  </dt>
+<dd>Force a password prompt.</dd>
+
+
+**Other Options**
+
+<dt>-\\\-help  </dt>
+<dd>Displays the online help.</dd>
+
+<dt>-\\\-version  </dt>
+<dd>Displays the version of this utility.</dd>
+
+## <a id="topic1__section6"></a>Examples
+
+To remove the role `joe` using default connection options:
+
+``` shell
+$ dropuser joe
+```
+
+To remove the role `joe` using connection options, with verification, and a peek at the underlying
command:
+
+``` shell
+$ dropuser -p 54321 -h masterhost -i -e joe
+Role "joe" will be permanently removed.
+Are you sure? (y/n) y
+DROP ROLE "joe"
+```

http://git-wip-us.apache.org/repos/asf/incubator-hawq-docs/blob/7514e193/reference/cli/client_utilities/pg_dump.html.md.erb
----------------------------------------------------------------------
diff --git a/reference/cli/client_utilities/pg_dump.html.md.erb b/reference/cli/client_utilities/pg_dump.html.md.erb
new file mode 100644
index 0000000..6758df9
--- /dev/null
+++ b/reference/cli/client_utilities/pg_dump.html.md.erb
@@ -0,0 +1,252 @@
+---
+title: pg_dump
+---
+
+Extracts a database into a single script file or other archive file.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+pg_dump [<connection_options>] [<dump_options>] <dbname>
+
+pg_dump --help
+
+pg_dump --version
+```
+where:
+
+``` pre
+<connection_options> =
+	[-h <host> | --host <host>] 
+	[-p <port> | -- port <port>] 
+	[-U <username> | --username <username>] 
+    [-W | --password] 
+
+<dump_options> =
+	[-a | --data-only]
+	[-b | --blobs]
+	[-c | --clean]
+	[-C | --create]
+	[-d | --inserts]
+	[(-D | --column-inserts) ]
+	[-E <encoding> | --encoding <encoding>]
+	[-f <file> | --file <file>]
+	[-F(p|t|c)] | --format (plain|custom|tar)]
+	[-i | --ignore-version]
+	[-n <schema> | --schema <schema>]
+	[-N <schema> | --exclude-schema <schema>]
+	[-o | --oids]
+	[-O | --no-owner]
+	[-s | --schema-only]
+	[-S <username> | --superuser <username>]
+	[-t <table> | --table <table>]
+	[-T <table> | --exclude-table <table>]
+	[-v | --verbose]
+	[(-x | --no-privileges) ]
+	[--disable-dollar-quoting]
+	[--disable-triggers]
+	[--use-set-session-authorization]
+	[--gp-syntax | --no-gp-syntax]
+	[-Z <0..9> | --compress <0..9>]
+```
+
+
+## <a id="topic1__section3"></a>Description
+
+`pg_dump` is a standard PostgreSQL utility for backing up a database, and is also supported
in HAWQ. It creates a single (non-parallel) dump file.
+
+Use `pg_dump` if you are migrating your data to another database vendor's system, or to another
HAWQ system with a different segment configuration (for example, if the system you are migrating
to has greater or fewer segment instances). To restore, you must use the corresponding [pg\_restore](pg_restore.html#topic1)
utility (if the dump file is in archive format), or you can use a client program such as [psql](psql.html#topic1)
(if the dump file is in plain text format).
+
+Since `pg_dump` is compatible with regular PostgreSQL, it can be used to migrate data into
HAWQ. The `pg_dump` utility in HAWQ is very similar to the PostgreSQL `pg_dump` utility, with
the following exceptions and limitations:
+
+-   If using `pg_dump` to backup a HAWQ database, keep in mind that the dump operation can
take a long time (several hours) for very large databases. Also, you must make sure you have
sufficient disk space to create the dump file.
+-   If you are migrating data from one HAWQ system to another, use the `--gp-syntax` command-line
option to include the `DISTRIBUTED BY` clause in `CREATE TABLE` statements. This ensures that
HAWQ table data is distributed with the correct distribution key columns upon restore.
+
+`pg_dump` makes consistent backups even if the database is being used concurrently. `pg_dump`
does not block other users accessing the database (readers or writers).
+
+When used with one of the archive file formats and combined with `pg_restore`, `pg_dump`
provides a flexible archival and transfer mechanism. `pg_dump` can be used to backup an entire
database, then `pg_restore `can be used to examine the archive and/or select which parts of
the database are to be restored. The most flexible output file format is the *custom* format
(`-Fc`). It allows for selection and reordering of all archived items, and is compressed by
default. The tar format (`-Ft`) is not compressed and it is not possible to reorder data when
loading, but it is otherwise quite flexible. It can be manipulated with standard UNIX tools
such as `tar`.
+
+## <a id="topic1__section4"></a>Options
+
+<dt>**\<dbname\>**</dt>
+<dd>Specifies the name of the database to be dumped. If this is not specified, the
environment variable `PGDATABASE` is used. If that is not set, the user name specified for
the connection is used.</dd>
+
+
+**\<dump_options\>**
+
+<dt>-a, -\\\-data-only  </dt>
+<dd>Dump only the data, not the schema (data definitions). This option is only meaningful
for the plain-text format. For the archive formats, you may specify the option when you call
[pg\_restore](pg_restore.html#topic1).</dd>
+
+<dt>-b, -\\\-blobs  </dt>
+<dd>Include large objects in the dump. This is the default behavior except when `--schema`,
`--table`, or `--schema-only` is specified, so the `-b` switch is only useful to add large
objects to selective dumps.</dd>
+
+<dt>-c, -\\\-clean  </dt>
+<dd>Adds commands to the text output file to clean (drop) database objects prior to
(the commands for) creating them. Note that objects are not dropped before the dump operation
begins, but `DROP` commands are added to the DDL dump output files so that when you use those
files to do a restore, the `DROP` commands are run prior to the `CREATE` commands. This option
is only meaningful for the plain-text format. For the archive formats, you may specify the
option when you call [pg\_restore](pg_restore.html#topic1).</dd>
+
+<dt>-C, -\\\-create  </dt>
+<dd>Begin the output with a command to create the database itself and reconnect to
the created database. (With a script of this form, it doesn't matter which database you connect
to before running the script.) This option is only meaningful for the plain-text format. For
the archive formats, you may specify the option when you call [pg\_restore](pg_restore.html#topic1).</dd>
+
+<dt>-d, -\\\-inserts  </dt>
+<dd>Dump data as `INSERT` commands (rather than `COPY`). This will make restoration
very slow; it is mainly useful for making dumps that can be loaded into non-PostgreSQL-based
databases. Also, since this option generates a separate command for each row, an error in
reloading a row causes only that row to be lost rather than the entire table contents. Note
that the restore may fail altogether if you have rearranged column order. The `-D` option
is safe against column order changes, though even slower.</dd>
+
+<dt>-D, -\\\-column-inserts  </dt>
+<dd>Dump data as `INSERT` commands with explicit column names `(INSERT INTO` \<table\>`(`\<column\>`,
...) VALUES ...)`. This will make restoration very slow; it is mainly useful for making dumps
that can be loaded into non-PostgreSQL-based databases. Also, since this option generates
a separate command for each row, an error in reloading a row causes only that row to be lost
rather than the entire table contents.</dd>
+
+<dt>-E, -\\\-encoding \<encoding\>  </dt>
+<dd>Create the dump in the specified character set encoding. By default, the dump is
created in the database encoding. (Another way to get the same result is to set the `PGCLIENTENCODING`
environment variable to the desired dump encoding.)</dd>
+
+<dt>-f, -\\\-file \<file\> </dt>
+<dd>Send output to the specified file. If this is omitted, the standard output is used.</dd>
+
+<dt>-F(p|c|t), -\\\-format (plain|custom|tar)  </dt>
+<dd>Selects the format of the output. format can be one of the following:
+
+p, plain — Output a plain-text SQL script file (the default).
+
+c, custom — Output a custom archive suitable for input into [pg\_restore](pg_restore.html#topic1).
This is the most flexible format in that it allows reordering of loading data as well as object
definitions. This format is also compressed by default.
+
+t, tar — Output a tar archive suitable for input into [pg\_restore](pg_restore.html#topic1).
Using this archive format allows reordering and/or exclusion of database objects at the time
the database is restored. It is also possible to limit which data is reloaded at restore time.</dd>
+
+<dt>-i, -\\\-ignore-version  </dt>
+<dd>Ignore version mismatch between `pg_dump` and the database server. `pg_dump` can
dump from servers running previous releases of HAWQ (or PostgreSQL), but very old versions
may not be supported anymore. Use this option if you need to override the version check.</dd>
+
+<dt>-n, -\\\-schema \<schema\>  </dt>
+<dd>Dump only schemas matching the schema pattern; 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 `-n`
switches. Also, the schema parameter is interpreted as a pattern according to the same rules
used by `psql`'s` \d` commands, 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.
+
+**Note:** When -n is specified, `pg_dump` makes no attempt to dump any other database objects
that the selected schema(s) may 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.
+
+**Note:** Non-schema objects such as blobs are not dumped when `-n` is specified. You can
add blobs back to the dump with the `--blobs` switch.</dd>
+
+<dt>-N, -\\\-exclude-schema \<schema\>  </dt>
+<dd>Do not dump any schemas matching the schema pattern. The pattern is interpreted
according to the same rules as for `-n`. `-N` can be given more than once to exclude schemas
matching any of several patterns. When both `-n` and `-N` are given, the behavior is to dump
just the schemas that match at least one `-n` switch but no `-N` switches. If `-N` appears
without `-n`, then schemas matching `-N` are excluded from what is otherwise a normal dump.</dd>
+
+<dt>-o, -\\\-oids  </dt>
+<dd>Dump object identifiers (OIDs) as part of the data for every table. Use of this
option is not recommended for files that are intended to be restored into HAWQ.</dd>
+
+<dt>-O, -\\\-no-owner  </dt>
+<dd>Do not output commands to set ownership of objects to match the original database.
By default, `pg_dump` issues `ALTER OWNER` or `SET SESSION AUTHORIZATION` 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 `-O`. This option is only meaningful for the plain-text format. For the
archive formats, you may specify the option when you call [pg\_restore](pg_restore.html#topic1).</dd>
+
+<dt>-s, -\\\-schema-only  </dt>
+<dd>Dump only the object definitions (schema), not data.</dd>
+
+<dt>-S, -\\\-superuser \<username\>  </dt>
+<dd>Specify the superuser user name to use when disabling triggers. This is only relevant
if `--disable-triggers` is used. It is better to leave this out, and instead start the resulting
script as a superuser.
+
+**Note:** HAWQ does not support user-defined triggers.</dd>
+
+<dt>-t, -\\\-table \<table\>  </dt>
+<dd>Dump only tables (or views or sequences) matching the table pattern. Specify the
table in the format `schema.table`.
+
+Multiple tables can be selected by writing multiple `-t` switches. Also, the table parameter
is interpreted as a pattern according to the same rules used by `psql`'s `\d` commands, 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. The `-n` and `-N` switches have no effect when `-t` is used, because tables selected
by `-t` will be dumped regardless of those switches, and non-table objects will not be dumped.
+
+**Note:** When `-t` is specified, `pg_dump` makes no attempt to dump any other database objects
that the selected table(s) may 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.
+Also, `-t` cannot be used to specify a child table partition. To dump a partitioned table,
you must specify the parent table name.</dd>
+
+<dt>-T, -\\\-exclude-table \<table\>  </dt>
+<dd>Do not dump any tables matching the table pattern. The pattern is interpreted according
to the same rules as for `-t`. `-T` can be given more than once to exclude tables matching
any of several patterns. When both `-t` and `-T` are given, the behavior is to dump just the
tables that match at least one `-t` switch but no `-T` switches. If `-T` appears without `-t`,
then tables matching `-T` are excluded from what is otherwise a normal dump.</dd>
+
+<dt>-v, -\\\-verbose  </dt>
+<dd>Specifies verbose mode. This will cause `pg_dump` to output detailed object comments
and start/stop times to the dump file, and progress messages to standard error.</dd>
+
+<dt>-x, -\\\-no-privileges  </dt>
+<dd>Prevent dumping of access privileges (`GRANT/REVOKE` commands).</dd>
+
+<dt>-\\\-disable-dollar-quoting  </dt>
+<dd>This option disables the use of dollar quoting for function bodies, and forces
them to be quoted using SQL standard string syntax.</dd>
+
+<dt>-\\\-disable-triggers  </dt>
+<dd>This option is only relevant when creating a data-only dump. It instructs `pg_dump`
to include commands to temporarily disable triggers on the target tables while the data is
reloaded. Use this if you have triggers on the tables that you do not want to invoke during
data reload. The commands emitted for `--disable-triggers` must be done as superuser. So,
you should also specify a superuser name with `-S`, or preferably be careful to start the
resulting script as a superuser. This option is only meaningful for the plain-text format.
For the archive formats, you may specify the option when you call [pg\_restore](pg_restore.html#topic1).
+
+**Note:** HAWQ does not support user-defined triggers.</dd>
+
+<dt>-\\\-use-set-session-authorization  </dt>
+<dd>Output SQL-standard `SET SESSION AUTHORIZATION` commands instead of `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, may not restore properly. A dump using
`SET SESSION                 AUTHORIZATION` will require superuser privileges to restore correctly,
whereas `ALTER OWNER` requires lesser privileges.</dd>
+
+<dt>-\\\-gp-syntax | -\\\-no-gp-syntax   </dt>
+<dd>Use `--gp-syntax` to dump HAWQ syntax in the `CREATE TABLE` statements. This allows
the distribution policy (`DISTRIBUTED BY` or `DISTRIBUTED RANDOMLY` clauses) of a HAWQ table
to be dumped, which is useful for restoring into other HAWQ systems. The default is to include
HAWQ syntax when connected to a HAWQ system, and to exclude it when connected to a regular
PostgreSQL system.</dd>
+
+<dt>-Z, -\\\-compress 0..9 </dt>
+<dd>Specify the compression level to use in archive formats that support compression.
Currently only the *custom* archive format supports compression.</dd>
+
+
+**\<connection_options\>**
+
+<dt>-h, -\\\-host \<host\> </dt>
+<dd>The host name of the machine on which the HAWQ master database server is running.
If not specified, reads from the environment variable `PGHOST` or defaults to localhost.</dd>
+
+<dt>-p, -\\\-port \<port\>  </dt>
+<dd>The TCP port on which the HAWQ master database server is listening for connections.
If not specified, reads from the environment variable `PGPORT` or defaults to 5432.</dd>
+
+<dt>-U, -\\\-username \<username\>  </dt>
+<dd>The database role name to connect as. If not specified, reads from the environment
variable `PGUSER` or defaults to the current system role name.</dd>
+
+<dt>-W, -\\\-password  </dt>
+<dd>Force a password prompt.</dd>
+
+
+**Other Options**
+
+<dt>-\\\-help  </dt>
+<dd>Displays the online help.</dd>
+
+<dt>-\\\-version  </dt>
+<dd>Displays the version of this utility.</dd>
+
+
+## <a id="topic1__section7"></a>Notes
+
+When a data-only dump is chosen and the option `--disable-triggers` is used, `pg_dump` emits
commands to disable triggers on user tables before inserting the data and commands to re-enable
them after the data has been inserted. If the restore is stopped in the middle, the system
catalogs may be left in the wrong state.
+
+Members of `tar` archives are limited to a size less than 8 GB. (This is an inherent limitation
of the `tar` file format.) Therefore this format cannot be used if the textual representation
of any one table exceeds that size. The total size of a tar archive and any of the other output
formats is not limited, except possibly by the operating system.
+
+The dump file produced by `pg_dump` does not contain the statistics used by the optimizer
to make query planning decisions. Therefore, it is wise to run `ANALYZE` after restoring from
a dump file to ensure good performance.
+
+## <a id="topic1__section8"></a>Examples
+
+Dump a database called `mydb` into a SQL-script file:
+
+``` shell
+$ pg_dump mydb > db.sql
+```
+
+To reload such a script into a (freshly created) database named `newdb`:
+
+``` shell
+$ psql -d newdb -f db.sql
+```
+
+Dump a HAWQ in tar file format and include distribution policy information:
+
+``` shell
+$ pg_dump -Ft --gp-syntax mydb > db.tar
+```
+
+To dump a database into a custom-format archive file:
+
+``` shell
+$ pg_dump -Fc mydb > db.dump
+```
+
+To reload an archive file into a (freshly created) database named `newdb`:
+
+``` shell
+$ pg_restore -d newdb db.dump
+```
+
+**Note:** A warning related to the `gp_enable_column_oriented_table` parameter may appear.
If it does, disregard it.
+
+To dump a single table named `mytab`:
+
+``` shell
+$ pg_dump -t mytab mydb > db.sql
+```
+
+To specify an upper-case or mixed-case name in `-t` and related switches, you need to double-quote
the name; else it will be folded to lower case. But double quotes are special to the shell,
so in turn they must be quoted. Thus, to dump a single table with a mixed-case name, you need
something like:
+
+``` shell
+$ pg_dump -t '"MixedCaseName"' mydb > mytab.sql
+```
+
+## <a id="topic1__section9"></a>See Also
+
+[pg\_dumpall](pg_dumpall.html#topic1), [pg\_restore](pg_restore.html#topic1), [psql](psql.html#topic1)

http://git-wip-us.apache.org/repos/asf/incubator-hawq-docs/blob/7514e193/reference/cli/client_utilities/pg_dumpall.html.md.erb
----------------------------------------------------------------------
diff --git a/reference/cli/client_utilities/pg_dumpall.html.md.erb b/reference/cli/client_utilities/pg_dumpall.html.md.erb
new file mode 100644
index 0000000..7e86fdf
--- /dev/null
+++ b/reference/cli/client_utilities/pg_dumpall.html.md.erb
@@ -0,0 +1,180 @@
+---
+title: pg_dumpall
+---
+
+Extracts all databases in a HAWQ system to a single script file or other archive file.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+pg_dumpall [<options>] ...
+```
+where:
+
+``` pre
+<general options> =
+    [-f | --filespaces] 
+    [-i | --ignore-version ]
+    [--help ]
+    [--version]
+<options controlling output content> =
+    [-a   --dataonly ]
+    [-c | --clean ]
+    [-d | --inserts] 
+    [-D | --column_inserts] 
+    [-F | --filespaces ]
+    [-g | --globals-only]
+    [-o | --oids ]
+    [-d | --inserts] 
+    [-O | --no-owner] 
+    [-r | --resource-queues] 
+    [-s | --schema-only]
+    [-S <username>  | --superuser=<username> ]
+    [-v  | --verbose ]
+    [-x | --no-privileges ] 
+    [--disable-dollar-quoting] 
+    [--disable-triggers] 
+    [--use-set-session-authorization]         
+    [--gp-syntax]     
+    [--no-gp-syntax] 
+<connection_options> =
+    [-h <host> | --host <host>] 
+    [-p <port> | -- port <port>] 
+    [-U <username> | --username <username>] 
+    [-w | --no-password]
+    [-W | --password] 
+    
+```
+
+## <a id="topic1__section3"></a>Description
+
+`pg_dumpall` is a standard PostgreSQL utility for backing up all databases in a HAWQ (or
PostgreSQL) instance, and is also supported in HAWQ. It creates a single (non-parallel) dump
file.
+
+`pg_dumpall` creates a single script file that contains SQL commands that can be used as
input to [psql](psql.html#topic1) to restore the databases. It does this by calling [pg\_dump](pg_dump.html#topic1)
for each database. `pg_dumpall` also dumps global objects that are common to all databases.
(`pg_dump` does not save these objects.) This currently includes information about database
users and groups, and access permissions that apply to databases as a whole.
+
+Since `pg_dumpall` reads tables from all databases you will most likely have to connect as
a database superuser in order to produce a complete dump. Also you will need superuser privileges
to execute the saved script in order to be allowed to add users and groups, and to create
databases.
+
+The SQL script will be written to the standard output. Shell operators should be used to
redirect it into a file.
+
+`pg_dumpall` needs to connect several times to the HAWQ master server (once per database).
If you use password authentication it is likely to ask for a password each time. It is convenient
to have a `~/.pgpass` file in such cases.
+
+## <a id="topic1__section4"></a>Options
+
+**General Options**
+<dt>-f | -\\\-filespaces  </dt>
+<dd>Dump filespace definitions.</dd>
+
+<dt>-i | -\\\-ignore-version  </dt>
+<dd>Ignore version mismatch between [pg\_dump](pg_dump.html#topic1) and the database
server. `pg_dump` can dump from servers running previous releases of HAWQ (or PostgreSQL),
but very old versions may not be supported anymore. Use this option if you need to override
the version check.</dd>
+
+<dt>--help</dt>
+<dd>Displays this help, then exits.</dt>
+
+<dt>--version</dt>
+<dd>Displays the version information for the output.</dd>
+
+**Output Control Options**
+
+<dt>-a | -\\\-data-only  </dt>
+<dd>Dump only the data, not the schema (data definitions). This option is only meaningful
for the plain-text format. For the archive formats, you may specify the option when you call
[pg\_restore](pg_restore.html#topic1).</dd>
+
+<dt>-c | -\\\-clean  </dt>
+<dd>Output commands to clean (drop) database objects prior to (the commands for) creating
them. This option is only meaningful for the plain-text format. For the archive formats, you
may specify the option when you call [pg\_restore](pg_restore.html#topic1).</dd>
+
+<dt>-d | -\\\-inserts  </dt>
+<dd>Dump data as `INSERT` commands (rather than `COPY`). This will make restoration
very slow; it is mainly useful for making dumps that can be loaded into non-PostgreSQL-based
databases. Also, since this option generates a separate command for each row, an error in
reloading a row causes only that row to be lost rather than the entire table contents. Note
that the restore may fail altogether if you have rearranged column order. The `-D` option
is safe against column order changes, though even slower.</dd>
+
+<dt>-D | -\\\-column-inserts  </dt>
+<dd>Dump data as `INSERT` commands with explicit column names `(INSERT INTO table 
                                   (column, ...) VALUES ...)`. This will make restoration
very slow; it is mainly useful for making dumps that can be loaded into non-PostgreSQL-based
databases. Also, since this option generates a separate command for each row, an error in
reloading a row causes only that row to be lost rather than the entire table contents.</dd>
+
+<dt>-g | -\\\-globals-only  </dt>
+<dd>Dump only global objects (roles and tablespaces), no databases.</dd>
+
+<dt>-o | -\\\-oids  </dt>
+<dd>Dump object identifiers (OIDs) as part of the data for every table. Use of this
option is not recommended for files that are intended to be restored into HAWQ.</dd>
+
+<dt>-O | -\\\-no-owner  </dt>
+<dd>Do not output commands to set ownership of objects to match the original database.
By default, [pg\_dump](pg_dump.html#topic1) issues `ALTER                                
OWNER` or `SET SESSION AUTHORIZATION` 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 `-O`. This option
is only meaningful for the plain-text format. For the archive formats, you may specify the
option when you call [pg\_restore](pg_restore.html#topic1).</dd>
+
+<dt>-r | -\\\-resource-queues  </dt>
+<dd>Dump resource queue definitions.</dd>
+
+<dt>-s | -\\\-schema-only  </dt>
+<dd>Dump only the object definitions (schema), not data.</dd>
+
+<dt>-S \<username\> | -\\\-superuser=\<username\>  </dt>
+<dd>Specify the superuser user name to use when disabling triggers. This is only relevant
if `--disable-triggers` is used. It is better to leave this out, and instead start the resulting
script as a superuser.
+
+**Note:** HAWQ does not support user-defined triggers.</dd>
+
+<dt>-x | -\\\-no-privileges | -\\\-no-acl  </dt>
+<dd>Prevent dumping of access privileges (`GRANT/REVOKE` commands).</dd>
+
+<dt>-\\\-disable-dollar-quoting  </dt>
+<dd>This option disables the use of dollar quoting for function bodies, and forces
them to be quoted using SQL standard string syntax.</dd>
+
+<dt>-\\\-disable-triggers  </dt>
+<dd>This option is only relevant when creating a data-only dump. It instructs `pg_dumpall`
to include commands to temporarily disable triggers on the target tables while the data is
reloaded. Use this if you have triggers on the tables that you do not want to invoke during
data reload. The commands emitted for `--disable-triggers` must be done as superuser. So,
you should also specify a superuser name with `-S`, or preferably be careful to start the
resulting script as a superuser.
+
+**Note:** HAWQ does not support user-defined triggers.</dd>
+
+<dt>-\\\-use-set-session-authorization  </dt>
+<dd>Output SQL-standard `SET SESSION AUTHORIZATION` commands instead of `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, may not restore properly. A dump using
`SET SESSION AUTHORIZATION` will require superuser privileges to restore correctly, whereas
`ALTER                                 OWNER` requires lesser privileges.</dd>
+
+<dt>-\\\-gp-syntax  </dt>
+<dd>Output HAWQ syntax in the `CREATE                                 TABLE` statements.
This allows the distribution policy (`DISTRIBUTED BY` or `DISTRIBUTED                    
            RANDOMLY` clauses) of a HAWQ table to be dumped, which is useful for restoring
into other HAWQ systems.</dd>
+
+<dt>-\\\-no-gp-syntax </dt>
+<dd>Do not use HAWQ syntax in the dump. This is the default if using postgresql. 
+
+**Connection Options**
+
+<dt>-h \<host\> | -\\\-host \<host\>  </dt>
+<dd>The host name of the machine on which the HAWQ master database server is running.
If not specified, reads from the environment variable `PGHOST` or defaults to `localhost`.</dd>
+
+<dt>-l | -\\\-database \<database_name\>  </dt>
+<dd>Connect to an alternate database.</dd>
+
+<dt>-p \<port\> | -\\\-port \<port\>  </dt>
+<dd>The TCP port on which the HAWQ master database server is listening for connections.
If not specified, reads from the environment variable `PGPORT` or defaults to 5432.</dd>
+
+<dt>-U \<username\> | -\\\-username \<username\>  </dt>
+<dd>The database role name to connect as. If not specified, reads from the environment
variable `PGUSER` or defaults to the current system role name.</dd>
+
+<dt>-w | -\\\-no-password  </dt>
+<dd>Do not prompt for a password.</dd>
+
+<dt>-W | -\\\-password  </dt>
+<dd>Force a password prompt.</dd>
+
+## <a id="topic1__section7"></a>Notes
+
+Since `pg_dumpall` calls [pg\_dump](pg_dump.html#topic1) internally, some diagnostic messages
will refer to `pg_dump`.
+
+Once restored, it is wise to run `ANALYZE` on each database so the query planner has useful
statistics. You can also run `vacuumdb -a                     -z` to analyze all databases.
+
+`pg_dumpall` requires all needed tablespace (filespace) directories to exist before the restore
or database creation will fail for databases in non-default locations.
+
+## <a id="topic1__section8"></a>Examples
+
+To dump all databases:
+
+``` shell
+$ pg_dumpall > db.out
+```
+
+To reload this file:
+
+``` shell
+$ psql template1 -f db.out
+```
+
+To dump only global objects (including filespaces and resource queues):
+
+``` shell
+$ pg_dumpall -g -f -r
+```
+
+## <a id="topic1__section9"></a>See Also
+
+[pg\_dump](pg_dump.html#topic1)

http://git-wip-us.apache.org/repos/asf/incubator-hawq-docs/blob/7514e193/reference/cli/client_utilities/pg_restore.html.md.erb
----------------------------------------------------------------------
diff --git a/reference/cli/client_utilities/pg_restore.html.md.erb b/reference/cli/client_utilities/pg_restore.html.md.erb
new file mode 100644
index 0000000..e612282
--- /dev/null
+++ b/reference/cli/client_utilities/pg_restore.html.md.erb
@@ -0,0 +1,256 @@
+---
+title: pg_restore
+---
+
+Restores a database from an archive file created by `pg_dump`.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+pg_restore [<general_options>] [<restore_options>] [<connection_options>]
<filename>
+```
+where:
+
+``` pre
+<general_options>
+    [-d | --dbname=dbname ]
+    [-f outfilename | --file=outfilename ]
+    [-F t|c | --format=tar | custom ] 
+    [-i | --ignore-version ]
+    [-l | --list ]
+    [-v  | --verbose ]
+    [--help]
+    [--version]
+<restore_options> =
+    [-a | --dataonly ]
+    [-c | --clean ]
+    [-C | --create ]
+    [-I | --index=index ]
+    [-L <list-file> | --use-list=<list-file> ]
+    [-n | --schema <schema> ]
+    [-O, --no-owner ]
+    [-P ’<function-name(<argtype> [, …])’ | --function=’<function-name>(<argtype>
[, …])’]
+    [-s | --schema-only]
+    [-S <username>   | --superuser=<username> ]
+    [-t <table>, --table <table> ]
+    [-T <trigger> | --trigger=<trigger> ]
+    [-x | --no-privileges | --no-acl] 
+    [--disable-triggers] 
+    [--use-set-session-authoriztion]
+    [--no-data-for-failed-tables]
+    [-1 | --single-transaction ]  
+<connection_options> =
+    [-h <host> | --host <host>] 
+    [-p <port> | -- port <port>] 
+    [-U <username> | --username <username>] 
+    [-W | --password] 
+    [-e] | --exit-on-error ]  
+```
+
+## <a id="topic1__section3"></a>Description
+
+`pg_restore` is a utility for restoring a database from an archive created by [pg\_dump](pg_dump.html#topic1)
in one of the non-plain-text formats. It will issue the commands necessary to reconstruct
the database to the state it was in at the time it was saved. The archive files also allow
`pg_restore` to be selective about what is restored, or even to reorder the items prior to
being restored.
+
+`pg_restore` can operate in two modes. If a database name is specified, the archive is restored
directly into the database. Otherwise, a script containing the SQL commands necessary to rebuild
the database is created and written to a file or standard output. The script output is equivalent
to the plain text output format of `pg_dump`. Some of the options controlling the output are
therefore analogous to `pg_dump` options.
+
+`pg_restore` cannot restore information that is not present in the archive file. For instance,
if the archive was made using the "dump data as `INSERT` commands" option, `pg_restore` will
not be able to load the data using `COPY` statements.
+
+## <a id="topic1__section4"></a>Options
+
+<dt> *filename*   </dt>
+<dd>Specifies the location of the archive file to be restored. If not specified, the
standard input is used.</dd>
+
+**General Options**
+
+<dt>-d *dbname* , -\\\-dbname=*dbname*  </dt>
+<dd>Connect to this database and restore directly into this database. The default is
to use the `PGDATABASE` environment variable setting, or the same name as the current system
user.</dd>
+
+<dt>-f *outfilename* , -\\\-file=*outfilename*  </dt>
+<dd>Specify output file for generated script, or for the listing when used with `-l`.
Default is the standard output.</dd>
+
+<dt>-F t |c , -\\\-format=tar|custom  </dt>
+<dd>The format of the archive produced by [pg\_dump](pg_dump.html#topic1). It is not
necessary to specify the format, since `pg_restore` will determine the format automatically.
Format can be either `tar` or `custom`.</dd>
+
+<dt>-i , -\\\-ignore-version  </dt>
+<dd>Ignore database version checks.</dd>
+
+<dt>-l , -\\\-list  </dt>
+<dd>List the contents of the archive. The output of this operation can be used with
the `-L` option to restrict and reorder the items that are restored.</dd>
+
+<dt>-v , -\\\-verbose  </dt>
+<dd>Specifies verbose mode.</dd>
+
+<dt> -\\\-help  </dt>
+<dd>Displays this help and exits.</dd>
+
+<dt>-\\\-version  </dt>
+<dd>Displays version number information for the database
+, then exits.</dd>
+
+**Restore Options**
+
+<dt>-a , -\\\-data-only  </dt>
+<dd>Restore only the data, not the schema (data definitions).</dd>
+
+<dt>-c , -\\\-clean  </dt>
+<dd>Clean (drop) database objects before recreating them.</dd>
+
+<dt>-C , -\\\-create  </dt>
+<dd>Create the database before restoring into it. (When this option is used, the database
named with `-d` is used only to issue the initial `CREATE DATABASE` command. All data is restored
into the database name that appears in the archive.)</dd>
+
+<dt>-e , -\\\-exit-on-error  </dt>
+<dd>Exit if an error is encountered while sending SQL commands to the database. The
default is to continue and to display a count of errors at the end of the restoration.</dd>
+
+<dt>-I *index* , -\\\-index=*index*  </dt>
+<dd>Restore definition of named index only.</dd>
+
+<dt>-L *list-file* , -\\\-use-list=*list-file*  </dt>
+<dd>Restore elements in the *list-file* only, and in the order they appear in the file.
Lines can be moved and may also be commented out by placing a `;` at the start of the line.</dd>
+
+<dt>-n *schema* , -\\\-schema=*schema*  </dt>
+<dd>Restore only objects that are in the named schema. This can be combined with the
`-t` option to restore just a specific table.</dd>
+
+<dt>-O , -\\\-no-owner  </dt>
+<dd>Do not output commands to set ownership of objects to match the original database.
By default, `pg_restore` issues `ALTER OWNER` or `SET SESSION AUTHORIZATION` statements to
set ownership of created schema elements. These statements will fail unless the initial connection
to the database is made by a superuser (or the same user that owns all of the objects in the
script). With `-O`, any user name can be used for the initial connection, and this user will
own all the created objects.</dd>
+
+<dt>-P '*function-name*(*argtype* \[, ...\])' , -\\\-function='*function-name*(*argtype*
\[, ...\])'  </dt>
+<dd>Restore the named function only. The function name must be enclosed in quotes.
Be careful to spell the function name and arguments exactly as they appear in the dump file's
table of contents (as shown by the `--list` option).</dd>
+
+<dt>-s , -\\\-schema-only  </dt>
+<dd>Restore only the schema (data definitions), not the data (table contents). Sequence
current values will not be restored, either. (Do not confuse this with the `--schema` option,
which uses the word schema in a different meaning.)</dd>
+
+<dt>-S *username* , -\\\-superuser=*username*  </dt>
+<dd>Specify the superuser user name to use when disabling triggers. This is only relevant
if `--disable-triggers` is used.
+
+**Note:** HAWQ does not support user-defined triggers.</dd>
+
+<dt>-t *table* , -\\\-table=*table*  </dt>
+<dd>Restore definition and/or data of named table only.</dd>
+
+<dt>-T *trigger* , -\\\-trigger=*trigger*  </dt>
+<dd>Restore named trigger only.
+
+**Note:** HAWQ does not support user-defined triggers.</dd>
+
+<dt>-x , -\\\-no-privileges , -\\\-no-acl  </dt>
+<dd>Prevent restoration of access privileges (`GRANT/REVOKE` commands).</dd>
+
+<dt>-\\\-disable-triggers  </dt>
+<dd>This option is only relevant when performing a data-only restore. It instructs
`pg_restore` to execute commands to temporarily disable triggers on the target tables while
the data is reloaded. Use this if you have triggers on the tables that you do not want to
invoke during data reload. The commands emitted for `--disable-triggers` must be done as superuser.
So, you should also specify a superuser name with `-S`, or preferably run `pg_restore` as
a superuser.
+
+**Note:** HAWQ does not support user-defined triggers.</dd>
+
+<dt>-\\\-no-data-for-failed-tables  </dt>
+<dd>By default, table data is restored even if the creation command for the table failed
(e.g., because it already exists). With this option, data for such a table is skipped. This
behavior is useful when the target database may already contain the desired table contents.
Specifying this option prevents duplicate or obsolete data from being loaded. This option
is effective only when restoring directly into a database, not when producing SQL script output.</dd>
+
+<dt>-1 , -\\\-single-transaction  </dt>
+<dd>Execute the restore as a single transaction. This ensures that either all the commands
complete successfully, or no changes are applied.</dd>
+
+**Connection Options**
+
+<dt>-h *host* , -\\\-host *host*  </dt>
+<dd>The host name of the machine on which the HAWQ master database server is running.
If not specified, reads from the environment variable `PGHOST` or defaults to localhost.</dd>
+
+<dt>-p *port* , -\\\-port *port*  </dt>
+<dd>The TCP port on which the HAWQ master database server is listening for connections.
If not specified, reads from the environment variable `PGPORT` or defaults to 5432.</dd>
+
+<dt>-U *username* , -\\\-username *username*  </dt>
+<dd>The database role name to connect as. If not specified, reads from the environment
variable `PGUSER` or defaults to the current system role name.</dd>
+
+<dt>-W , -\\\-password  </dt>
+<dd>Force a password prompt.</dd>
+
+<dt>-e , -\\\-exit-on-error  </dt>
+<dd>Exit if an error is encountered while sending SQL commands to the database. The
default is to continue and to display a count of errors at the end of the restoration.</dd>
+
+## <a id="topic1__section6"></a>Notes
+
+If your installation has any local additions to the `template1` database, be careful to load
the output of `pg_restore` into a truly empty database; otherwise you are likely to get errors
due to duplicate definitions of the added objects. To make an empty database without any local
additions, copy from `template0` not `template1`, for example:
+
+``` sql
+CREATE DATABASE foo WITH TEMPLATE template0;
+```
+
+When restoring data to a pre-existing table and the option `--disable-triggers` is used,
`pg_restore` emits commands to disable triggers on user tables before inserting the data then
emits commands to re-enable them after the data has been inserted. If the restore is stopped
in the middle, the system catalogs may be left in the wrong state.
+
+`pg_restore` will not restore large objects for a single table. If an archive contains large
objects, then all large objects will be restored.
+
+See also the `pg_dump` documentation for details on limitations of `pg_dump`.
+
+Once restored, it is wise to run `ANALYZE` on each restored table so the query planner has
useful statistics.
+
+When running `pg_restore`, a warning related to the `gp_enable_column_oriented_table` parameter
might appear. If it does, disregard it.
+
+## <a id="topic1__section7"></a>Examples
+
+Assume we have dumped a database called `mydb` into a custom-format dump file:
+
+``` shell
+$ pg_dump -Fc mydb > db.dump
+```
+
+To drop the database and recreate it from the dump:
+
+``` shell
+$ dropdb mydb
+$ pg_restore -C -d template1 db.dump
+```
+
+To reload the dump into a new database called `newdb`. Notice there is no `-C`, we instead
connect directly to the database to be restored into. Also note that we clone the new database
from `template0` not `template1`, to ensure it is initially empty:
+
+``` shell
+$ createdb -T template0 newdb
+$ pg_restore -d newdb db.dump
+```
+
+To reorder database items, it is first necessary to dump the table of contents of the archive:
+
+``` shell
+$ pg_restore -l db.dump > db.list
+```
+
+The listing file consists of a header and one line for each item, for example,
+
+``` pre
+; Archive created at Fri Jul 28 22:28:36 2006
+;     dbname: mydb
+;     TOC Entries: 74
+;     Compression: 0
+;     Dump Version: 1.4-0
+;     Format: CUSTOM
+;
+; Selected TOC Entries:
+;
+2; 145344 TABLE species postgres
+3; 145344 ACL species
+4; 145359 TABLE nt_header postgres
+5; 145359 ACL nt_header
+6; 145402 TABLE species_records postgres
+7; 145402 ACL species_records
+8; 145416 TABLE ss_old postgres
+9; 145416 ACL ss_old
+10; 145433 TABLE map_resolutions postgres
+11; 145433 ACL map_resolutions
+12; 145443 TABLE hs_old postgres
+13; 145443 ACL hs_old
+```
+
+Semicolons start a comment, and the numbers at the start of lines refer to the internal archive
ID assigned to each item. Lines in the file can be commented out, deleted, and reordered.
For example,
+
+``` pre
+10; 145433 TABLE map_resolutions postgres
+;2; 145344 TABLE species postgres
+;4; 145359 TABLE nt_header postgres
+6; 145402 TABLE species_records postgres
+;8; 145416 TABLE ss_old postgres
+```
+
+Could be used as input to `pg_restore` and would only restore items 10 and 6, in that order:
+
+``` shell
+$ pg_restore -L db.list db.dump
+```
+
+## <a id="topic1__section8"></a>See Also
+
+[pg\_dump](pg_dump.html#topic1)
\ No newline at end of file



Mime
View raw message