區塊 blob 的時間點還原Point-in-time restore for block blobs

時間點還原可讓您將區塊 blob 資料還原至先前的狀態,以提供防止意外刪除或損毀的保護。Point-in-time restore provides protection against accidental deletion or corruption by enabling you to restore block blob data to an earlier state. 時間點還原適用于使用者或應用程式不小心刪除資料或應用程式錯誤損毀資料的案例。Point-in-time restore is useful in scenarios where a user or application accidentally deletes data or where an application error corrupts data. 時間點還原也可讓測試案例必須將資料集還原為已知狀態,再執行進一步的測試。Point-in-time restore also enables testing scenarios that require reverting a data set to a known state before running further tests.

只有標準效能層級的一般用途 v2 儲存體帳戶支援還原時間點。Point-in-time restore is supported for general-purpose v2 storage accounts in the standard performance tier only. 只有經常性存取和非經常性存取層中的資料可以使用時間點還原來還原。Only data in the hot and cool access tiers can be restored with point-in-time restore.

若要瞭解如何啟用儲存體帳戶的時間點還原,請參閱 在區塊 blob 資料上執行時間點還原To learn how to enable point-in-time restore for a storage account, see Perform a point-in-time restore on block blob data.

時間點還原的運作方式How point-in-time restore works

若要啟用時間點還原,您必須建立儲存體帳戶的管理原則,並指定保留期限。To enable point-in-time restore, you create a management policy for the storage account and specify a retention period. 在保留期限內,您可以從目前狀態將區塊 blob 還原至先前時間點的狀態。During the retention period, you can restore block blobs from the present state to a state at a previous point in time.

若要起始時間點還原,請呼叫 還原 Blob 範圍 作業,並指定 UTC 時間的還原點。To initiate a point-in-time restore, call the Restore Blob Ranges operation and specify a restore point in UTC time. 您可以指定要還原之容器和 blob 名稱的字典範圍,或略過範圍以還原儲存體帳戶中的所有容器。You can specify lexicographical ranges of container and blob names to restore, or omit the range to restore all containers in the storage account. 每個還原作業最多可支援10個字典的範圍。Up to 10 lexicographical ranges are supported per restore operation.

Azure 儲存體會分析在要求的還原點(以 UTC 時間指定)和目前的時間之間,對指定的 blob 進行的所有變更。Azure Storage analyzes all changes that have been made to the specified blobs between the requested restore point, specified in UTC time, and the present moment. 還原作業是不可部分完成的,因此它會完全成功還原所有變更,否則會失敗。The restore operation is atomic, so it either succeeds completely in restoring all changes, or it fails. 如果有任何無法還原的 blob,則作業會失敗,且受影響容器的讀取和寫入作業會繼續。If there are any blobs that cannot be restored, then the operation fails, and read and write operations to the affected containers resume.

下圖顯示時間點還原的運作方式。The following diagram shows how point-in-time restore works. 一或多個容器或 blob 範圍會還原至其狀態 n 天前,其中 n 小於或等於針對時間點還原所定義的保留週期。One or more containers or blob ranges is restored to its state n days ago, where n is less than or equal to the retention period defined for point-in-time restore. 效果是還原保留期間發生的寫入和刪除作業。The effect is to revert write and delete operations that happened during the retention period.

顯示時間點如何將容器還原至先前狀態的圖表

一次只能在一個儲存體帳戶上執行一個還原作業。Only one restore operation can be run on a storage account at a time. 還原作業在進行中時無法取消,但可以執行第二個還原作業來復原第一項作業。A restore operation cannot be canceled once it is in progress, but a second restore operation can be performed to undo the first operation.

還原 Blob 範圍 作業會傳回可唯一識別作業的還原識別碼。The Restore Blob Ranges operation returns a restore ID that uniquely identifies the operation. 若要檢查時間點還原的狀態,請使用「還原 Blob 範圍」作業所傳回的還原識別碼,呼叫「取得還原狀態」作業。To check the status of a point-in-time restore, call the Get Restore Status operation with the restore ID returned from the Restore Blob Ranges operation.

重要

當您執行還原作業時,Azure 儲存體會封鎖作業期間正在還原之範圍中 blob 的資料作業。When you perform a restore operation, Azure Storage blocks data operations on the blobs in the ranges being restored for the duration of the operation. 主要位置會封鎖讀取、寫入和刪除作業。Read, write, and delete operations are blocked in the primary location. 基於這個理由,在進行還原作業時,在 Azure 入口網站中列出容器的作業可能不會如預期般執行。For this reason, operations such as listing containers in the Azure portal may not perform as expected while the restore operation is underway.

