doc-exports/docs/dli/sqlreference/dli_08_0355.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

50 lines
5.3 KiB
HTML

<a name="dli_08_0355"></a><a name="dli_08_0355"></a>
<h1 class="topictitle1">Deleting Multiversion Backup Data</h1>
<div id="body0000001210069181"><div class="section" id="dli_08_0355__en-us_topic_0114776165_en-us_topic_0093946907_s487369d31d4243aba0e537e5932f8b36"><h4 class="sectiontitle">Function</h4><p id="dli_08_0355__p1678843136">The retention period of multiversion backup data takes effect each time the <strong id="dli_08_0355__b12559616114411">insert overwrite</strong> or <strong id="dli_08_0355__b6361121817446">truncate</strong> statement is executed. If neither statement is executed for the table, multiversion backup data out of the retention period will not be automatically deleted. You can run the SQL commands described in this section to manually delete multiversion backup data.</p>
</div>
<div class="section" id="dli_08_0355__en-us_topic_0114776165_en-us_topic_0093946907_s24c0b560c57b49d1bba9b64b7baf3f21"><h4 class="sectiontitle">Syntax</h4><div class="p" id="dli_08_0355__p174371516112120">Delete multiversion backup data out of the retention period.<pre class="screen" id="dli_08_0355__screen592211334812"><strong id="dli_08_0355__b18957442192618">clear history for table</strong> [db_name.]table_name <strong id="dli_08_0355__b1132515461261">older_than </strong>'timestamp';</pre>
</div>
</div>
<div class="section" id="dli_08_0355__en-us_topic_0114776165_en-us_topic_0093946907_s15f56ad46e8f476986860b44d58d0545"><h4 class="sectiontitle">Keywords</h4><ul id="dli_08_0355__en-us_topic_0114776165_en-us_topic_0093946907_ul19329628111649"><li id="dli_08_0355__en-us_topic_0114776165_en-us_topic_0093946907_li34892402111649">clear history for table: Used to delete multiversion backup data</li><li id="dli_08_0355__li113091203414">older_than: Used to specify the time range for deleting multiversion backup data</li></ul>
</div>
<div class="section" id="dli_08_0355__en-us_topic_0114776170_section1130610201331"><h4 class="sectiontitle">Parameters</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_0355__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_0355__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_0355__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_0355__en-us_topic_0114776170_p167561023629">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dli_08_0355__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_0355__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_0355__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_0355__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_0355__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_0355__p160812219141">Table name</p>
</td>
</tr>
<tr id="dli_08_0355__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_0355__p1312219625815">Timestamp</p>
</td>
<td class="cellrowborder" valign="top" width="78.7%" headers="mcps1.3.4.2.2.3.1.2 "><p id="dli_08_0355__en-us_topic_0114776170_p197571231528">Multiversion backup data generated before the timestamp will be deleted. Timestamp format: yyyy-MM-dd HH:mm:ss</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="dli_08_0355__en-us_topic_0114776165_en-us_topic_0093946907_s8ed8d73f6230466191fae92c2d88b512"><h4 class="sectiontitle">Precautions</h4><ul id="dli_08_0355__ul11306195197"><li id="dli_08_0355__li153061910195">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>.</li><li id="dli_08_0355__li17783220191910">This statement does not delete the backup data of the current version.</li></ul>
</div>
<div class="section" id="dli_08_0355__en-us_topic_0114776165_en-us_topic_0093946907_se85f897bfc724638829c13a14150cab6"><h4 class="sectiontitle">Example</h4><div class="p" id="dli_08_0355__p127312451415">Delete the multiversion backup data generated before 2021-09-25 23:59:59 in the <strong id="dli_08_0355__b492917399566">dliTable</strong> table. When the multiversion backup data is generated, a timestamp is generated.<pre class="screen" id="dli_08_0355__screen147296536417">clear history for table dliTable older_than '2021-09-25 23:59:59';</pre>
</div>
<p id="dli_08_0355__p1058819461142"></p>
</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>