doc-exports/docs/dws/dev/dws_04_0277.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

92 lines
20 KiB
HTML

<a name="EN-US_TOPIC_0000001233761781"></a><a name="EN-US_TOPIC_0000001233761781"></a>
<h1 class="topictitle1">Exporting Global Objects</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p185071116123113">You can use gs_dumpall to export global objects from <span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_text496215464">GaussDB(DWS)</span>, including database users, user groups, tablespaces, and attributes (for example, global access permissions).</p>
<div class="section" id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_section5854958132810"><h4 class="sectiontitle">Procedure</h4><ol id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_ol7971153053414"><li id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_li6104335165311"><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_0000001233761781__en-us_topic_0000001145494801_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_0000001233761781__en-us_topic_0000001145494801_en-us_topic_0000001145895053_i2086742622120">Data Warehouse Service User Guide</em>.</span><p><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_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_0000001233761781__en-us_topic_0000001145494801_li144081359105012"><span>Run the following commands to decompress the client:</span><p><pre class="screen" id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_en-us_topic_0000001145895053_screen173918175523"><strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_en-us_topic_0000001145895053_b2025583889759">cd &lt;</strong><em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_en-us_topic_0000001145895053_i18005909159759">Path_for_storing_the_client</em><strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_en-us_topic_0000001145895053_b9103889179759">&gt;</strong>
unzip <em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_en-us_topic_0000001145895053_i10517201512535">dws_client_8.x.x_redhat_x64.zip</em></pre>
<p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_en-us_topic_0000001145895053_p14308192714355">Where,</p>
<ul id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_en-us_topic_0000001145895053_ul18555114323517"><li id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_en-us_topic_0000001145895053_li155410439357">&lt;<em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_en-us_topic_0000001145895053_i20191440039759">Path_for_storing_the_client</em>&gt;: Replace it with the actual path.</li><li id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_en-us_topic_0000001145895053_li9555114313356"><em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_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_0000001233761781__en-us_topic_0000001145494801_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_0000001233761781__en-us_topic_0000001145494801_li106321216523"><span>Run the following command to configure the GaussDB(DWS) client:</span><p><pre class="screen" id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_en-us_topic_0000001145895053_screen39549318531">source gsql_env.sh</pre>
<p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_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_0000001233761781__en-us_topic_0000001145494801_en-us_topic_0000001145895053_s8fd77cb5c040479baaab9ae3f2ea8fa5">All things done.</pre>
</p></li><li id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_li840344313347"><span>Use gs_dumpall to run the following command to export tablespace objects.</span><p><pre class="screen" id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_screen1105155753510"><strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b492118587338">gs_dumpall -W </strong><em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_i1877154320118">password</em><strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b186361538513"> <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b66361381314">-U </strong></strong><span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_ph12587382459">dbadmin</span> <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b192285863313">-f</strong> <em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_i192225853317">/home/<span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_ph69771548247">dbadmin</span>/backup/MPPDB_tablespace.sql</em> <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b4501141931">-p</strong> <span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_text1475718441728">8000</span><em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_i1366941111284"><span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_text4496174519514"> -h 10.10.10.100</span></em> -<strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b17923758183314">t</strong></pre>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_table1781122816253" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Common parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_row10837281257"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.2.2.5.2.2.2.4.1.1"><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p48382816258">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="43.33%" id="mcps1.3.2.2.5.2.2.2.4.1.2"><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p18332812257">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="31.669999999999998%" id="mcps1.3.2.2.5.2.2.2.4.1.3"><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p583122816257">Example Value</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_row1483528152520"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.5.2.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p3830287252">-U</p>
</td>
<td class="cellrowborder" valign="top" width="43.33%" headers="mcps1.3.2.2.5.2.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p8232111218592">Username for database connection. The user must be a cluster administrator.</p>
</td>
<td class="cellrowborder" valign="top" width="31.669999999999998%" headers="mcps1.3.2.2.5.2.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p1583152842510">-U <span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_ph4584425814">dbadmin</span></p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_row199295855317"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.5.2.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p89920588539">-W</p>
</td>
<td class="cellrowborder" valign="top" width="43.33%" headers="mcps1.3.2.2.5.2.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p69431335210">User password for database connection.</p>
<ul id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_ul194074341627"><li id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_li640710341028">This parameter is not required for database administrators if the trust policy is used for authentication.</li><li id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_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.2.2.5.2.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p1898043113581">-W <em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_i5929173193516">Password</em></p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_row1823810139566"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.5.2.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p11238171316560">-f</p>
</td>
<td class="cellrowborder" valign="top" width="43.33%" headers="mcps1.3.2.2.5.2.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_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.2.2.5.2.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p11238513175619">-f /home//backup/<em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_i022863611191">MPPDB_tablespace</em>.sql</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_row9411195215519"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.5.2.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p84119521250">-p</p>
</td>
<td class="cellrowborder" valign="top" width="43.33%" headers="mcps1.3.2.2.5.2.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_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.2.2.5.2.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p19509112814212">-p <span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_text10242121922217">8000</span></p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_row428113127336"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.5.2.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p338520273452">-h</p>
</td>
<td class="cellrowborder" valign="top" width="43.33%" headers="mcps1.3.2.2.5.2.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p12385172734513"><em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_i50876491591341">Cluster address</em>: If a public network address is used for connection, set this parameter to <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b32096522991341">Public Network Address</strong> or <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b206256811191341">Public Network Domain Name</strong>. If a private network address is used for connection, set this parameter to <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b209242943891341">Private Network Address</strong> or <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b207120016191341">Private Network Domain Name</strong>.</p>
</td>
<td class="cellrowborder" valign="top" width="31.669999999999998%" headers="mcps1.3.2.2.5.2.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p133852271452">-h 10.10.10.100</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_row1339718574716"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.5.2.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p18625164815715">-t</p>
</td>
<td class="cellrowborder" valign="top" width="43.33%" headers="mcps1.3.2.2.5.2.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p1962511481717">Dumps only tablespaces. You can also use <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b4384143431116">--tablespaces-only</strong> alternatively.</p>
</td>
<td class="cellrowborder" valign="top" width="31.669999999999998%" headers="mcps1.3.2.2.5.2.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p1662514481776">-</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p158951329152915">For details about other parameters, see "gs_dumpall" in the <em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_i115304102514">Tool </em><em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_i360144162511"></em><em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_i1161144252">Guide</em>.</p>
</p></li></ol>
</div>
<div class="section" id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_section191141882614"><h4 class="sectiontitle">Examples</h4><p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p62472541082">Example 1: Use <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b29365620118">gs_dumpall</strong> to run the following command as the cluster administrator <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b87191181113"></strong><strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b37519119"><span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_ph649855720571">dbadmin</span></strong> to export information of global tablespaces and users in a cluster. The exported files are in text format.</p>
<pre class="screen" id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_screen1124812546814"><strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b172509543812">gs_dumpall -W </strong><em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_i0253547217">password</em><strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b1625116541781"> <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b6252654582">-U </strong></strong><span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_ph24018331671">dbadmin</span> <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b172523541082">-f</strong> /home/<span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_ph192751847001">dbadmin</span>/backup/MPPDB_globals.sql <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b52551546819">-p</strong> <span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_text186541848239">8000</span><em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_i95555072420"><span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_text65645018249"> -h 10.10.10.100</span></em> <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b1425710541481">-g</strong>
gs_dumpall[port=''][2018-11-14 19:06:24]: dumpall operation successful
gs_dumpall[port=''][2018-11-14 19:06:24]: total time: 1150 ms</pre>
<p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p1051955618589">Example 2: Use <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b8286202301110">gs_dumpall</strong> to run the following command as the cluster administrator <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b181821621171112"></strong><strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b101821021191118"><span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_ph188389185312">dbadmin</span></strong> to export global tablespaces in a cluster, encrypt the exported files, and store them in text format.</p>
<pre class="screen" id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_screen1751851219549"><strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b65235561185827">gs_dumpall -W </strong><em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_i9533638327">password</em><strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b49589095185827"> <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b43648679185827">-U </strong></strong><span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_ph133617390710">dbadmin</span> <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b57293798185827">-f</strong> /home/<span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_ph1597416561902">dbadmin</span>/backup/MPPDB_tablespace.sql <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b49478839185827">-p</strong> <span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_text3728120549">8000</span><em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_i13147151112516"><span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_text1714714111252"> -h 10.10.10.100</span></em> -<strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b24510944185827">t</strong> <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b159853181644">--with-encryption</strong> AES128 <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b7821243412">--with-key</strong> 1212121212121212
gs_dumpall[port=''][2018-11-14 19:00:58]: dumpall operation successful
gs_dumpall[port=''][2018-11-14 19:00:58]: total time: 186 ms</pre>
<p id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_p519942431963">Example 3: Use <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b121351645191111">gs_dumpall</strong> to run the following command as the cluster administrator <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b0693164120111"></strong><strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b469334118111"><span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_ph32831914155314">dbadmin</span></strong> to export information of global users in a cluster. The exported files are in text format.</p>
<pre class="screen" id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_screen3197758419555"><strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b5890082418591">gs_dumpall -W </strong><em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_i1132516491515">password</em><strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b5613706818591"> <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b623745218591">-U </strong></strong><span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_ph12456645777">dbadmin</span> <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b5080865518591">-f</strong> /home/<span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_ph144121433114">dbadmin</span>/backup/MPPDB_user.sql <strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b6282525218591">-p</strong> <span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_text72352201748">8000</span><em id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_i118290714258"><span id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_text13829077256"> -h 10.10.10.100</span></em> -<strong id="EN-US_TOPIC_0000001233761781__en-us_topic_0000001145494801_b2265853118591">r</strong>
gs_dumpall[port=''][2018-11-14 19:03:18]: dumpall operation successful
gs_dumpall[port=''][2018-11-14 19:03:18]: total time: 162 ms</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0275.html">Exporting All Databases</a></div>
</div>
</div>