如果儲存體帳戶是異地複寫的,則在還原作業期間,次要位置的讀取作業可能會繼續進行。Read operations from the secondary location may proceed during the restore operation if the storage account is geo-replicated.

警告

時間點還原支援針對僅限區塊 blob 的作業進行還原。Point-in-time restore supports restoring against operations that acted on block blobs only. 對容器採取的任何作業都無法還原。Any operations that acted on containers cannot be restored. 例如,如果您藉由呼叫「 刪除容器 」作業來刪除儲存體帳戶中的容器,則無法使用時間點還原作業來還原該容器。For example, if you delete a container from the storage account by calling the Delete Container operation, that container cannot be restored with a point-in-time restore operation. 如果您稍後想要還原,請刪除個別的 blob,而不是刪除整個容器。Rather than deleting an entire container, delete individual blobs if you may want to restore them later.

時間點還原的必要條件Prerequisites for point-in-time restore

還原時間點需要先啟用下列 Azure 儲存體功能,才能啟用時間點還原:Point-in-time restore requires that the following Azure Storage features be enabled before you can enable point-in-time restore:

啟用這些功能可能會導致額外的費用。Enabling these features may result in additional charges. 在啟用時間點還原和必要條件功能之前,請確定您瞭解計費的含意。Make sure that you understand the billing implications before enabling point-in-time restore and the prerequisite features.

時間點還原的保留期間Retention period for point-in-time restore

當您針對儲存體帳戶啟用時間點還原時,會指定保留期限。When you enable point-in-time restore for a storage account, you specify a retention period. 您儲存體帳戶中的區塊 blob 可在保留期間內還原。Block blobs in your storage account can be restored during the retention period.

在您啟用時間點還原後,保留期限會開始幾分鐘。The retention period begins a few minutes after you enable point-in-time restore. 請記住,您無法將 blob 還原至保留期間開始之前的狀態。Keep in mind that you cannot restore blobs to a state prior to the beginning of the retention period. 例如,如果您在5月1日啟用時間點還原,保留30天,則在5月15日之前,您最多可以還原15天。For example, if you enabled point-in-time restore on May 1st with a retention of 30 days, then on May 15th you can restore to a maximum of 15 days. 在6月1日,您可以從1到30天還原資料。On June 1st, you can restore data from between 1 and 30 days.

時間點還原的保留期限必須至少為一天,小於針對虛刪除指定的保留週期。The retention period for point-in-time restore must be at least one day less than the retention period specified for soft delete. 例如,如果虛刪除保留期限設定為7天,則時間點還原保留期限可能介於1到6天之間。For example, if the soft delete retention period is set to 7 days, then the point-in-time restore retention period may be between 1 and 6 days.

重要

還原一組資料所需的時間,取決於還原期間所做的寫入和刪除作業數目。The time that it takes to restore a set of data is based on the number of write and delete operations made during the restore period. 例如,每日新增3000個物件且每天刪除1000個物件的1000000帳戶,大約需要兩個小時才能還原至過去30天的時間點。For example, an account with one million objects with 3,000 objects added per day and 1,000 objects deleted per day will require approximately two hours to restore to a point 30 days in the past. 具有此變更率的帳戶不建議在過去的保留期間和還原超過90天。A retention period and restoration more than 90 days in the past would not be recommended for an account with this rate of change.

時間點還原的許可權Permissions for point-in-time restore

若要起始還原作業,用戶端必須具有儲存體帳戶中所有容器的寫入權限。To initiate a restore operation, a client must have write permissions to all containers in the storage account. 若要使用 Azure Active Directory (Azure AD) 授與授權還原作業的許可權,請將 儲存體帳戶參與者 角色指派給儲存體帳戶、資源群組或訂用帳戶層級的安全性主體。To grant permissions to authorize a restore operation with Azure Active Directory (Azure AD), assign the Storage Account Contributor role to the security principal at the level of the storage account, resource group, or subscription.

限制與已知問題Limitations and known issues

