문서를 영문으로 보려면 영문 확인란을 선택하세요. 마우스 포인터를 텍스트 위로 이동시켜 팝업 창에서 영문 텍스트를 표시할 수도 있습니다.
번역
영문

Audit.ReserveDiskSpace 속성

Gets or sets the Boolean property value that specifies whether disk space is reserved for the audit file.

네임스페이스:  Microsoft.SqlServer.Management.Smo
어셈블리:  Microsoft.SqlServer.Smo(Microsoft.SqlServer.Smo.dll)

[SfcPropertyAttribute(SfcPropertyFlags.Standalone)]
public bool ReserveDiskSpace { get; set; }

속성 값

유형: System.Boolean
A Boolean value that specifies whether disk space is reserved for the audit file.If True, disk space equal to the maximum file size, is reserved in advance; otherwise, False (default).

This setting cannot be used when the MaximumFileSize property is set to unlimited.

The following code example demonstrates how to set maximum file size to 5 MB and reserve disk space in advance.

C#

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

namespace samples
{
    class Program
    {
        static void Main(string[] args)
        {
            //Set the maximum file size to a definite value, reserve
            //that amount of space, and then create the audit
            Server dbServer = new Server("(local)");
            Audit dbAudit = new Audit(dbServer, "Test Audit");
            dbAudit.DestinationType = AuditDestinationType.File;
            dbAudit.FilePath = "C:\\AuditDirectory";
            dbAudit.MaximumFileSize = 5;
            dbAudit.ReserveDiskSpace = true;
            dbAudit.Create();
        }
    }
}

Powershell

#Set the maximum file size to a definite value, reserve that amount of #space, and then 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.MaximumFileSize = 5
$dbAudit.ReserveDiskSpace = $TRUE
$dbAudit.Create()

커뮤니티 추가 항목

추가
표시: