Changing @@servername to be the same name as the server

  • I have searched and searched and I still can't figure this out after looking at many blogs and forums.

    We are using Recovery Point which basically copies the drives where the system and user databases are located and mirrors them onto another drive. This drive is connected to another instance which is our failover standby instance with a different server name.

    The production instance is nytsqlbmcpytsqlbmcp.

    The standby instance is xnytsqlbmcpytsqlbmcp.

    We brought up the standby instance and it came up successfully however later I noticed that jobs from the standby were running on the production server (we never took this instance down). I don't want that to happen. I noticed in the jobs an add connection however I couldn't update the existing connection to reflect xnytsqlbmcpytsqlbmcp. Instead it had nytsqlbmcpytsqlbmcp.

    Searching the net and forums. I found select @@servername and I received nytsqlbmcpytsqlbmcp.

    I wanted to change it to xnytsqlbmcpytsqlbmcp. The actual sql instance is xnytsqlbmcpytsqlbmcp.

    I ran select serverproperty('servername') and received xnytsqlbmcpytsqlbmcp which is correct.

    I ran EXEC master.dbo.sp_dropserver '[NYTSQLBMCP\NYTSQLBMCP]' and it failed saying run sp_helpserver. Sorry I don't have the error message any longer. Now I am stuck.

    Thanks for your help.

    Patti

  • I ran EXEC master.dbo.sp_dropserver '[NYTSQLBMCP\NYTSQLBMCP]' and it failed saying run sp_helpserver. Sorry I don't have the error message any longer. Now I am stuck.

    Thanks for your help.

    Patti

    Remove the square brackets from the servername in your sp_dropserver call. If you ran it the way you've posted it - I imagine the error you received was something along the lines of the server not existing. You may also have received an error something to do with remote logins but we'll burn that bridge when we get to it.

    EXEC master.dbo.sp_dropserver 'NYTSQLBMCP\NYTSQLBMCP'


    -Ken

  • Thank you very much. I will try this but I have to wait until no one is using the server because I know that I will have to restart sql afterwards.

    I am assuming then that the sp_addserver will be the same but without brackets also.

    EXEC master.dbo.sp_addserver 'XNYTSQLBMCP\NYTSQLBMCP', local;

    GO

Viewing 3 posts - 1 through 2 (of 2 total)

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