AffinityType 列舉
The AffinityType enumeration represents the possible affinity settings for an instance of SQL Server.
命名空間: Microsoft.SqlServer.Management.Smo
組件: Microsoft.SqlServer.Smo (在 Microsoft.SqlServer.Smo.dll 中)
語法
'宣告
Public Enumeration AffinityType
'用途
Dim instance As AffinityType
public enum AffinityType
public enum class AffinityType
type AffinityType
public enum AffinityType
成員
成員名稱 | 說明 | |
---|---|---|
Auto | The Auto member represents the auto affinity mode for an instance of SQL Server. In this mode, a database developer can control which threads are assigned to which CPU.
If AffinityType is set to Auto and affinity is set to true or false for one or more CPUs, the following exception is thrown: AffinityType is set to Auto, and affinity is set on one or more CPUs. Change AffinityType to Manual, or remove the affinity setting from all CPUs. This exception is returned when either the [M:Microsoft.SqlServer.Management.Smo.AffinityInfo.Alter()] or [M:Microsoft.SqlServer.Management.Smo.AffinityInfo.Script()] method is called. |
|
Manual | The Manual member represents the manual affinity mode for an instance of SQL Server. In this mode, the Database Engine controls thread assignments for each CPU on the server. |
範例
The following example shows how to display the current AffinityType setting for local instance of SQL Server.
C#
using System;
using Microsoft.SqlServer.Management.Smo;
namespace samples
{
class Program
{
static void Main(string[] args)
{
Server dbServer = new Server("(local)");
dbServer.Refresh();
Console.WriteLine("Server Microsoft.SqlServer.Smo AffinityType is T:Microsoft.SqlServer.Management.Smo.AffinityType.\n",
dbServer.Name, dbServer.AffinityInfo.AffinityType);
}
}
}
Powershell
#Create the server.
$dbServer = new-Object Microsoft.SqlServer.Smo.Server("(local)")
$dbServer.Refresh()
Write-Host Server $dbServer.Name AffinityType is
$dbServer.AffinityInfo.AffinityType