Disabling or Restoring the Lifecycle of a Table

Function

This section describes how to disable or restore the lifecycle of a specified table or partition.

You can disable or restore the lifecycle of a table in either of the following scenarios:
  1. If the lifecycle function has been enabled for a table or partitioned table, the system allows you to disable or restore the lifecycle of the table by changing the value of dli.table.lifecycle.status.
  2. If the lifecycle function is not enabled for a table or partitioned table, the system will add the dli.table.lifecycle.status property to allow you to disable or restore the lifecycle function of the table.

Constraints and Limitations

Syntax

Keywords

TBLPROPERTIES: Table properties, which can be used to extend the lifecycle of a table.

Parameters

Table 1 Parameters

Parameter

Mandatory

Description

table_name

Yes

Name of the table whose lifecycle is to be disabled or restored

pt_spec

No

Partition information of the table whose lifecycle is to be disabled or restored. The format is partition_col1=col1_value1, partition_col2=col2_value1.... For a table with multi-level partitions, all partition values must be specified.

enable

No

Restores the lifecycle function of a table or a specified partition.
  • The table and its partitions participate in lifecycle reclamation again. By default, the lifecycle configuration of the current table and its partitions is used.
  • Before enabling the table lifecycle function, it is recommended to modify the lifecycle configuration of the table and its partitions. This will help prevent any accidental data reclamation caused by the previous configuration once the table lifecycle function is enabled.

disable

No

Disables the lifecycle function of a table or a specified partition.

  • Prevents a table and all its partitions from being reclaimed by the lifecycle. It takes priority over restoring the lifecycle of a table and its partitions. That is, when the lifecycle function of a table or a specified partition is disabled, the partition information of the table whose lifecycle is to be disabled or restored is invalid.
  • After the lifecycle function of a table is disabled, the lifecycle configuration of the table and the enable and disable flags of its partitions are retained.
  • After the lifecycle function of a table is disabled, the lifecycle configuration of the table and partitioned table can still be modified.

Example