Audit.QueueDelay 属性

Gets or sets the amount of time in milliseconds that can elapse before audit actions are processed.

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

语法

声明
<SfcPropertyAttribute(SfcPropertyFlags.Standalone)> _
Public Property QueueDelay As Integer 
    Get 
    Set
用法
Dim instance As Audit 
Dim value As Integer 

value = instance.QueueDelay

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

属性值

类型:System.Int32
A Int32 value that specifies the number of milliseconds that can elapse before audit actions are processed.

注释

The default value, 1000 (1 second), is the minimum value that can be set. The maximum value that can be set is 2,147,483,647 milliseconds, which is equivalent to 24 days, 20 hours, 31 minutes, 23.647 seconds. The value 0 indicates synchronous delivery.

示例

The following code example demonstrates how to set the queue delay to 5000 milliseconds.

C#

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

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

Powershell

#Create the audit and set the queue delay
$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.QueueDelay = 5000
$dbAudit.Create()

请参阅

参考

Audit 类

Microsoft.SqlServer.Management.Smo 命名空间