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

128 lines
17 KiB
HTML

<a name="EN-US_TOPIC_0000001233681743"></a><a name="EN-US_TOPIC_0000001233681743"></a>
<h1 class="topictitle1">Data Migration to GaussDB(DWS)</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001233681743__p1113614261"><span id="EN-US_TOPIC_0000001233681743__ph12421185745313">GaussDB(DWS)</span> provides flexible methods for importing data. You can import data from different sources to <span id="EN-US_TOPIC_0000001233681743__ph84281057155311">GaussDB(DWS)</span>. The features of each method are listed in <a href="#EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_table10273436143718">Table 1</a>. You can select a method as required. You are advised to use GaussDB(DWS) with Cloud Data Migration (CDM), and DataArts Studio. CDM is used for batch data migration, and DataArts Studio orchestrates and schedules the entire ETL process and provides a visualized development environment.</p>
<div class="note" id="EN-US_TOPIC_0000001233681743__note4904635115817"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001233681743__ul1775310215573"><li id="EN-US_TOPIC_0000001233681743__li1779132205718">DRS, CDM, OBS, MRS, and DLI are cloud services.</li><li id="EN-US_TOPIC_0000001233681743__li69301637125813">GDS, DSC, and <strong id="EN-US_TOPIC_0000001233681743__b046803810279">gs_restore</strong>, and <strong id="EN-US_TOPIC_0000001233681743__b104692381271">gs_dump</strong> are internal tools.</li></ul>
</div></div>
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_table10273436143718"></a><a name="en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_table10273436143718"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_table10273436143718" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Import methods</caption><thead align="left"><tr id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_row1627416369375"><th align="left" class="cellrowborder" valign="top" width="24.779999999999998%" id="mcps1.3.3.2.5.1.1"><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p3274133613372">Import Method</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.43%" id="mcps1.3.3.2.5.1.2"><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p12274143611371">Data Source</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="38.45%" id="mcps1.3.3.2.5.1.3"><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p78031146143918">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20.34%" id="mcps1.3.3.2.5.1.4"><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p152740367379">Advantage</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_row152747367379"><td class="cellrowborder" valign="top" width="24.779999999999998%" headers="mcps1.3.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p17274103611372"><a href="dws_04_0181.html">Importing Data from OBS in Parallel</a></p>
</td>
<td class="cellrowborder" valign="top" width="16.43%" headers="mcps1.3.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p144051814119">OBS</p>
</td>
<td class="cellrowborder" valign="top" width="38.45%" headers="mcps1.3.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p180334663913">You can import data in TXT, CSV, ORC, or CarbonData format from OBS to <span id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_ph14538135614212">GaussDB(DWS)</span> for query, and can remotely read data from OBS.</p>
<p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_p1449517184610">It is recommended for <span id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001145651023_ph15721958174314">GaussDB(DWS)</span>.</p>
</td>
<td class="cellrowborder" rowspan="2" valign="top" width="20.34%" headers="mcps1.3.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p1227413363374">This method features high performance and flexible scale-out.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_row9466165383511"><td class="cellrowborder" valign="top" headers="mcps1.3.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_p102809945217"><a href="dws_04_0189.html">Using GDS to Import Data from a Remote Server</a></p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p35972011183617">Servers (remote servers)</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p8803246143911">Use the GDS tool provided by <span id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001145651023_ph123261154122518">GaussDB(DWS)</span> to import data from the remote server to <span id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001145651023_ph1712113508258">GaussDB(DWS)</span> in parallel. Multiple DNs are used for the import. This method is efficient and applicable to importing a large amount of data to the database.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_row10229161163513"><td class="cellrowborder" valign="top" width="24.779999999999998%" headers="mcps1.3.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_p568681813351"><a href="dws_04_0210.html">Importing Data from MRS to a Cluster</a></p>
</td>
<td class="cellrowborder" valign="top" width="16.43%" headers="mcps1.3.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_p1268691883517">MRS (HDFS)</p>
</td>
<td class="cellrowborder" valign="top" width="38.45%" headers="mcps1.3.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_p19686181811355">Configure a <span id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001145651023_ph884632792510">GaussDB(DWS)</span> cluster to connect to an MRS cluster. In <span id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001145651023_ph1735794592518">GaussDB(DWS)</span>, read data from the HDFS of MRS.</p>
</td>
<td class="cellrowborder" valign="top" width="20.34%" headers="mcps1.3.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_p92330118358">This method features high performance and flexible scale-out.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233681743__row1384764817449"><td class="cellrowborder" valign="top" width="24.779999999999998%" headers="mcps1.3.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001233681743__p182681414452"><a href="dws_04_0949.html">Importing Data from One GaussDB(DWS) Cluster to Another</a></p>
</td>
<td class="cellrowborder" valign="top" width="16.43%" headers="mcps1.3.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001233681743__p826812417451">-</p>
</td>
<td class="cellrowborder" valign="top" width="38.45%" headers="mcps1.3.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001233681743__p1226954194513">Two GaussDB(DWS) clusters can access data of each other. You can use foreign tables to access and import data across GaussDB(DWS) clusters.</p>
</td>
<td class="cellrowborder" valign="top" width="20.34%" headers="mcps1.3.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001233681743__p826916418451">This method is applicable to data synchronization between multiple GaussDB(DWS) clusters.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233681743__row1095684124412"><td class="cellrowborder" valign="top" width="24.779999999999998%" headers="mcps1.3.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001233681743__p72701145454"><a href="dws_04_0967.html">GDS-based Cross-Cluster Interconnection</a></p>
</td>
<td class="cellrowborder" valign="top" width="16.43%" headers="mcps1.3.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001233681743__p227011410457">-</p>
</td>
<td class="cellrowborder" valign="top" width="38.45%" headers="mcps1.3.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001233681743__p62705474520">GDS is used for data transit to implement data synchronization between multiple clusters.</p>
</td>
<td class="cellrowborder" valign="top" width="20.34%" headers="mcps1.3.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001233681743__p14270642457">This method is applicable to data synchronization between multiple GaussDB(DWS) clusters.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233681743__row1695814117447"><td class="cellrowborder" valign="top" width="24.779999999999998%" headers="mcps1.3.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001233681743__p167741123134517"><a href="dws_04_0208.html">Using a gsql Meta-Command to Import Data</a></p>
</td>
<td class="cellrowborder" valign="top" width="16.43%" headers="mcps1.3.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001233681743__p19774523134519">Local files</p>
</td>
<td class="cellrowborder" valign="top" width="38.45%" headers="mcps1.3.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001233681743__p17747234453">Unlike the SQL <strong id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001145651023_en-us_topic_0140501319_b108641059144015">COPY</strong> statement, the <strong id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001145651023_en-us_topic_0140501319_b71683713331">\copy</strong> command can read data from or write data into only local files on a <strong id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001145651023_en-us_topic_0140501319_b8690652194019">gsql</strong> client.</p>
</td>
<td class="cellrowborder" valign="top" width="20.34%" headers="mcps1.3.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001233681743__p677414232453">This method is easy to operate and suitable for importing a small amount of data to the database.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233681743__row7240103254516"><td class="cellrowborder" valign="top" width="24.779999999999998%" headers="mcps1.3.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001233681743__p11204194494516"><a href="dws_04_0203.html">Running the COPY FROM STDIN Statement to Import Data</a></p>
</td>
<td class="cellrowborder" valign="top" width="16.43%" headers="mcps1.3.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001233681743__p192043449456">Other files or databases</p>
</td>
<td class="cellrowborder" valign="top" width="38.45%" headers="mcps1.3.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001233681743__p2204344174516">When you use Java to develop applications, the CopyManager interface of the JDBC driver is invoked to write data from files or other databases to <span id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001145651023_ph6667121019273">GaussDB(DWS)</span>.</p>
</td>
<td class="cellrowborder" valign="top" width="20.34%" headers="mcps1.3.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001233681743__p620574418454">Data is directly written from other databases to <span id="EN-US_TOPIC_0000001233681743__ph82057443451">GaussDB(DWS)</span>. Service data does not need to be stored in files.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_row1127453617378"><td class="cellrowborder" valign="top" width="24.779999999999998%" headers="mcps1.3.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p13274143610370"><a href="dws_04_0219.html">Using CDM to Migrate Data to GaussDB(DWS)</a></p>
</td>
<td class="cellrowborder" valign="top" width="16.43%" headers="mcps1.3.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p027533615376">Databases, NoSQL, file systems, and big data platforms</p>
</td>
<td class="cellrowborder" valign="top" width="38.45%" headers="mcps1.3.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p4422519145022">CDM can migrate various types of data in batches between homogeneous and heterogeneous data sources. CDM migrates data to <span id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001145651023_ph1064716136266">GaussDB(DWS)</span> using the copy method or the GDS parallel import method.</p>
</td>
<td class="cellrowborder" valign="top" width="20.34%" headers="mcps1.3.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p1727503633720">This method supports data import from abundant data sources and is easy-to-operate.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_row115562143311"><td class="cellrowborder" valign="top" width="24.779999999999998%" headers="mcps1.3.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001233681743__p154550744613"><a href="dws_01_0127.html">Using DSC to Migrate SQL Scripts</a></p>
</td>
<td class="cellrowborder" valign="top" width="16.43%" headers="mcps1.3.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p1555172118337">Databases, NoSQL, file systems, and big data platforms</p>
</td>
<td class="cellrowborder" valign="top" width="38.45%" headers="mcps1.3.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p1280315465394">For details, see the documents of the third-party ETL tool.</p>
<p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_p118431812345"><span id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001145651023_ph129691947132617">GaussDB(DWS)</span> provides the DSC tool to migrate Teradata/Oracle scripts to <span id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001145651023_ph344105219265">GaussDB(DWS)</span>.</p>
</td>
<td class="cellrowborder" valign="top" width="20.34%" headers="mcps1.3.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001233681743__en-us_topic_0000001082926999_en-us_topic_0140501319_en-us_topic_0145255637_p139781232353">Provides abundant data sources and powerful data conversion capabilities through OBS.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233681743__row146942268466"><td class="cellrowborder" valign="top" width="24.779999999999998%" headers="mcps1.3.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001233681743__p1991121422211"><a href="dws_04_0269.html">Using gs_dump and gs_dumpall to Export Metadata</a></p>
</td>
<td class="cellrowborder" valign="top" width="16.43%" headers="mcps1.3.3.2.5.1.2 "><ul id="EN-US_TOPIC_0000001233681743__ul6884122713717"><li id="EN-US_TOPIC_0000001233681743__li68847276371">Plain text</li><li id="EN-US_TOPIC_0000001233681743__li2038265822017">Custom</li><li id="EN-US_TOPIC_0000001233681743__li1994149112112">Directory</li><li id="EN-US_TOPIC_0000001233681743__li153212303373">.tar</li></ul>
</td>
<td class="cellrowborder" valign="top" width="38.45%" headers="mcps1.3.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001233681743__p1434365072312">gs_dump exports a single database or its objects. gs_dumpall exports all databases or global objects in a cluster.</p>
<p id="EN-US_TOPIC_0000001233681743__p12991414132219">To migrate database information, you can use a tool to import the exported metadata to a target database.</p>
</td>
<td class="cellrowborder" rowspan="2" valign="top" width="20.34%" headers="mcps1.3.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001233681743__p13695126154611"></p>
<p id="EN-US_TOPIC_0000001233681743__p182901946145112">This method is applicable to metadata migration.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001233681743__row137012816505"><td class="cellrowborder" valign="top" headers="mcps1.3.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001233681743__p152901746125112"><a href="dws_04_0209.html">Using gs_restore to Import Data</a></p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001233681743__p182900464517">SQL, TMP, and TAR file formats</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.3.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001233681743__p710361761911">During database migration, you can use the gs_restore tool to import the file exported using the gs_dump tool to a GaussDB(DWS) cluster. In this way, metadata, such as table definitions and database object definitions, is imported. The following definitions need to be imported:</p>
<ul id="EN-US_TOPIC_0000001233681743__ul914882413106"><li id="EN-US_TOPIC_0000001233681743__li11148142451011">All database objects</li><li id="EN-US_TOPIC_0000001233681743__li1014852419109">A single database object</li><li id="EN-US_TOPIC_0000001233681743__li3148624151015">A single schema</li><li id="EN-US_TOPIC_0000001233681743__li7148132411108">A single table</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0985.html">Data migration</a></div>
</div>
</div>