使用本地服务器组来管理局域网或公网上的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
<?xml version="1.0"?>
<model xmlns="http://schemas.serviceml.org/smlif/2007/02">
<identity>
<name>urn:uuid:96fe1236-abf6-4a57-b54d-e9baab394fd1</name>
<baseURI>http://documentcollection/</baseURI>
</identity>
<xs:bufferSchema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<definitions xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08">
<document>
<docinfo>
<aliases>
<alias>/system/schema/RegisteredServers</alias>
</aliases>
<sfc:version DomainVersion="1" />
</docinfo>
<data>
<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">
<xs:element name="ServerGroup">
<xs:complexType>
<xs:sequence>
<xs:any namespace="http://schemas.microsoft.com/sqlserver/RegisteredServers/2007/08" processContents="skip" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="RegisteredServer">
<xs:complexType>
<xs:sequence>
<xs:any namespace="http://schemas.microsoft.com/sqlserver/RegisteredServers/2007/08" processContents="skip" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<RegisteredServers:bufferData xmlns:RegisteredServers="http://schemas.microsoft.com/sqlserver/RegisteredServers/2007/08">
<instances xmlns:sfc="http://schemas.microsoft.com/sqlserver/sfc/serialization/2007/08">
<document>
<docinfo>
<aliases>
<alias>/RegisteredServersStore/ServerGroup/DatabaseEngineServerGroup</alias>
</aliases>
<sfc:version DomainVersion="1" />
</docinfo>
<data>
<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">
<RegisteredServers:RegisteredServers>
<sfc:Collection>
<sfc:Reference sml:ref="true">
<sml:Uri>/RegisteredServersStore/ServerGroup/DatabaseEngineServerGroup/RegisteredServer/WIN7U-20130414Z</sml:Uri>
</sfc:Reference>
<sfc:Reference sml:ref="true">
<sml:Uri>/RegisteredServersStore/ServerGroup/DatabaseEngineServerGroup/RegisteredServer/win7u-20130702m</sml:Uri>
</sfc:Reference>
</sfc:Collection>
</RegisteredServers:RegisteredServers>
<RegisteredServers:Parent>
<sfc:Reference sml:ref="true">
<sml:Uri>/RegisteredServersStore</sml:Uri>
</sfc:Reference>
</RegisteredServers:Parent>
<RegisteredServers:Name type="string">DatabaseEngineServerGroup</RegisteredServers:Name>
<RegisteredServers:ServerType type="ServerType">DatabaseEngine</RegisteredServers:ServerType>
</RegisteredServers:ServerGroup>
</data>
</document>
<document>
<docinfo>
<aliases>
<alias>/RegisteredServersStore/ServerGroup/DatabaseEngineServerGroup/RegisteredServer/WIN7U-20130414Z</alias>
</aliases>
<sfc:version DomainVersion="1" />
</docinfo>
<data>
<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">
<RegisteredServers:Parent>
<sfc:Reference sml:ref="true">
<sml:Uri>/RegisteredServersStore/ServerGroup/DatabaseEngineServerGroup</sml:Uri>
</sfc:Reference>
</RegisteredServers:Parent>
<RegisteredServers:Name type="string">WIN7U-20130414Z</RegisteredServers:Name>
<RegisteredServers:Description type="string" />
<RegisteredServers:ServerName type="string">WIN7U-20130414Z</RegisteredServers:ServerName>
<RegisteredServers:UseCustomConnectionColor type="boolean">false</RegisteredServers:UseCustomConnectionColor>
<RegisteredServers:CustomConnectionColorArgb type="int">-2830136</RegisteredServers:CustomConnectionColorArgb>
<RegisteredServers:ServerType type="ServerType">DatabaseEngine</RegisteredServers:ServerType>
<RegisteredServers:ConnectionStringWithEncryptedPassword type="string">data source=WIN7U-20130414Z;pooling=False;multipleactiveresultsets=False;packet size=4096</RegisteredServers:ConnectionStringWithEncryptedPassword>
<RegisteredServers:CredentialPersistenceType type="CredentialPersistenceType">None</RegisteredServers:CredentialPersistenceType>
</RegisteredServers:RegisteredServer>
</data>
</document>
<document>
<docinfo>
<aliases>
<alias>/RegisteredServersStore/ServerGroup/DatabaseEngineServerGroup/RegisteredServer/win7u-20130702m</alias>
</aliases>
<sfc:version DomainVersion="1" />
</docinfo>
<data>
<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">
<RegisteredServers:Parent>
<sfc:Reference sml:ref="true">
<sml:Uri>/RegisteredServersStore/ServerGroup/DatabaseEngineServerGroup</sml:Uri>
</sfc:Reference>
</RegisteredServers:Parent>
<RegisteredServers:Name type="string">win7u-20130702m</RegisteredServers:Name>
<RegisteredServers:ServerName type="string">WIN7U-20130702M</RegisteredServers:ServerName>
<RegisteredServers:UseCustomConnectionColor type="boolean">false</RegisteredServers:UseCustomConnectionColor>
<RegisteredServers:CustomConnectionColorArgb type="int">0</RegisteredServers:CustomConnectionColorArgb>
<RegisteredServers:ServerType type="ServerType">DatabaseEngine</RegisteredServers:ServerType>
<RegisteredServers:ConnectionStringWithEncryptedPassword type="string">server=WIN7U-20130702M;trusted_connection=true;pooling=false;multipleactiveresultsets=false</RegisteredServers:ConnectionStringWithEncryptedPassword>
<RegisteredServers:CredentialPersistenceType type="CredentialPersistenceType">None</RegisteredServers:CredentialPersistenceType>
</RegisteredServers:RegisteredServer>
</data>
</document>
</instances>
</RegisteredServers:bufferData>
</xs:schema>
</data>
</document>
</definitions>
</xs:bufferSchema>
</model>
如有不对的地方,欢迎大家拍砖o(∩_∩)o