Audit.MaximumRolloverFiles プロパティ

許可されるロールオーバー ファイルの最大数を取得または設定します。

名前空間:  Microsoft.SqlServer.Management.Smo
アセンブリ:  Microsoft.SqlServer.Smo (Microsoft.SqlServer.Smo.dll)

構文

'宣言
<SfcPropertyAttribute(SfcPropertyFlags.Standalone)> _
Public Property MaximumRolloverFiles As Long 
    Get 
    Set
'使用
Dim instance As Audit 
Dim value As Long 

value = instance.MaximumRolloverFiles

instance.MaximumRolloverFiles = value
[SfcPropertyAttribute(SfcPropertyFlags.Standalone)]
public long MaximumRolloverFiles { get; set; }
[SfcPropertyAttribute(SfcPropertyFlags::Standalone)]
public:
property long long MaximumRolloverFiles {
    long long get ();
    void set (long long value);
}
[<SfcPropertyAttribute(SfcPropertyFlags.Standalone)>]
member MaximumRolloverFiles : int64 with get, set
function get MaximumRolloverFiles () : long 
function set MaximumRolloverFiles (value : long)

プロパティ値

型: System.Int64
許可されるロールオーバー ファイルの最大数を示す int64 値です。

説明

ロールオーバー ファイルは、監査ファイルが最大ファイル サイズを超えたときに作成されます。 後続の監査情報はロールオーバー ファイルに記録されます。

指定できるファイルの最大数は 2,147,483,647 です。 ファイル システムに作成できるロールオーバー ファイルの数を無制限にするには、この値を 0 を指定します。

使用例

次のコード例では、監査のロールオーバー ファイルの最大数を 2 に設定する方法を示します。

C#

using System;
using System.Data;
using Microsoft.SqlServer.Management.Smo;

namespace samples
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create the audit
            Server dbServer = new Server("(local)");
            Audit dbAudit = new Audit(dbServer, "Test Audit");
            dbAudit.DestinationType = AuditDestinationType.File;
            dbAudit.FilePath = "C:\\AuditDirectory";
            dbAudit.MaximumRolloverFiles = 2;
            dbAudit.Create();
        }
    }
}

Powershell

#Create the audit 
$dbServer = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$dbAudit = New-Object Microsoft.SqlServer.Management.Smo.Audit($dbServer, "Test Audit")
$dbAudit.DestinationType = [Microsoft.SqlServer.Management.Smo.AuditDestinationType]'File'
$dbAudit.FilePath = "C:\AuditDirectory"
$dbAudit.MaximumRolloverFiles = 2
$dbAudit.Create()

関連項目

参照

Audit クラス

Microsoft.SqlServer.Management.Smo 名前空間