数据保留概述Data retention overview

从已连接的 IoT 设备收集和存储数据对于形成和获得运营与业务见解非常重要。Collection and storage of data from connected IoT devices is important to drive and gain operational and business insights. 但是,考虑到源自这些设备的数据量,组织必须认真规划其想要保留的数据量以及保留数据所需的粒度。However given the volume of data originating from these devices, it becomes important for organizations to carefully plan the amount of data they want to retain and at what granularity. 虽然最好是在所有粒度上保留所有数据,但这并非总是可行。While retaining all data at all granularity is desirable, it's not always practical. 此外,可以保留的数据量受限于 IoT 或 Edge 设备上可用的存储量。Additionally, the volume of data that can be retained is constrained by the amount of storage available on the IoT or Edge devices.

在 Azure SQL Edge 中,数据库管理员可以定义 SQL Edge 数据库及其基础表上的数据保留策略。In Azure SQL Edge database administrators can define data retention policy on a SQL Edge database and its underlying tables. 一旦定义了数据保留策略,一个后台系统任务便会运行,以便清除用户表中的任何过时(旧)数据。Once the data retention policy is defined, a background system task will run to purge any obsolete (old) data from the user tables.

备注

数据一旦从表中清除,便不可恢复。Data once purged from the table, is not recoverable. 恢复已清除数据的唯一可行方法是从较旧的备份还原数据库。The only possible way to recover the purged data is to restore the database from an older backup.

快速入门:Quickstarts:

数据保留的工作原理How data retention works

若要配置数据保留,可以使用 DDL 语句。To configure data retention, you can use DDL statements. 有关详细信息,请参阅启用和禁用数据保留策略For more information, Enable and Disable Data Retention Policies. 若要自动删除过时的记录,必须首先为数据库以及要在该数据库中清除的表启用数据保留。For automatic deletion of the obsolete records, data retention must first be enabled for both the database and the tables that you want to be purged within that database.

为表配置了数据保留后,一个后台任务将会运行,以识别表中已过时的记录并删除这些记录。After data retention is configured for a table, a background task runs to identify the obsolete records in a table and delete those records. 如果由于某种原因,任务的自动清理未运行或无法跟上删除操作,可以对这些表执行手动清理操作。If for some reason, the automatic cleanup of the tasks is not running or is unable to keep up with the deletes, then a manual cleanup operation can be performed on these tables. 有关自动和手动清理的详细信息,请参阅自动和手动清理For more information on automatic and manual cleanups, refer Automatic and Manual Cleanup.

限制和局限Limitations and restrictions

  • 如果从完整备份还原了数据库或重新附加了数据库,则会自动禁用数据保留(如果已启用)。Data Retention, if enabled, is automatically disabled when the database is restored from a full backup or is reattached.
  • 无法对时态历史记录表启用数据保留Data Retention cannot be enabled for a Temporal History Table
  • 无法更改数据保留筛选器列。Data Retention filter colomn cannot be altered. 若要更改该列,请对此表禁用数据保留。To alter the column, disable data retention on the table.

后续步骤Next Steps