zoukankan      html  css  js  c++  java
  • 使用本地服务器组来管理局域网或公网上的SQLSERVER

    使用本地服务器组来管理局域网或公网上的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

  • 相关阅读:
    【LeetCode & 剑指offer刷题】数组题18:Plus One
    SQL Server 2005 的动态管理视图DMV和函数DMF
    数据库SQL优化大总结之 百万级数据库优化方案
    误删SQL Server日志文件后怎样附加数据库
    教你建立SQL数据库的表分区
    Sql Server 阻塞的常见原因和解决办法
    SQL索引优化方法
    详解如何定义SQL Server外关键字约束
    写出高性能SQL语句的十三条法则
    SQL SERVER内部函数大全
  • 原文地址:https://www.cnblogs.com/lyhabc/p/3188548.html
Copyright © 2011-2022 走看看