AffinityInfo 클래스

The AffinityInfo object represents the Affinity settings for all CPUs and NUMA nodes on an Instance of SQL Server. Access to the AffinityInfo object is provided though the Server object.

상속 계층

System.Object
  Microsoft.SqlServer.Management.Smo.AffinityInfoBase
    Microsoft.SqlServer.Management.Smo.AffinityInfo

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

구문

‘선언
Public NotInheritable Class AffinityInfo _
    Inherits AffinityInfoBase
‘사용 방법
Dim instance As AffinityInfo
public sealed class AffinityInfo : AffinityInfoBase
public ref class AffinityInfo sealed : public AffinityInfoBase
[<SealedAttribute>]
type AffinityInfo =  
    class 
        inherit AffinityInfoBase 
    end
public final class AffinityInfo extends AffinityInfoBase

AffinityInfo 유형에서 다음 멤버를 표시합니다.

속성

  이름 설명
공용 속성 AffinityType Gets or sets the affinity type of the AffinityInfoBase. (AffinityInfoBase에서 상속됨)
공용 속성 Cpus The Cpus member is a collection that represents the CPU settings for all CPUs on an Instance of SQL Server.
공용 속성 NumaNodes Gets a collection that contains the NUMA node settings. (AffinityInfoBase에서 상속됨)
공용 속성 Parent This gets the parent object of the AffinityInfo object. This value is the same as the Server object that contains the AffinityInfo member.

맨 위로 이동

메서드

  이름 설명
공용 메서드 Alter Updates the AffinityInfo object property changes on the instance of SQL Server. (AffinityInfoBase에서 상속됨)
공용 메서드 Equals (Object에서 상속됨)
공용 메서드 GetHashCode (Object에서 상속됨)
공용 메서드 GetType (Object에서 상속됨)
공용 메서드 Refresh This method fills in the Cpus and NumaNode with the local server settings. (AffinityInfoBase.Refresh()을(를) 재정의함)
공용 메서드 Script() Generates a Transact-SQL script. (AffinityInfoBase에서 상속됨)
공용 메서드 Script(ScriptingOptions) Generates a Transact-SQL script. (AffinityInfoBase에서 상속됨)
공용 메서드 ToString (Object에서 상속됨)

맨 위로 이동

주의

To get AffinityInfo object properties, users can be a member of the public fixed server role.

To set any AffinityInfo object properties and run the Alter method, users must have ALTER permission on the database.

To create a AffinityInfo object, users must have ALTER ANY APPLICATION role permission on the parent database.

To drop an AffinityInfo object, users must be the owner of the application role or have ALTER ANY APPLICATION role permission on the parent database.

To grant, deny, and revoke permission on the AffinityInfo object, users must have CONTROL permission on the application role.

This example shows you how to set all of the CPU’s on an instance of SQL Server to hard affinity.

C#

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

namespace samples
{
    class Program
    {
        static void Main(string[] args)
        {
            Server dbServer = new Server("(local)");
            dbServer.AffinityInfo.AffinityType = AffinityType.Manual;

            foreach (Cpu cpu in dbServer.AffinityInfo.Cpus)
                cpu.AffinityMask = true;

            dbServer.AffinityInfo.Alter();
        }
    }
}

Powershell

//Create the server. 
$dbServer = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")

//Set the Affinity Type
$dbServer.AffinityInfo.AffinityType = [Microsoft.SqlServer.Management.Smo.AffinityType]'Manual'

//Set each CPU to Hard affinity and update
foreach ($cpu In $dbServer.AffinityInfo.Cpus)
{
   $cpu.AffinityMask = $True
   $dbServer.AffinityInfo.Alter() 
}

스레드 보안

이 유형의 모든 공용 static(Visual Basic에서는 Shared) 멤버는 스레드로부터 안전합니다. 인스턴스 멤버는 스레드로부터의 안전성이 보장되지 않습니다.

참고 항목

참조

Microsoft.SqlServer.Management.Smo 네임스페이스

관련 자료

Best Practices for Greater than 64 CPU Installations

ALTER SERVER CONFIGURATION SET PROCESS AFFINITY (Transact-SQL)