首页 > 代码库 > 修改服务器名后,sql server的配置处理

修改服务器名后,sql server的配置处理

 

1、确认SQL数据库实例服务器名和服务器名一致

  1. use master

  2. go

  3. select @@servername

  4. select serverproperty(‘servername‘)

  5. ------

  6. IF serverproperty(‘servername‘)<>@@servername

  7. BEGIN

  8. DECLARE @server SYSNAME

  9. SET @server=@@servername

  10. EXEC sp_dropserver @server=@server

  11. SET @server=cast(serverproperty(‘servername‘) AS SYSNAME)

  12. EXEC sp_addserver @server=@server,@local=‘LOCAL‘

  13. END

  14. ELSE

  15. PRINT ‘实例名与主机名一致,无需修改!‘

 

参看文章:http://blog.csdn.net/leamonjxl/article/details/6674698

 

2、遇到报错

Cannot connect to WMI provider. You do not have permission or the server is unreachable. Note that you can only manage SQL Server 2005 servers with SQL Server Configuration Manager.
Invalid class [0x80041010]

 

解决办法:

使用管理员身份运行cmd命令C:\Program Files (x86)\Microsoft SQL Server\Shared>mofcomp "C:\Program Files\Microsoft SQL Server\Shared\sqlmgmproviderxpsp2up.mof"

 

参看文章:http://wenku.baidu.com/link?url=2ULpQX9ldyFUd1_PbmrBGEAwp99SG9IL40A27CoVbDhlCOXskJ9FYwX_og2KBABuEvRkIJyJf4JzvznVXaYJqIDPiRy-BcETiczJyZ8liyK

本文出自 “fishvsfrog” 博客,请务必保留此出处http://fishvsfrog.blog.51cto.com/388027/1435266