Audit.MaximumRolloverFiles 속성

Gets or sets the maximum number of rollover files allowed.

네임스페이스:  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
An int64 value that specifies the maximum number of rollover files allowed.

주의

A rollover file is created when the audit file exceeds the maximum file size. Subsequent audit information is logged into the rollover file.

The maximum number of files you can specify is 2,147,483,647. You can set the value to 0 to specify that an unlimited number of rollover files can be created in the file system.

The following code example demonstrates how to set a maximum of 2 rollover files for the audit.

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 네임스페이스