다음을 통해 공유


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 Sub Refresh
‘사용 방법
Dim instance As AffinityInfo

instance.Refresh()
public void Refresh()
public:
void Refresh()
member Refresh : unit -> unit 
public 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