DeleteBackupHistory 方法 (DateTime)

删除指定日期和时间前的此 SQL Server 实例的备份历史记录。

命名空间:  Microsoft.SqlServer.Management.Smo
程序集:  Microsoft.SqlServer.Smo(在 Microsoft.SqlServer.Smo.dll 中)

语法

声明
Public Sub DeleteBackupHistory ( _
    oldestDate As DateTime _
)
用法
Dim instance As Server
Dim oldestDate As DateTime

instance.DeleteBackupHistory(oldestDate)
public void DeleteBackupHistory(
    DateTime oldestDate
)
public:
void DeleteBackupHistory(
    DateTime oldestDate
)
member DeleteBackupHistory : 
        oldestDate:DateTime -> unit 
public function DeleteBackupHistory(
    oldestDate : DateTime
)

参数

  • oldestDate
    类型:System. . :: . .DateTime
    一个 DateTime 系统对象值,该值指定一个日期和时间,这个日期和时间之前的备份历史记录将被删除。

注释

Use this method to remove old backup history logs from the instance of SQL Server. Backup history that is older than the date specified will be removed from the instance of SQL Server.

示例

Visual Basic

'Connect to the local, default instance of SQL Server.
Dim srv1 As Server
srv1 = New Server

'Delete the backup history before the date specified.
Dim odt As DateTime
odt = New DateTime(2005, 12, 12)
srv1.DeleteBackupHistory(odt)

PowerShell

$srv1 = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$odt = new-object System.DateTime(2005, 12, 12)
$srv1.DeleteBackupHistory($odt)