How to rename SQL ServerName?

  • For some reasons, we moved one default SQL instance from one server box to another server box.

    As a result, the srvname in the master..sysservers keeps unchanged.

    When running SELECT @@SERVERNAME, we got the name of the old server, rather than the new one.

    How to change it?

    Any input will be greatly appreciated.

  • http://msdn.microsoft.com/en-us/library/ms143799.aspx

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • First of all, thank you for your input.

    Maybe, I did not state my question clear.

    I would like to rename the instance not the computer name. Your link showed how to rename a computer.

  • No, the link showed how to rename a SQL Server instance. The question was perfectly clear.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • The article shows the sp_dropserver/sp_addserver, which is what you do on the SQL Server.

  • Thanks all!

    I got it with all your helps.

  • Editor: Post removed as it was copied from another source.

  • ahmedmujtaba88 (10/4/2011)


    The following steps cannot be used to rename an instance of SQL Server. They can be used only to rename the part of the instance name that corresponds to the computer name.

    For example, you can change a computer named Machine1

    That is a direct copy-paste from

    http://msdn.microsoft.com/en-us/library/ms143799.aspx

    By posting that without a quote you're implying it's your own work. It is not, it's a direct copy from a Microsoft page. Copying extracts from BoL is fine, but they they need to be attributed and referenced.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • just try Sp_rename 'oldservername','newservname'

    this should work out for you

  • madhusudan418 (10/5/2011)


    just try Sp_rename 'oldservername','newservname'

    this should work out for you

    EXEC sp_rename 'Myrlin\SQL2008', 'SomeOtherServer\SQL2008'

    Msg 15225, Level 11, State 1, Procedure sp_rename, Line 338

    No item by the name of 'Myrlin\SQL2008' could be found in the current database 'master', given that @itemtype was input as '(null)'.

    sp_rename is used to rename objects. To rename a server, follow the advice in the article that is referenced.

    Per Books Online:

    sp_rename

    Changes the name of a user-created object in the current database. This object can be a table, index, column, alias data type, or Microsoft .NET Framework common language runtime (CLR) user-defined type.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply