文章出處

使用本地服務器組來管理局域網或公網上的SQLSERVER

測試的兩臺機器

Windows7 64位   SQLSERVER2005 SP5

Windows7 64位   SQLSERVER2012 SP1

打開已注冊的服務器窗口

你看到已注冊服務器里有本地服務器組,SQL2012會多出一個中央管理服務器,暫時不知道中央管理服務器有什么用,

因為本地服務器組跟中央管理服務器兩者的右鍵菜單是一樣的

在本地服務器組上按右鍵-》 新建服務器注冊

輸入連接信息,比較簡單,我這里使用SQLSERVER身份驗證

SQLSERVER身份驗證有一個弊端,就是如果要查看對方的SQLSERVER配置管理器就會說權限不夠,必須要使用Windows身份驗證(域環境)

但是一般要管理公網上的一臺SQLSERVER不會有域環境的,所以這里也是比較可惜,不過從安全方面考慮的話,開啟WMI必須開啟135端口,有一定危險性

我這里先說使用SQLSEVER身份驗證而用不了的功能

1、查看SQLSERVER日志

2、服務控制,需要調用WMI提供程序,要域環境才行

3、SQLSERVER配置管理器

--------------------------------------------------------------華麗的分割線----------------------------------------------------------

要在已經注冊的服務器上執行一些操作,可以在本地服務器組上按右鍵

主要用到兩個操作:(1)新建查詢 (2)對象資源管理器

點擊“新建查詢”,你在新建查詢窗口里輸入的SQL語句都會在所有已經注冊的SQLSERVER上執行一遍

點擊“對象資源管理器”,就會在下面的對象資源管理器窗口打開所有已經注冊的SQLSERVER的對象資源管理

下面演示一下

對象資源管理器

 

 經過測試,SQL2005在本地服務器組里可以注冊SQL2012,SQL2012也可以注冊SQL2005

但是SQL2005不能執行查詢跟對象管理器批量打開功能,SQL2005功能還是比較欠缺

當本地服務器組里已經注冊的服務器比較多的時候,可以導出配置文件,下次重裝SQLSERVER的時候就不需要新建這些SQLSERVER注冊了,有幾百臺SQLSERVER的話

逐個逐個SQLSERVER新建注冊真的太麻煩了,這時候只需要導入配置文件就可以了,比較方便

