doc-exports/docs/dli/sqlreference/dli_08_0350.html
Su, Xiaomeng 76a5b1ee83 dli_sqlreference_20240227
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>
2024-03-27 22:02:33 +00:00

60 lines
6.8 KiB
HTML

<a name="dli_08_0350"></a><a name="dli_08_0350"></a>
<h1 class="topictitle1">Setting the Retention Period for Multiversion Backup Data</h1>
<div id="body0000001164577596"><div class="section" id="dli_08_0350__en-us_topic_0114776165_en-us_topic_0093946907_s487369d31d4243aba0e537e5932f8b36"><h4 class="sectiontitle">Function</h4><p id="dli_08_0350__p13340145761319">After multiversion is enabled, backup data is retained for seven days by default. You can change the retention period by setting system parameter<strong id="dli_08_0350__b4986125961619"> dli.multi.version.retention.days</strong>. Multiversion data out of the retention period will be automatically deleted when the <strong id="dli_08_0350__b762172213182">insert overwrite</strong> or <strong id="dli_08_0350__b43001226161810">truncate</strong> statement is executed. You can also set table attribute <strong id="dli_08_0350__b6149135817184">dli.multi.version.retention.days</strong> to adjust the retention period when adding a column or modifying a partitioned table.</p>
<p id="dli_08_0350__p1678843136">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_0350__p699538151513">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_0350__en-us_topic_0114776165_en-us_topic_0093946907_s24c0b560c57b49d1bba9b64b7baf3f21"><h4 class="sectiontitle">Syntax</h4><div class="codecoloring" codetype="Sql" id="dli_08_0350__en-us_topic_0114776165_screen141961254556"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="p">[</span><span class="n">db_name</span><span class="p">.]</span><span class="k">table_name</span><span class="w"> </span>
<span class="k">SET</span><span class="w"> </span><span class="n">TBLPROPERTIES</span><span class="w"> </span><span class="p">(</span><span class="ss">&quot;dli.multi.version.retention.days&quot;</span><span class="o">=</span><span class="ss">&quot;days&quot;</span><span class="p">);</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="dli_08_0350__en-us_topic_0114776165_en-us_topic_0093946907_s15f56ad46e8f476986860b44d58d0545"><h4 class="sectiontitle">Keywords</h4><ul id="dli_08_0350__en-us_topic_0114776165_en-us_topic_0093946907_ul19329628111649"><li id="dli_08_0350__en-us_topic_0114776165_en-us_topic_0093946907_li34892402111649">TBLPROPERTIES: This keyword is used to add a <strong id="dli_08_0350__b962121492210">key/value</strong> property to a table.</li></ul>
</div>
<div class="section" id="dli_08_0350__en-us_topic_0114776170_section1130610201331"><h4 class="sectiontitle">Parameters</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_0350__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_0350__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_0350__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_0350__en-us_topic_0114776170_p167561023629">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_08_0350__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_0350__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_0350__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_0350__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_0350__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_0350__p160812219141">Table name</p>
</td>
</tr>
<tr id="dli_08_0350__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_0350__en-us_topic_0114776170_p2075713231020">days</p>
</td>
<td class="cellrowborder" valign="top" width="78.7%" headers="mcps1.3.4.2.2.3.1.2 "><p id="dli_08_0350__en-us_topic_0114776170_p197571231528">Date when the multiversion backup data is reserved. The default value is 7 days. The value ranges from 1 to 7 days.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="dli_08_0350__en-us_topic_0114776165_en-us_topic_0093946907_s8ed8d73f6230466191fae92c2d88b512"><h4 class="sectiontitle">Precautions</h4><p id="dli_08_0350__p18220193723915">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_0350__en-us_topic_0114776165_en-us_topic_0093946907_se85f897bfc724638829c13a14150cab6"><h4 class="sectiontitle">Example</h4><div class="p" id="dli_08_0350__p13814122954020">Set the retention period of multiversion backup data to 5 days.<div class="codecoloring" codetype="Sql" id="dli_08_0350__en-us_topic_0114776165_screen782114013616"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
<span class="normal">2</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">ALTER</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">SET</span><span class="w"> </span><span class="n">TBLPROPERTIES</span><span class="w"> </span><span class="p">(</span><span class="ss">&quot;dli.multi.version.retention.days&quot;</span><span class="o">=</span><span class="ss">&quot;5&quot;</span><span class="p">);</span>
</pre></div></td></tr></table></div>
</div>
</div>
</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>