儲存多達 10 年的 Azure SQL Database 備份Store Azure SQL Database backups for up to 10 years

許多應用程式具有法規、相容性或其他商務用途,需要您保留 Azure SQL Database 自動備份所提供超過 7-35 天的資料庫備份。Many applications have regulatory, compliance, or other business purposes that require you to retain database backups beyond the 7-35 days provided by Azure SQL Database automatic backups. 使用長期保留 (LTR) 功能可讓您將指定的 SQL Database 完整備份儲存在 RA-GRS blob 儲存體中多達 10 年。By using the long-term retention (LTR) feature, you can store specified SQL database full backups in RA-GRS blob storage for up to 10 years. 之後您可以將任何備份還原為新的資料庫。You can then restore any backup as a new database.

注意

可以針對單一和集區資料庫啟用 LTR。LTR can be enabled for single and pooled databases. 它還無法用於受控執行個體上的執行個體資料庫。It is not yet available for instance databases in Managed Instances. 您可以使用 SQL Agent 作業來排程僅限複製的資料庫備份,以替代超過 35 天的 LTR。You can use SQL Agent jobs to schedule copy-only database backups as an alternative to LTR beyond 35 days.

SQL Database 長期保留如何運作How SQL Database long-term retention works

長期備份保留 (LTR) 會運用自動建立的完整資料庫備份來啟用時間點還原 (PITR)。Long-term backup retention (LTR) leverages the full database backups that are automatically created to enable point-time restore (PITR). 如果設定 LTR 原則, 則會將這些備份複製到不同的 blob 以進行長期儲存。If an LTR policy is configured, these backups are copied to different blobs for long-term storage. 複製作業是背景工作, 對資料庫工作負載不會有任何效能影響。The copy operation is a background job that has no performance impact on the database workload. Ltr 備份會保留一段時間, 由 LTR 原則設定。The LTR backups are retained for a period of time set by the LTR policy. 每個 SQL 資料庫的 LTR 原則也可以指定建立 LTR 備份的頻率。The LTR policy for each SQL database can also specify how frequently the LTR backups are created. 若要啟用這項彈性, 您可以使用四個參數的組合來定義原則: 每週備份保留 (W)、每月備份保留 (M)、每年備份保留 (Y) 和年中的周 (WeekOfYear)。To enable that flexibility you can define the policy using a combination of four parameters: weekly backup retention (W), monthly backup retention (M), yearly backup retention (Y), and week of year (WeekOfYear). 如果指定 W,每週一次的備份會複製到長期儲存體。If you specify W, one backup every week will be copied to the long-term storage. 如果指定 M,每月第一週進行的一次備份會複製到長期儲存體。If you specify M, one backup during the first week of each month will be copied to the long-term storage. 如果指定 Y,在以 WeekOfYear 指定的當週進行的一次備份會複製到長期儲存體。If you specify Y, one backup during the week specified by WeekOfYear will be copied to the long-term storage. 在長期儲存體中,每個備份會保留以這些參數所指定的期間。Each backup will be kept in the long-term storage for the period specified by these parameters. LTR 原則的任何變更都適用于未來的備份。Any change of the LTR policy applies to the future backups. 例如, 如果指定的 WeekOfYear 在設定原則時為過去, 則會在下一年建立第一個 LTR 備份。For example, if the specified WeekOfYear is in the past when the policy is configured, the first LTR backup will be created next year.

LTR 原則的範例:Examples of the LTR policy:

  • W=0, M=0, Y=5, WeekOfYear=3W=0, M=0, Y=5, WeekOfYear=3

    每年的第三次完整備份將會保留五年。The third full backup of each year will be kept for five years.

  • W=0, M=3, Y=0W=0, M=3, Y=0

    每個月的第一個完整備份將會保留三個月。The first full backup of each month will be kept for three months.

  • W=12, M=0, Y=0W=12, M=0, Y=0

    每個每週完整備份皆會保留 12 週。Each weekly full backup will be kept for 12 weeks.

  • W=6, M=12, Y=10, WeekOfYear=16W=6, M=12, Y=10, WeekOfYear=16

    每週完整備份將會保留六周。Each weekly full backup will be kept for six weeks. 但每月的第 1 個完整備份除外,這個備份會保留 12 個月。Except first full backup of each month, which will be kept for 12 months. 以及每年的第 16 週的完整備份除外,這個備份會保留 10 年。Except the full backup taken on 16th week of year, which will be kept for 10 years.