配置文件格式 :server.regsrvr

  1 <?xml version="1.0"?>
  2 <model xmlns="http://schemas.serviceml.org/smlif/2007/02">
  3   <identity>
  4     <name>urn:uuid:96fe1236-abf6-4a57-b54d-e9baab394fd1</name>
  5     <baseURI>http://documentcollection/</baseURI>
  6   </identity>
  7   <xs:bufferSchema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  8     <definitions xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08">
  9       <document>
 10         <docinfo>
 11           <aliases>
 12             <alias>/system/schema/RegisteredServers</alias>
 13           </aliases>
 14           <sfc:version DomainVersion="1" />
 15         </docinfo>
 16         <data>
 17           <xs:schema targetNamespace="http://schemas.microsoft.com/sqlserver/RegisteredServers/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="http://schemas.serviceml.org/sml/2007/02" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
 18             <xs:element name="ServerGroup">
 19               <xs:complexType>
 20                 <xs:sequence>
 21                   <xs:any namespace="http://schemas.microsoft.com/sqlserver/RegisteredServers/2007/08" processContents="skip" minOccurs="0" maxOccurs="unbounded" />
 22                 </xs:sequence>
 23               </xs:complexType>
 24             </xs:element>
 25             <xs:element name="RegisteredServer">
 26               <xs:complexType>
 27                 <xs:sequence>
 28                   <xs:any namespace="http://schemas.microsoft.com/sqlserver/RegisteredServers/2007/08" processContents="skip" minOccurs="0" maxOccurs="unbounded" />
 29                 </xs:sequence>
 30               </xs:complexType>
 31             </xs:element>
 32             <RegisteredServers:bufferData xmlns:RegisteredServers="http://schemas.microsoft.com/sqlserver/RegisteredServers/2007/08">
 33               <instances xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08">
 34                 <document>
 35                   <docinfo>
 36                     <aliases>
 37                       <alias>/RegisteredServersStore/ServerGroup/DatabaseEngineServerGroup</alias>
 38                     </aliases>
 39                     <sfc:version DomainVersion="1" />
 40                   </docinfo>
 41                   <data>
 42                     <RegisteredServers:ServerGroup xmlns:RegisteredServers="http://schemas.microsoft.com/sqlserver/RegisteredServers/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="http://schemas.serviceml.org/sml/2007/02" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 43                       <RegisteredServers:RegisteredServers>
 44                         <sfc:Collection>
 45                           <sfc:Reference sml:ref="true">
 46                             <sml:Uri>/RegisteredServersStore/ServerGroup/DatabaseEngineServerGroup/RegisteredServer/WIN7U-20130414Z</sml:Uri>
 47                           </sfc:Reference>
 48                           <sfc:Reference sml:ref="true">
 49                             <sml:Uri>/RegisteredServersStore/ServerGroup/DatabaseEngineServerGroup/RegisteredServer/win7u-20130702m</sml:Uri>
 50                           </sfc:Reference>
 51                         </sfc:Collection>
 52                       </RegisteredServers:RegisteredServers>
 53                       <RegisteredServers:Parent>
 54                         <sfc:Reference sml:ref="true">
 55                           <sml:Uri>/RegisteredServersStore</sml:Uri>
 56                         </sfc:Reference>
 57                       </RegisteredServers:Parent>
 58                       <RegisteredServers:Name type="string">DatabaseEngineServerGroup</RegisteredServers:Name>
 59                       <RegisteredServers:ServerType type="ServerType">DatabaseEngine</RegisteredServers:ServerType>
 60                     </RegisteredServers:ServerGroup>
 61                   </data>
 62                 </document>
 63                 <document>
 64                   <docinfo>
 65                     <aliases>
 66                       <alias>/RegisteredServersStore/ServerGroup/DatabaseEngineServerGroup/RegisteredServer/WIN7U-20130414Z</alias>
 67                     </aliases>
 68                     <sfc:version DomainVersion="1" />
 69                   </docinfo>
 70                   <data>
 71                     <RegisteredServers:RegisteredServer xmlns:RegisteredServers="http://schemas.microsoft.com/sqlserver/RegisteredServers/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="http://schemas.serviceml.org/sml/2007/02" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 72                       <RegisteredServers:Parent>
 73                         <sfc:Reference sml:ref="true">
 74                           <sml:Uri>/RegisteredServersStore/ServerGroup/DatabaseEngineServerGroup</sml:Uri>
 75                         </sfc:Reference>
 76                       </RegisteredServers:Parent>
 77                       <RegisteredServers:Name type="string">WIN7U-20130414Z</RegisteredServers:Name>
 78                       <RegisteredServers:Description type="string" />
 79                       <RegisteredServers:ServerName type="string">WIN7U-20130414Z</RegisteredServers:ServerName>
 80                       <RegisteredServers:UseCustomConnectionColor type="boolean">false</RegisteredServers:UseCustomConnectionColor>
 81                       <RegisteredServers:CustomConnectionColorArgb type="int">-2830136</RegisteredServers:CustomConnectionColorArgb>
 82                       <RegisteredServers:ServerType type="ServerType">DatabaseEngine</RegisteredServers:ServerType>
 83                       <RegisteredServers:ConnectionStringWithEncryptedPassword type="string">data source=WIN7U-20130414Z;pooling=False;multipleactiveresultsets=False;packet size=4096</RegisteredServers:ConnectionStringWithEncryptedPassword>
 84                       <RegisteredServers:CredentialPersistenceType type="CredentialPersistenceType">None</RegisteredServers:CredentialPersistenceType>
 85                     </RegisteredServers:RegisteredServer>
 86                   </data>
 87                 </document>
 88                 <document>
 89                   <docinfo>
 90                     <aliases>
 91                       <alias>/RegisteredServersStore/ServerGroup/DatabaseEngineServerGroup/RegisteredServer/win7u-20130702m</alias>
 92                     </aliases>
 93                     <sfc:version DomainVersion="1" />
 94                   </docinfo>
 95                   <data>
 96                     <RegisteredServers:RegisteredServer xmlns:RegisteredServers="http://schemas.microsoft.com/sqlserver/RegisteredServers/2007/08" xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08" xmlns:sml="http://schemas.serviceml.org/sml/2007/02" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 97                       <RegisteredServers:Parent>
 98                         <sfc:Reference sml:ref="true">
 99                           <sml:Uri>/RegisteredServersStore/ServerGroup/DatabaseEngineServerGroup</sml:Uri>
100                         </sfc:Reference>
101                       </RegisteredServers:Parent>
102                       <RegisteredServers:Name type="string">win7u-20130702m</RegisteredServers:Name>
103                       <RegisteredServers:ServerName type="string">WIN7U-20130702M</RegisteredServers:ServerName>
104                       <RegisteredServers:UseCustomConnectionColor type="boolean">false</RegisteredServers:UseCustomConnectionColor>
105                       <RegisteredServers:CustomConnectionColorArgb type="int">0</RegisteredServers:CustomConnectionColorArgb>
106                       <RegisteredServers:ServerType type="ServerType">DatabaseEngine</RegisteredServers:ServerType>
107                       <RegisteredServers:ConnectionStringWithEncryptedPassword type="string">server=WIN7U-20130702M;trusted_connection=true;pooling=false;multipleactiveresultsets=false</RegisteredServers:ConnectionStringWithEncryptedPassword>
108                       <RegisteredServers:CredentialPersistenceType type="CredentialPersistenceType">None</RegisteredServers:CredentialPersistenceType>
109                     </RegisteredServers:RegisteredServer>
110                   </data>
111                 </document>
112               </instances>
113             </RegisteredServers:bufferData>
114           </xs:schema>
115         </data>
116       </document>
117     </definitions>
118   </xs:bufferSchema>
119 </model>

 

如有不對的地方,歡迎大家拍磚o(∩_∩)o


文章列表


不含病毒。www.avast.com
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()