SQL Server simultaneously executes statements on multiple servers

Source: Internet
Author: User
Tags management studio sql server management sql server management studio

To manage multiple servers as a DBA, you usually need to collect information from multiple servers. In SQL Server 2008, the general practice is to use the linked server or a cell phone from a single server and then summarize the information to the central server. These require many additional configurations.

 

 

SQL Server 2008 provides a new function to execute statements on multiple servers at the same time.

 

 

Implementation Method: create a local server group, or create a central management server and one or more server groups, and create one or more registered servers in these groups, then query the entire group.You can merge the results returned by the query into a single result pane, or return these results in a separate result pane.The result set may contain additional columns, that is, the server name and login name used for queries on each server. You can only use Windows authentication to register a central management server and a secondary server.

Because the returned data protects the server and login name, it is very convenient for us to process data later.

Execute statements for multiple configuration targets at the same time
    1. In SQL Server Management studio"View"Click"Registered servers".

    2. Expand a central management server, right-click a server group, and point"Connection"And then click"New query".

    3. In the query Editor, type and execute a Transact-SQL statement, for example:

      Use mastergoselect * From sysdatabases; go

      By default, the Results pane combines query results from all servers in the server group.

The following is the query result (very convenient ):

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.