Server.AffinityInfo 속성

Gets the AffinityInfo object that is associated with an instance of SQL Server.

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

구문

‘선언
<SfcObjectAttribute(SfcObjectRelationship.ChildObject, SfcObjectCardinality.One)> _
Public ReadOnly Property AffinityInfo As AffinityInfo 
    Get
‘사용 방법
Dim instance As Server 
Dim value As AffinityInfo 

value = instance.AffinityInfo
[SfcObjectAttribute(SfcObjectRelationship.ChildObject, SfcObjectCardinality.One)]
public AffinityInfo AffinityInfo { get; }
[SfcObjectAttribute(SfcObjectRelationship::ChildObject, SfcObjectCardinality::One)]
public:
property AffinityInfo^ AffinityInfo {
    AffinityInfo^ get ();
}
[<SfcObjectAttribute(SfcObjectRelationship.ChildObject, SfcObjectCardinality.One)>]
member AffinityInfo : AffinityInfo
function get AffinityInfo () : AffinityInfo

속성 값

유형: Microsoft.SqlServer.Management.Smo.AffinityInfo
The AffinityInfo object for specified instance of SQL Server.

주의

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.

The following example shows how to set all the CPUs on an instance of SQL Server to hard affinity.

Visual Basic

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

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

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

            dbServer.AffinityInfo.Alter();
        }
    }
}

Powershell

$dbServer = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$dbServer.AffinityInfo.AffinityType = [Microsoft.SqlServer.Management.Smo.AffinityType]'Manual'

foreach ($cpu In $dbServer.AffinityInfo.Cpus)
{
   $cpu.AffinityMask = $True
   $dbServer.AffinityInfo.Alter() 
}

참고 항목

참조

Server 클래스

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

관련 자료

CPU 개수가 64개를 초과하는 컴퓨터에서 SQL Server를 실행하기 위한 최선의 방법

ALTER SERVER CONFIGURATION(Transact-SQL)