다음을 통해 공유


RemoteServers Collection

Microsoft SQL Server의 이후 버전에서는 이 기능이 제거됩니다. 새 개발 작업에서는 이 기능을 사용하지 않도록 하고, 현재 이 기능을 사용하는 응용 프로그램은 수정하십시오.

The RemoteServers collection contains RemoteServer objects that expose the attributes of an instance of Microsoft SQL Server visible as a remote server.

현재 개체를 보여 주는 SQL-DMO 개체 모델

Properties

주의

SQL Server provides several mechanisms to help manage connections between instances of SQL Server in an organization. One mechanism is remote-server naming.

An instance of SQL Server can maintain authentication information for connections originating from other instances of SQL Server. Each instance of SQL Server in an organization can control access by listing instances of SQL Server from which it accepts connections.

Additionally, when a remote server is named at an instance of SQL Server, the server maintaining the name list can, in turn, originate a connection to a named remote server.

[!참고]

Remote server naming is one method for configuring server-initiated access for instances of SQL Server in an organization. SQL Server version 7.0 implements distributed queries using persisted OLE DB data source definitions called linked servers. For more information, see LinkedServer Object.

With the RemoteServers collection, you can:

  • Identify an instance of SQL Server as a remote server.

  • Remove remote server naming.

  • Rename an instance of SQL Server.

To identify an instance of SQL Server as a remote server

  1. Create a RemoteServer object.

  2. Configure the RemoteServer object by setting the Name, NetName, and Options properties.

  3. Add the RemoteServer object to the RemoteServers collection of a connected SQLServer object.

To remove a named remote server, disabling access to or from the instance

  • Use the Remove method of the RemoteServers collection, as in:

    oSQLServer.RemoteServers.Remove("LONDON1")
    

To rename an instance of SQL Server

  1. Use the Remove method of the RemoteServers collection, providing the existing name of the instance SQL Server in the method call.

  2. Create a RemoteServer object.

  3. Configure the RemoteServer object by setting the Name property to the new name.

  4. Configure the RemoteServer object by setting the NetName property to the network name of the instance of SQL Server.

  5. Add the RemoteServer object to the RemoteServerscollection of the SQLServer object.

  6. Use the Shutdown and Start methods of the SQLServerobject to restart the instance of SQL Server.

When using the Item or Remove method, the RemoteServers collection supports member identification using either name or ordinal reference syntax. For example:

Set oRemoteServer = oSQLServer.RemoteServers("SEATTLE2")

Or:

Set oRemoteServer = oSQLServer.RemoteServers(2)

[!참고]

Creating or removing remote server entries by using the RemoteServers collection requires appropriate privilege. The SQL Server login used for SQLServer object connection must be a member of the fixed role setupadmin or a role with greater privilege.