區塊 blob 的時間點還原具有下列限制和已知問題:Point-in-time restore for block blobs has the following limitations and known issues:

  • 只有標準一般用途 v2 儲存體帳戶中的區塊 blob 可以還原為時間點還原作業的一部分。Only block blobs in a standard general-purpose v2 storage account can be restored as part of a point-in-time restore operation. 附加 blob、分頁 blob 和 premium 區塊 blob 不會還原。Append blobs, page blobs, and premium block blobs are not restored.
  • 如果您已在保留期限內刪除容器,則該容器將不會隨著時間點還原作業還原。If you have deleted a container during the retention period, that container will not be restored with the point-in-time restore operation. 如果您嘗試還原的 blob 範圍包含已刪除容器中的 blob,則時間點還原作業將會失敗。If you attempt to restore a range of blobs that includes blobs in a deleted container, the point-in-time restore operation will fail. 若要瞭解如何刪除容器的保護,請參閱容器的虛 刪除 (預覽) To learn about protecting containers from deletion, see Soft delete for containers (preview).
  • 如果在目前的時間和還原點之間的期間內,將 blob 移至經常性存取層與非經常性存取層之間,則會將 blob 還原至先前的層級。If a blob has moved between the hot and cool tiers in the period between the present moment and the restore point, the blob is restored to its previous tier. 不支援還原封存層中的區塊 blob。Restoring block blobs in the archive tier is not supported. 例如,如果經常性存取層的 Blob 在兩天前已移至封存層,且還原作業還原至三天前的某個時間點,則 Blob 不會還原至經常性存取層。For example, if a blob in the hot tier was moved to the archive tier two days ago, and a restore operation restores to a point three days ago, the blob is not restored to the hot tier. 若要還原封存的 blob,請先將它移出封存層。To restore an archived blob, first move it out of the archive tier. 如需詳細資訊,請參閱 解除凍結封存層的 blob 資料For more information, see Rehydrate blob data from the archive tier.
  • 已透過 Put 區塊PUT 區塊從 URL上傳,但未透過 put block List認可的區塊不是 blob 的一部分,因此不會在還原作業中還原。A block that has been uploaded via Put Block or Put Block from URL, but not committed via Put Block List, is not part of a blob and so is not restored as part of a restore operation.
  • 無法還原具有作用中租用的 blob。A blob with an active lease cannot be restored. 如果包含作用中租用的 blob 包含在要還原的 blob 範圍內,則還原作業會以不可部分完成的方式失敗。If a blob with an active lease is included in the range of blobs to restore, the restore operation will fail atomically. 在起始還原作業之前,請先中斷任何使用中的租用。Break any active leases prior to initiating the restore operation.
  • 在還原作業中,不會建立或刪除快照集。Snapshots are not created or deleted as part of a restore operation. 只有基底 blob 會還原為先前的狀態。Only the base blob is restored to its previous state.
  • 不支援還原 Azure Data Lake Storage Gen2 的平面和階層命名空間。Restoring Azure Data Lake Storage Gen2 flat and hierarchical namespaces is not supported.

重要

如果您將區塊 blob 還原到早于2020年9月22日的某個時間點,則時間點還原的預覽限制將會生效。If you restore block blobs to a point that is earlier than September 22, 2020, preview limitations for point-in-time restore will be in effect. Microsoft 建議您選擇等於或晚于2020年9月22日的還原點,以利用正式推出的時間點還原功能。Microsoft recommends that you choose a restore point that is equal to or later than September 22, 2020 to take advantage of the generally available point-in-time restore feature.

價格和計費Pricing and billing

啟用時間點還原不需要付費。There is no charge to enable point-in-time restore. 不過,啟用時間點還原也可啟用 blob 版本設定、虛刪除和變更摘要,這兩者可能會導致額外的費用。However, enabling point-in-time restore also enables blob versioning, soft delete, and change feed, each of which which may result in additional charges.

時間點還原的計費取決於處理以執行還原作業的資料量。Billing for point-in-time restore depends on the amount of data processed to perform the restore operation. 處理的資料量取決於還原點與目前時間之間發生的變更數目。The amount of data processed is based on the number of changes that occurred between the restore point and the present moment. 例如,假設變更在儲存體帳戶中封鎖 blob 資料的變動率相當頻繁,則在1天內返回的還原作業會在10天內回復的還原成本 1/10。For example, assuming a relatively constant rate of change to block blob data in a storage account, a restore operation that goes back in time 1 day would cost 1/10th of a restore that goes back in time 10 days.

若要預估還原作業的成本,請檢查變更摘要記錄檔,以估計還原期間修改過的資料量。To estimate the cost of a restore operation, review the change feed log to estimate the amount of data that was modified during the restore period. 例如,如果變更摘要的保留期限為30天,而變更摘要的大小為 10 MB,則還原至較早10天的時間點,將會花費大約為該區域中 LRS 帳戶所列出的一到一第三個價格。For example, if the retention period for change feed is 30 days, and the size of the change feed is 10 MB, then restoring to a point 10 days earlier would cost approximately one-third of the price listed for an LRS account in that region. 還原至較早27天的點,將會花費大約九-十分之一的價格。Restoring to a point that is 27 days earlier would cost approximately nine-tenths of the price listed.

如需時間點還原價格的詳細資訊,請參閱 區塊 blob 定價For more information about pricing for point-in-time restore, see Block blob pricing.

下一步Next steps