AffinityInfo.Refresh 方法

This method fills in the Cpus and NumaNode with the local server settings.

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

语法

声明
Public Overrides Sub Refresh
用法
Dim instance As AffinityInfo

instance.Refresh()
public override void Refresh()
public:
virtual void Refresh() override
abstract Refresh : unit -> unit  
override Refresh : unit -> unit
public override function Refresh()

注释

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

示例

This example shows you how to determine the number of CPUs on the local instance of SQL Server.

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("Total CPUs = {0}",
                dbServer.AffinityInfo.Cpus.Count);
        }
    }
}

Powershell

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

//Set the Affinity Type to Auto
#dbServer.AffinityInfo.Refresh()
Write-Host "Total CPUs = ",$dbServer.AffinityInfo.Cpus.Count

请参阅

参考

AffinityInfo 类

Microsoft.SqlServer.Management.Smo 命名空间