Set-AzSqlDatabaseBackupShortTermRetentionPolicy
設定備份短期保留原則。
語法
Set-AzSqlDatabaseBackupShortTermRetentionPolicy
[-RetentionDays <Int32>]
[-DiffBackupIntervalInHours <Int32>]
[-ResourceGroupName] <String>
[-ServerName] <String>
[-DatabaseName] <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzSqlDatabaseBackupShortTermRetentionPolicy
[-RetentionDays <Int32>]
[-DiffBackupIntervalInHours <Int32>]
-AzureSqlDatabaseObject <AzureSqlDatabaseModel>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzSqlDatabaseBackupShortTermRetentionPolicy
[-RetentionDays <Int32>]
[-DiffBackupIntervalInHours <Int32>]
-ResourceId <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Set-AzSqlDatabaseBackupShortTermRetentionPolicy Cmdlet 會設定此資料庫的短期保留原則。 此原則是時間點還原備份和差異備份頻率的保留期間,以小時為單位。
範例
範例 1
Set-AzSqlDatabaseBackupShortTermRetentionPolicy -ResourceGroupName resourcegroup01 -ServerName server01 -DatabaseName database01 -RetentionDays 6 -DiffBackupIntervalInHours 24
ResourceGroupName ServerName DatabaseName RetentionDays DiffBackupIntervalInHours
----------------- ---------- ------------ ------------- -------------------------
resourcegroup01 server01 database01 6 24
此命令會將 database01 的短期保留原則設定為 6 個保留天數和 24 個差異備份間隔小時。
範例 2
Get-AzSqlDatabase -ResourceGroupName resourcegroup01 -ServerName server01 -DatabaseName database01 | Set-AzSqlDatabaseBackupShortTermRetentionPolicy -RetentionDays 5 -DiffBackupIntervalInHours 12
ResourceGroupName ServerName DatabaseName RetentionDays DiffBackupIntervalInHours
----------------- ---------- ------------ ------------- ------------------------
resourcegroup01 server01 database01 5 12
此命令會透過資料庫物件中的管線,將 database01 的短期保留原則設定為 5 天和 12 個差異備份間隔小時。
範例 3
Set-AzSqlDatabaseBackupShortTermRetentionPolicy -ResourceGroupName resourcegroup01 -ServerName server01 -DatabaseName database01 -RetentionDays 7
ResourceGroupName ServerName DatabaseName RetentionDays DiffBackupIntervalInHours
----------------- ---------- ------------ ------------- -------------------------
resourcegroup01 server01 database01 7 12
此命令只會將 database01 的短期保留原則設定為 7 天。 DiffBackupIntervalInHours 不變。
參數
-AzureSqlDatabaseObject
要為其取得原則的資料庫物件。
類型: | AzureSqlDatabaseModel |
別名: | AzureSqlDatabase |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-Confirm
在執行 Cmdlet 之前,提示您進行確認。
類型: | SwitchParameter |
別名: | cf |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-DatabaseName
要使用的 Azure SQL Database 名稱。
類型: | String |
Position: | 2 |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-DefaultProfile
用於與 Azure 通訊的認證、帳戶、租用戶和訂用帳戶。
類型: | IAzureContextContainer |
別名: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-DiffBackupIntervalInHours
以小時為單位的差異備份頻率。
類型: | Int32 |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-ResourceGroupName
資源群組的名稱。
類型: | String |
Position: | 0 |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-ResourceId
短期保留原則資源標識碼。
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-RetentionDays
備份保留設定,以天為單位。
類型: | Int32 |
Position: | Named |
預設值: | 7 |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-ServerName
資料庫位於的 Azure SQL Server 名稱。
類型: | String |
Position: | 1 |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-WhatIf
顯示 Cmdlet 執行時會發生什麼事。 Cmdlet 未執行。
類型: | SwitchParameter |
別名: | wi |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |