doc-exports/docs/dws/dev/dws_04_0274.html
Lu, Huayi e6fa411af0 DWS DEV 830.201 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2024-05-16 07:24:04 +00:00

137 lines
29 KiB
HTML

<a name="EN-US_TOPIC_0000001188482300"></a><a name="EN-US_TOPIC_0000001188482300"></a>
<h1 class="topictitle1">Exporting a Table</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_a4cb49ad563294bfb87725199cf0bf8d6">You can use gs_dump to export data and all object definitions of a table-level object from <span id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_text12632144318420">GaussDB(DWS)</span>. Views, sequences, and foreign tables are special tables. You can export one or more specified tables as needed. You can specify the information to be exported as follows:</p>
<ul id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_ul15714195354211"><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li14800333980">Export full information of a table, including its data and definition.</li><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li197146539426">Export data of a table.</li><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li27141153114215">Export the definition of a table.</li></ul>
<div class="section" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_s230532c8c0f0451bb8a06122db643e74"><h4 class="sectiontitle">Procedure</h4><ol id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_ol13282237570"><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li13430193751416"><span>Prepare an ECS as the gsql client host. For details, see "Preparing an ECS as the gsql Client Host" in the Data Warehouse Service (DWS) User Guide.</span></li><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li879775734918"><span>Download the gsql client and use an SSH transfer tool (such as WinSCP) to upload it to the Linux server where gsql is to be installed. For details, see "Downloading the Client" in <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_i2086742622120">Data Warehouse Service User Guide</em>.</span><p><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_adf760149a35140c48cf09071207cd279">The user who uploads the client must have the full control permission on the target directory on the host to which the client is uploaded.</p>
</p></li><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li144081359105012"><span>Run the following commands to decompress the client:</span><p><pre class="screen" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_screen173918175523"><strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_b2025583889759">cd &lt;</strong><em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_i18005909159759">Path_for_storing_the_client</em><strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_b9103889179759">&gt;</strong>
unzip <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_i10517201512535">dws_client_8.x.x_redhat_x64.zip</em></pre>
<p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_p14308192714355">Where,</p>
<ul id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_ul18555114323517"><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_li155410439357">&lt;<em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_i20191440039759">Path_for_storing_the_client</em>&gt;: Replace it with the actual path.</li><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_li9555114313356"><em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_i15053567519759">dws_client_8.1.x_redhat_x86.zip</em>: This is the client tool package of <span class="parmvalue" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_parmvalue1355249759759"><b>RedHat x86</b></span>. Replace it with the actual one.</li></ul>
</p></li><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li106321216523"><span>Run the following command to configure the GaussDB(DWS) client:</span><p><pre class="screen" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_screen39549318531">source gsql_env.sh</pre>
<p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_acba60d877148432faf5ecdf94dd7b73e">If the following information is displayed, the GaussDB(DWS) client is successfully configured:</p>
<pre class="screen" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_en-us_topic_0000001145895053_s8fd77cb5c040479baaab9ae3f2ea8fa5">All things done.</pre>
</p></li><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li52026572575"><span>Use gs_dump to run the following command to export the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b198501644115913">hr.staffs</strong> and <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b582112482590">hr.employments</strong> tables.</span><p><pre class="screen" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_screen17872792583"><strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b89301924184720">gs_dump -W</strong> <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i1222149811">password</em> <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b49366248477">-U </strong><em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i1346714543175">jack</em> <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b69362242478">-f</strong> <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i193818246475">/home//backup/MPPDB_table_backup</em> <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b10943142424717">-p</strong> 8000<em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i494542424714"> -h 10.10.10.100 human_resource</em> <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b994712419474">-t</strong> <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i1794812464715">hr.staffs</em> <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b395282494715">-F</strong> <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i1295292416470">d</em></pre>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_table1781122816253" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Common parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_row10837281257"><th align="left" class="cellrowborder" valign="top" width="24.169999999999998%" id="mcps1.3.3.2.5.2.2.2.4.1.1"><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p48382816258">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="44.16%" id="mcps1.3.3.2.5.2.2.2.4.1.2"><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p18332812257">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="31.669999999999998%" id="mcps1.3.3.2.5.2.2.2.4.1.3"><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p583122816257">Example Value</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_row1483528152520"><td class="cellrowborder" valign="top" width="24.169999999999998%" headers="mcps1.3.3.2.5.2.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p3830287252">-U</p>
</td>
<td class="cellrowborder" valign="top" width="44.16%" headers="mcps1.3.3.2.5.2.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p22535251788">Username for connecting to the database. If this parameter is not configured, the username of the connected database is used.</p>
</td>
<td class="cellrowborder" valign="top" width="31.669999999999998%" headers="mcps1.3.3.2.5.2.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p1583152842510">-U jack</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_row199295855317"><td class="cellrowborder" valign="top" width="24.169999999999998%" headers="mcps1.3.3.2.5.2.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p89920588539">-W</p>
</td>
<td class="cellrowborder" valign="top" width="44.16%" headers="mcps1.3.3.2.5.2.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p69431335210">User password for database connection.</p>
<ul id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_ul194074341627"><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li640710341028">This parameter is not required for database administrators if the trust policy is used for authentication.</li><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li0407734425">If you connect to the database without specifying this parameter and you are not a database administrator, you will be prompted to enter the password.</li></ul>
</td>
<td class="cellrowborder" valign="top" width="31.669999999999998%" headers="mcps1.3.3.2.5.2.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p1898043113581">-W <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i162115131313">password</em></p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_row1823810139566"><td class="cellrowborder" valign="top" width="24.169999999999998%" headers="mcps1.3.3.2.5.2.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p11238171316560">-f</p>
</td>
<td class="cellrowborder" valign="top" width="44.16%" headers="mcps1.3.3.2.5.2.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p323861311565">Folder to store exported files. If this parameter is not specified, the exported files are stored in the standard output.</p>
</td>
<td class="cellrowborder" valign="top" width="31.669999999999998%" headers="mcps1.3.3.2.5.2.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p11238513175619">-f /home//backup/MPPDB_table_backup</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_row9411195215519"><td class="cellrowborder" valign="top" width="24.169999999999998%" headers="mcps1.3.3.2.5.2.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p84119521250">-p</p>
</td>
<td class="cellrowborder" valign="top" width="44.16%" headers="mcps1.3.3.2.5.2.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p14838631464">Name extension of the TCP port on which the server is listening or the local Unix domain socket. This parameter is configured to ensure connections.</p>
</td>
<td class="cellrowborder" valign="top" width="31.669999999999998%" headers="mcps1.3.3.2.5.2.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p341117521853">-p 8000</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_row15989153912159"><td class="cellrowborder" valign="top" width="24.169999999999998%" headers="mcps1.3.3.2.5.2.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p338520273452">-h</p>
</td>
<td class="cellrowborder" valign="top" width="44.16%" headers="mcps1.3.3.2.5.2.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p12385172734513"><em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i1061112409941">Cluster address</em>: If a public network address is used for connection, set this parameter to <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b11399378589941">Public Network Address</strong> or <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b3993800219941">Public Network Domain Name</strong>. If a private network address is used for connection, set this parameter to <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b16871515919941">Private Network Address</strong> or <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b20685632319941">Private Network Domain Name</strong>.</p>
</td>
<td class="cellrowborder" valign="top" width="31.669999999999998%" headers="mcps1.3.3.2.5.2.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p133852271452">-h 10.10.10.100</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_row1362511481379"><td class="cellrowborder" valign="top" width="24.169999999999998%" headers="mcps1.3.3.2.5.2.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p8782872280">dbname</p>
</td>
<td class="cellrowborder" valign="top" width="44.16%" headers="mcps1.3.3.2.5.2.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p1278211752814">Name of the database to be exported.</p>
</td>
<td class="cellrowborder" valign="top" width="31.669999999999998%" headers="mcps1.3.3.2.5.2.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p12782147122820">human_resource</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_row1280163131716"><td class="cellrowborder" valign="top" width="24.169999999999998%" headers="mcps1.3.3.2.5.2.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p14801831178">-t</p>
</td>
<td class="cellrowborder" valign="top" width="44.16%" headers="mcps1.3.3.2.5.2.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p13668104114117">Table (or view, sequence, foreign table) to be exported. You can specify multiple tables by listing them or using wildcard characters. When you use wildcard characters, quote wildcard patterns with single quotation marks ('') to prevent the shell from expanding the wildcard characters.</p>
<ul id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_ul11933635102416"><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li16923182517191">Single table: Enter <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b11387193218555">-t</strong> <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i61955817199">schema.table</em>.</li><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li1936143522412">Multiple tables: Enter <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b15151195510552">-t</strong> <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i1915214556555">schema.table</em> for each table.</li></ul>
</td>
<td class="cellrowborder" valign="top" width="31.669999999999998%" headers="mcps1.3.3.2.5.2.2.2.4.1.3 "><ul id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_ul13923102591912"><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li43221055172415">Single table: <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b197192365618">-t hr.staffs</strong></li><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li23231055142419">Multiple tables: <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b13376192719569">-t hr.staffs -t hr.employments</strong></li></ul>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_row1885993510341"><td class="cellrowborder" valign="top" width="24.169999999999998%" headers="mcps1.3.3.2.5.2.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p141711116303">-F</p>
</td>
<td class="cellrowborder" valign="top" width="44.16%" headers="mcps1.3.3.2.5.2.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p9417511183018">Format of exported files. The values of <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b115903524568">-F</strong> are as follows:</p>
<ul id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_ul4489102813339"><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li19489102814336"><strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b1927905505610">p</strong>: plain text</li><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li1048922883311"><strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b11901359165612">c</strong>: custom</li><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li4489428173313"><strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b626118913575">d</strong>: directory</li><li id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_li1248912863319"><strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b29393129578">t</strong>: .tar</li></ul>
</td>
<td class="cellrowborder" valign="top" width="31.669999999999998%" headers="mcps1.3.3.2.5.2.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p4417181118302">-F d</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p158951329152915">For details about other parameters, see "gs_dump" in the <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i836516199221">Tool </em><em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i7372131918225"></em><em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i2373151992210">Guide</em>.</p>
</p></li></ol>
</div>
<div class="section" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_s3def63f577474fee9145f2b24f11abb0"><h4 class="sectiontitle">Examples</h4><div class="p" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p51181232124312">Example 1: Use gs_dump to run the following command to export full information of the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b17164112717579">hr.staffs</strong> table. The exported files are in text format.<pre class="screen" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_screen2119103274312">gs_dump -W <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i1173417141713">password</em> -U jack -f /home//backup/MPPDB_table_backup.sql -p 8000<em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i1366941111284"><span id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_text4496174519514"> -h 10.10.10.100</span></em> human_resource -t hr.staffs -Z 6 -F p
gs_dump[port=''][human_resource][2017-07-21 17:05:10]: dump database human_resource successfully
gs_dump[port=''][human_resource][2017-07-21 17:05:10]: total time: 3116 ms</pre>
</div>
<div class="p" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p18972175564320">Example 2: Use gs_dump to run the following command to export data of the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b1050415112586">hr.staffs</strong> table. The exported files are in .tar format.<pre class="screen" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_screen1697275518437">gs_dump -W <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i22564161011">password</em> -U jack -f /home//backup/MPPDB_table_data_backup.tar -p 8000<em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i156361333191712"><span id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_text663633391717"> -h 10.10.10.100</span></em> human_resource -t hr.staffs -a -F t
gs_dump[port=''][human_resource][2017-07-21 17:04:26]: dump database human_resource successfully
gs_dump[port=''][human_resource][2017-07-21 17:04:26]: total time: 2570 ms</pre>
</div>
<div class="p" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_a54ce643bd25f4346b7da4a8a1573727b">Example 3: Use gs_dump to run the following command to export the definition of the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b27671009019">hr.staffs</strong> table. The exported files are stored in a directory.<pre class="screen" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_s45f4a824b8b0413fb4c9627c95f9afd9">gs_dump -W <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i238218176120">password</em> -U jack -f /home//backup/MPPDB_table_def_backup -p 8000<em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i205991047161713"><span id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_text1659954710172"> -h 10.10.10.100</span></em> human_resource -t hr.staffs -s -F d
gs_dump[port=''][human_resource][2017-07-21 17:03:09]: dump database human_resource successfully
gs_dump[port=''][human_resource][2017-07-21 17:03:09]: total time: 2297 ms </pre>
</div>
<div class="p" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_a7a10e8dec41e4d118ff84c16cd45f0af">Example 4: Use gs_dump to run the following command to export the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b512516578117">human_resource</strong> database excluding the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b171271713217">hr.staffs</strong> table. The exported files are in a custom format.<pre class="screen" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_saee77b4bea944180b2a375deb0677e12">gs_dump -W <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i893511181517">password</em> -U jack -f /home//backup/MPPDB_table_backup4.dmp -p 8000<em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i144221232161813"><span id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_text242223220184"> -h 10.10.10.100</span></em> human_resource -T hr.staffs -F c
gs_dump[port=''][human_resource][2017-07-21 17:14:11]: dump database human_resource successfully
gs_dump[port=''][human_resource][2017-07-21 17:14:11]: total time: 2450 ms</pre>
</div>
<div class="p" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_ad92ec8135c2644c19aba9b6f74371058">Example 5: Use gs_dump to run the following command to export the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b1380319934">hr.staffs</strong> and <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b108652225316">hr.employments</strong> tables. The exported files are in text format.<pre class="screen" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_sb204a22099ce40c5b01587afffd7d1f6">gs_dump -W <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i113111320712">password</em> -U jack -f /home//backup/MPPDB_table_backup1.sql -p 8000<em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i1750719278189"><span id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_text16508727171816"> -h 10.10.10.100</span></em> human_resource -t hr.staffs -t hr.employments -F p
gs_dump[port=''][human_resource][2017-07-21 17:19:42]: dump database human_resource successfully
gs_dump[port=''][human_resource][2017-07-21 17:19:42]: total time: 2414 ms</pre>
</div>
<div class="p" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_aaee6e905aca44e7089cc58cfc211f0c4">Example 6: Use gs_dump to run the following command to export the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b14738161418412">human_resource</strong> database excluding the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b155744411533">hr.staffs</strong> and <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b2576194114315">hr.employments</strong> tables. The exported files are in text format.<pre class="screen" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_se1aca78586c44823876500a469926dbd">gs_dump -W <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i1613152214115">password</em> -U jack -f /home//backup/MPPDB_table_backup2.sql -p 8000<em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i143240161810"><span id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_text343154019182"> -h 10.10.10.100</span></em> human_resource -T hr.staffs -T hr.employments -F p
gs_dump[port=''][human_resource][2017-07-21 17:21:02]: dump database human_resource successfully
gs_dump[port=''][human_resource][2017-07-21 17:21:02]: total time: 3165 ms</pre>
</div>
<p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p1559433317418">Example 7: Use gs_dump to run the following command to export data and definition of the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b2107716355">hr.staffs</strong> table, and the definition of the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b198116522052">hr.employments</strong> table. The exported files are in .tar format.</p>
<pre class="screen" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_screen19485134716411">gs_dump -W <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i15138525619">password</em> -U jack -f /home//backup/MPPDB_table_backup3.tar -p 8000<em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i18284045111819"><span id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_text2284845101816"> -h 10.10.10.100</span></em> human_resource -t hr.staffs -t hr.employments --exclude-table-data hr.employments -F t
gs_dump[port=''][human_resource][2018-11-14 11:32:02]: dump database human_resource successfully
gs_dump[port=''][human_resource][2018-11-14 11:32:02]: total time: 1645 ms</pre>
<p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_a241389fd0a2f401bb675563a83a3fc17">Example 8: Use gs_dump to run the following command to export data and definition of the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b36211285718">hr.staffs</strong> table, encrypt the exported files, and store them in text format.</p>
<pre class="screen" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_s95407817c9564ae3b9123c35857806db">gs_dump -W <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i13991826018">password</em> -U jack -f /home//backup/MPPDB_table_backup4.sql -p 8000<em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i178391952111816"><span id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_text284018522188"> -h 10.10.10.100</span></em> human_resource -t hr.staffs --with-encryption AES128 --with-key 1212121212121212 -F p
gs_dump[port=''][human_resource][2018-11-14 11:35:30]: dump database human_resource successfully
gs_dump[port=''][human_resource][2018-11-14 11:35:30]: total time: 6708 ms</pre>
<p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p3669810193617">Example 9: Use gs_dump to run the following command to export all tables, including views, sequences, and foreign tables, in the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b127882391420">public</strong> schema, and the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b278913915418">staffs</strong> table in the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b7790143913418">hr</strong> schema, including data and table definition. The exported files are in a custom format.</p>
<pre class="screen" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_screen78601524133613">gs_dump -W <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i115181528719">password</em> -U jack -f /home//backup/MPPDB_table_backup5.dmp -p 8000<em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i1516211313192"><span id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_text121621931191"> -h 10.10.10.100</span></em> human_resource -t public.* -t hr.staffs -F c
gs_dump[port=''][human_resource][2018-12-13 09:40:24]: dump database human_resource successfully
gs_dump[port=''][human_resource][2018-12-13 09:40:24]: total time: 896 ms</pre>
<p id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_p1271172352612">Example 10: Use gs_dump to run the following command to export the definition of the view referencing to the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b12876191681217">test1</strong> table in the <strong id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_b166671521171219">t1</strong> schema. The exported files are in a custom format.</p>
<pre class="screen" id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_screen2381987119539">gs_dump -W <em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i08959293112">password</em> -U jack -f /home//backup/MPPDB_view_backup6 -p 8000<em id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_i44082881918"><span id="EN-US_TOPIC_0000001188482300__en-us_topic_0000001145814887_text5409184191"> -h 10.10.10.100</span></em> human_resource -t t1.test1 --include-depend-objs --exclude-self -F d
gs_dump[port=''][jack][2018-11-14 17:21:18]: dump database human_resource successfully
gs_dump[port=''][jack][2018-11-14 17:21:23]: total time: 4239 ms</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0271.html">Exporting a Single Database</a></div>
</div>
</div>