下表說明以下原則的長期備份日程和到期日:The following table illustrates the cadence and expiration of the long-term backups for the following policy:

W=12 週 (84 天)、M=12 個月 (365 天)、Y=10 年 (3650 天)、WeekOfYear=15 (4 月 15 日後那一周)W=12 weeks (84 days), M=12 months (365 days), Y=10 years (3650 days), WeekOfYear=15 (week after April 15)

ITR 範例

如果您修改上述原則並設定 W = 0 (沒有每週備份), 備份複本的步調會依照上表中反白顯示的日期而變更。If you modify the above policy and set W=0 (no weekly backups), the cadence of backup copies will change as shown in the above table by the highlighted dates. 用來保留這些備份所需的儲存體數量會跟著減少。The storage amount needed to keep these backups would reduce accordingly.

重要

個別 LTR 備份的時間是由 Azure SQL Database 所控制。The timing of the individual LTR backups is controlled by Azure SQL Database. 您無法手動建立 LTR 備份或控制建立備份的時間。You cannot manually create a LTR backup or control the timing of the backup creation. 設定 LTR 原則之後, 最多可能需要7天, 第一個 LTR 備份才會顯示在可用備份清單上。After configuring an LTR policy, it may take up to 7 days before the first LTR backup will show up on the list of available backups.

異地複寫和長期備份保留Geo-replication and long-term backup retention

如果您使用主動式異地複寫或容錯移轉群組做為商務持續性解決方案, 您應該準備進行最終容錯移轉, 並在異地次要資料庫上設定相同的 LTR 原則。If you are using active geo-replication or failover groups as your business continuity solution, you should prepare for eventual failovers and configure the same LTR policy on the geo-secondary database. 因為不會從次要複本產生備份, 所以您的 LTR 儲存成本不會增加。Your LTR storage cost will not increase as backups are not generated from the secondaries. 只有當次要變成主要時,備份才會建立。Only when the secondary becomes primary the backups will be created. 它可確保在觸發容錯移轉且主要區域移至次要地區時, 不中斷的 LTR 備份產生。It ensures non-interrupted generation of the LTR backups when the failover is triggered and the primary moves to the secondary region.

注意

當原始的主資料庫從造成容錯移轉的中斷復原時, 它會變成新的次要複本。When the original primary database recovers from an outage that caused the failover, it will become a new secondary. 因此,備份的建立不會繼續,而且現有的 LTR 原則將不會生效,除非它再次變成主要資料庫。Therefore, the backup creation will not resume and the existing LTR policy will not take effect until it becomes the primary again.

設定長期備份保留期Configure long-term backup retention

若要瞭解如何使用 Azure 入口網站或 PowerShell 設定長期保留, 請參閱管理 Azure SQL Database 長期備份保留To learn how to configure long-term retention using the Azure portal or PowerShell, see Manage Azure SQL Database long-term backup retention.

從 LTR 備份還原資料庫Restore database from LTR backup

若要從 LTR 儲存體還原資料庫,可以依時間戳記選取特定備份。To restore a database from the LTR storage, you can select a specific backup based on its timestamp. 可將資料庫還原至原始資料庫相同訂用帳戶底下的任何現有伺服器。The database can be restored to any existing server under the same subscription as the original database. 若要瞭解如何使用 Azure 入口網站或 PowerShell 從 LTR 備份還原資料庫, 請參閱管理 Azure SQL Database 長期備份保留To learn how to restore your database from an LTR backup, using the Azure portal or PowerShell, see Manage Azure SQL Database long-term backup retention.

後續步驟Next steps

因為資料庫備份可保護資料免於意外損毀或刪除,是商務持續性和災害復原策略中不可或缺的一環。Because database backups protect data from accidental corruption or deletion, they're an essential part of any business continuity and disaster recovery strategy. 若要深入了解其他 SQL Database 商務持續性解決方案,請參閱商務持續性概觀To learn about the other SQL Database business-continuity solutions, see Business continuity overview.