Partilhar via


Propriedade do RDL Audit.ReserveDiskSpace

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

Namespace:  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (em Microsoft.SqlServer.Smo.dll)

Sintaxe

'Declaração
<SfcPropertyAttribute(SfcPropertyFlags.Standalone)> _
Public Property ReserveDiskSpace As Boolean 
    Get 
    Set
'Uso
Dim instance As Audit 
Dim value As Boolean 

value = instance.ReserveDiskSpace

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

Valor da propriedade

Tipo: 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).

Comentários

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

Exemplos

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()

Consulte também

Referência

Audit Classe

Namespace Microsoft.SqlServer.Management.Smo