다음을 통해 공유


Server 클래스

The Server object represents an instance of SQL Server.

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

구문

‘선언
<PhysicalFacetAttribute> _
<RootFacetAttribute(GetType(Server))> _
<EvaluationModeAttribute(AutomatedPolicyEvaluationMode.CheckOnSchedule)> _
Public NotInheritable Class Server _
    Inherits SqlSmoObject _
    Implements IAlterable, IScriptable, IServerSettings, IServerInformation,  _
    IDmfFacet, IAlienRoot
‘사용 방법
Dim instance As Server
[PhysicalFacetAttribute]
[RootFacetAttribute(typeof(Server))]
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode.CheckOnSchedule)]
public sealed class Server : SqlSmoObject, 
    IAlterable, IScriptable, IServerSettings, IServerInformation, IDmfFacet, 
    IAlienRoot
[PhysicalFacetAttribute]
[RootFacetAttribute(typeof(Server))]
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode::CheckOnSchedule)]
public ref class Server sealed : public SqlSmoObject, 
    IAlterable, IScriptable, IServerSettings, IServerInformation, IDmfFacet, 
    IAlienRoot
[<SealedAttribute>]
[<PhysicalFacetAttribute>]
[<RootFacetAttribute(typeof(Server))>]
[<EvaluationModeAttribute(AutomatedPolicyEvaluationMode.CheckOnSchedule)>]
type Server =  
    class
        inherit SqlSmoObject
        interface IAlterable
        interface IScriptable
        interface IServerSettings
        interface IServerInformation
        interface IDmfFacet
        interface IAlienRoot
    end
public final class Server extends SqlSmoObject implements IAlterable, IScriptable, IServerSettings, IServerInformation, IDmfFacet, IAlienRoot

주의

The Server class represents an instance of SQL Server. In SMO programming, the Server object determines the connection to a physical SQL Server installation. The Server class is the highest level in the SMO instance object hierarchy. When a Server object variable is created, it establishes a connection to an instance of SQL Server. If you do not specify the name in the Server class constructor, the connection is always made with the local, default instance of SQL Server.

By using the Server object, you can do the following:

  • Connect to an instance of SQL Server.

  • Modify the connection settings.

  • Run Transact-SQL statements directly.

  • Capture Transact-SQL output from the SMO program.

  • Manage transactions.

  • View operating system information.

  • Modify and view SQL Server settings, information, and user options.

  • Modify and view SQL Server configuration options.

  • Register the instance of SQL Server in the Active Directory directory service.

  • Subscribe to and handle SQL Server events.

  • Reference databases, endpoints, credentials, logins, linked servers, system messages, DDL triggers, system data types, and user-defined messages.

  • Regenerate the service master key.

  • Detach and attach databases.

  • Stop processes or databases.

  • Grant, deny, or revoke permissions on the database.

  • Enumerate information about the server.

  • Read the error log.

  • Remove the backup history.

  • Get and set the default initialization fields for specified types.

  • Create endpoints, such as database mirroring endpoint.

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

To set Server object properties, users must be a member of the sysadmin fixed server role.

Thread Safety

이 유형의 모든 public static(Microsoft Visual Basic의 경우 공유) 멤버는 다중 스레드 작업을 수행하기에 안전합니다. 인스턴스 멤버는 스레드로부터의 안전성이 보장되지 않습니다.

상속 계층 구조

System. . :: . .Object
  Microsoft.SqlServer.Management.Smo. . :: . .SmoObjectBase
    Microsoft.SqlServer.Management.Smo. . :: . .SqlSmoObject
      Microsoft.SqlServer.Management.Smo..::..Server

스레드로부터의 안전성

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