forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com> Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
69 lines
8.4 KiB
HTML
69 lines
8.4 KiB
HTML
<a name="dli_08_0352"></a><a name="dli_08_0352"></a>
|
|
|
|
<h1 class="topictitle1">Restoring Multiversion Backup Data</h1>
|
|
<div id="body0000001209977507"><div class="section" id="dli_08_0352__en-us_topic_0114776165_en-us_topic_0093946907_s487369d31d4243aba0e537e5932f8b36"><h4 class="sectiontitle">Function</h4><p id="dli_08_0352__p1678843136">After the multiversion function is enabled, you can run the <strong id="dli_08_0352__b1759201055810">RESTORE TABLE</strong> statement to restore a table or partition of a specified version. For details about the syntax for enabling or disabling the multiversion function, see <a href="dli_08_0354.html">Enabling or Disabling Multiversion Backup</a>.</p>
|
|
<p id="dli_08_0352__p157671522171515">Currently, the multiversion function supports only OBS tables created using the Hive syntax. For details about the syntax for creating a table, see <a href="dli_08_0077.html">Creating an OBS Table Using the Hive Syntax</a>.</p>
|
|
</div>
|
|
<div class="section" id="dli_08_0352__en-us_topic_0114776165_en-us_topic_0093946907_s24c0b560c57b49d1bba9b64b7baf3f21"><h4 class="sectiontitle">Syntax</h4><ul id="dli_08_0352__ul864214239471"><li id="dli_08_0352__li136428239473">Restore the non-partitioned table data to the backup data of a specified version.<pre class="screen" id="dli_08_0352__screen592211334812"><strong id="dli_08_0352__b1246553118250">RESTORE TABLE</strong> [db_name.]table_name<strong id="dli_08_0352__b2816153411252"> TO VERSION</strong> 'version_id';</pre>
|
|
</li><li id="dli_08_0352__li136517574819">Restore the data of a single partition in a partitioned table to the backup data of a specified version.<pre class="screen" id="dli_08_0352__screen9615636184811"><strong id="dli_08_0352__b16814837172510">RESTORE TABLE</strong> [db_name.]table_name <strong id="dli_08_0352__b77258412257">PARTITION </strong>(column = value, ...) <strong id="dli_08_0352__b140184572514">TO VERSION</strong> 'version_id';</pre>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_0352__en-us_topic_0114776165_en-us_topic_0093946907_s15f56ad46e8f476986860b44d58d0545"><h4 class="sectiontitle">Keywords</h4><ul id="dli_08_0352__en-us_topic_0114776165_en-us_topic_0093946907_ul19329628111649"><li id="dli_08_0352__en-us_topic_0114776165_en-us_topic_0093946907_li34892402111649">RESTORE TABLE: Used to restore backup data</li><li id="dli_08_0352__li113091203414">PARTITION: Used to specify the partition column</li><li id="dli_08_0352__li196161910443">TO VERSION: Used to specify the version number You can run the <strong id="dli_08_0352__b6124177992">SHOW HISTORY</strong> command to obtain the version number. For details, see <a href="dli_08_0351.html">Viewing Multiversion Backup Data</a>.</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_0352__en-us_topic_0114776170_section1130610201331"><h4 class="sectiontitle">Parameters</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_0352__en-us_topic_0114776170_table137579239220" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters</caption><thead align="left"><tr id="dli_08_0352__en-us_topic_0114776170_row17564232219"><th align="left" class="cellrowborder" valign="top" width="21.3%" id="mcps1.3.4.2.2.3.1.1"><p id="dli_08_0352__en-us_topic_0114776170_p3756152318220">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="78.7%" id="mcps1.3.4.2.2.3.1.2"><p id="dli_08_0352__en-us_topic_0114776170_p167561023629">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_0352__en-us_topic_0114776170_row1375611231219"><td class="cellrowborder" valign="top" width="21.3%" headers="mcps1.3.4.2.2.3.1.1 "><p id="dli_08_0352__en-us_topic_0114776170_p107564232216">db_name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="78.7%" headers="mcps1.3.4.2.2.3.1.2 "><p id="dli_08_0352__en-us_topic_0114776170_p1575614231121">Database name, which consists of letters, digits, and underscores (_). The value cannot contain only digits or start with a digit or underscore (_).</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0352__en-us_topic_0114776170_row117571623729"><td class="cellrowborder" valign="top" width="21.3%" headers="mcps1.3.4.2.2.3.1.1 "><p id="dli_08_0352__en-us_topic_0114776170_p87577239219">table_name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="78.7%" headers="mcps1.3.4.2.2.3.1.2 "><p id="dli_08_0352__p160812219141">Table name</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0352__en-us_topic_0114776170_row1775713231524"><td class="cellrowborder" valign="top" width="21.3%" headers="mcps1.3.4.2.2.3.1.1 "><p id="dli_08_0352__en-us_topic_0114776170_p2075713231020">column</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="78.7%" headers="mcps1.3.4.2.2.3.1.2 "><p id="dli_08_0352__en-us_topic_0114776170_p197571231528">Partition column name</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0352__row87097815315"><td class="cellrowborder" valign="top" width="21.3%" headers="mcps1.3.4.2.2.3.1.1 "><p id="dli_08_0352__p1128121212531">value</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="78.7%" headers="mcps1.3.4.2.2.3.1.2 "><p id="dli_08_0352__p71281712175310">Value corresponding to the partition column name</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0352__row1754218361844"><td class="cellrowborder" valign="top" width="21.3%" headers="mcps1.3.4.2.2.3.1.1 "><p id="dli_08_0352__p145773531747">version_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="78.7%" headers="mcps1.3.4.2.2.3.1.2 "><p id="dli_08_0352__p754217364418">Target version of the backup data to be restored You can run the <strong id="dli_08_0352__b8454223191012">SHOW HISTORY</strong> command to obtain the version number. For details, see <a href="dli_08_0351.html">Viewing Multiversion Backup Data</a>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="dli_08_0352__en-us_topic_0114776165_en-us_topic_0093946907_s8ed8d73f6230466191fae92c2d88b512"><h4 class="sectiontitle">Precautions</h4><p id="dli_08_0352__p1714312268159">Currently, the multiversion function supports only OBS tables created using the Hive syntax. For details about the syntax for creating a table, see <a href="dli_08_0077.html">Creating an OBS Table Using the Hive Syntax</a>.</p>
|
|
</div>
|
|
<div class="section" id="dli_08_0352__en-us_topic_0114776165_en-us_topic_0093946907_se85f897bfc724638829c13a14150cab6"><h4 class="sectiontitle">Example</h4><ul id="dli_08_0352__ul12143174805411"><li id="dli_08_0352__li0143104817549">Restore the data in non-partitioned table <strong id="dli_08_0352__b1192985421011">test_table</strong> to version 20210930.<div class="codecoloring" codetype="Sql" id="dli_08_0352__en-us_topic_0114776165_screen782114013616"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">RESTORE</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">test_table</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="k">VERSION</span><span class="w"> </span><span class="s1">'20210930'</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</li></ul>
|
|
<ul id="dli_08_0352__ul517075025419"><li id="dli_08_0352__li1360315109576">Restore the data of partition <strong id="dli_08_0352__b16669154241112">dt</strong> in partitioned table <strong id="dli_08_0352__b1620551551116">test_table</strong> to version 20210930.<div class="codecoloring" codetype="Sql" id="dli_08_0352__screen653817431546"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">RESTORE</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">test_table</span><span class="w"> </span><span class="n">PARTITION</span><span class="w"> </span><span class="p">(</span><span class="n">dt</span><span class="o">=</span><span class="s1">'2021-07-27'</span><span class="p">)</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="k">VERSION</span><span class="w"> </span><span class="s1">'20210930'</span><span class="p">;</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</li></ul>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_08_0349.html">Backing Up and Restoring Data of Multiple Versions</a></div>
|
|
</div>
|
|
</div>
|
|
|