Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Machine Name change not being recognized by SQL

 
   Database Help (Home) -> Programming RSS
Next:  Unable to create project using SSMS 2008  
Author Message
Neil W

External


Since: Feb 04, 2010
Posts: 4



(Msg. 1) Posted: Thu Feb 04, 2010 3:29 pm
Post subject: Machine Name change not being recognized by SQL
Archived from groups: microsoft>public>sqlserver>programming (more info?)

When running this:
master.dbo.sp_add_log_shipping_primary_database

I get the following error:
Msg 14262, Level 16, State 1, Procedure sp_add_jobserver, Line 88
The specified @server_name ('oldname') does not exist.

Note that the machine name for server 'oldname' was changed to 'newname'
and rebooted. As expected, @@servername and serverproperty('servername')
return 'newname'

However, somehow oldserver is getting added to the job and, of course, it is
coming back as not existing.

What has to be done to the SQL instance to get it to recognize a machine
name
change?

I am using SQL 2005 (default instance) on Windows 2003 Server, all updates
applied.

Thanks.

 >> Stay informed about: Machine Name change not being recognized by SQL 
Back to top
Login to vote
jbellnewsposts

External


Since: Feb 05, 2010
Posts: 1



(Msg. 2) Posted: Fri Feb 05, 2010 12:25 pm
Post subject: Re: Machine Name change not being recognized by SQL [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Thu, 4 Feb 2010 15:29:14 -0500, "Neil W" wrote:

>When running this:
> master.dbo.sp_add_log_shipping_primary_database
>
>I get the following error:
>Msg 14262, Level 16, State 1, Procedure sp_add_jobserver, Line 88
>The specified @server_name ('oldname') does not exist.
>
>Note that the machine name for server 'oldname' was changed to 'newname'
>and rebooted. As expected, @@servername and serverproperty('servername')
>return 'newname'
>
>However, somehow oldserver is getting added to the job and, of course, it is
>coming back as not existing.
>
>What has to be done to the SQL instance to get it to recognize a machine
>name
>change?
>
>I am using SQL 2005 (default instance) on Windows 2003 Server, all updates
>applied.
>
>Thanks.
>
>
>
Hi

I assume SELECT @@SERVERNAME returns the old name?

SELECT HOST_NAME(), @@SERVERNAME

Than try:

DECLARE @INSTANCENAME sysname
SET @INSTANCENAME = NULLIF(RIGHT ( @@SERVERNAME, CASE WHEN
CHARINDEX('\',@@SERVERNAME ) > 0 THEN LEN(@@SERVERNAME) -
CHARINDEX('\',@@SERVERNAME ) ELSE 0 END ),'')
--SELECT @INSTANCENAME

IF LEFT ( @@SERVERNAME, CASE WHEN CHARINDEX('\',@@SERVERNAME ) > 0
THEN CHARINDEX('\',@@SERVERNAME ) -1 ELSE LEN(@@SERVERNAME) END ) <>
HOST_NAME()
BEGIN
DECLARE @cmd nvarchar(4000)
SET @cmd = N'EXEC sp_dropserver ''' + @@SERVERNAME + N''';
EXEC sp_addserver ''' + RTRIM(HOST_NAME()) + ISNULL(N'\' +
@INSTANCENAME,'') + ''', local'
-- PRINT @cmd
EXEC ( @cmd )
END

John

 >> Stay informed about: Machine Name change not being recognized by SQL 
Back to top
Login to vote
Neil W

External


Since: Feb 04, 2010
Posts: 4



(Msg. 3) Posted: Wed Feb 10, 2010 2:52 pm
Post subject: Re: Machine Name change not being recognized by SQL [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks for the suggestion, but I no longer have access to the problem
machine Sad

wrote in message

> On Thu, 4 Feb 2010 15:29:14 -0500, "Neil W" wrote:
>
>>When running this:
>> master.dbo.sp_add_log_shipping_primary_database
>>
>>I get the following error:
>>Msg 14262, Level 16, State 1, Procedure sp_add_jobserver, Line 88
>>The specified @server_name ('oldname') does not exist.
>>
>>Note that the machine name for server 'oldname' was changed to 'newname'
>>and rebooted. As expected, @@servername and serverproperty('servername')
>>return 'newname'
>>
>>However, somehow oldserver is getting added to the job and, of course, it
>>is
>>coming back as not existing.
>>
>>What has to be done to the SQL instance to get it to recognize a machine
>>name
>>change?
>>
>>I am using SQL 2005 (default instance) on Windows 2003 Server, all updates
>>applied.
>>
>>Thanks.
>>
>>
>>
> Hi
>
> I assume SELECT @@SERVERNAME returns the old name?
>
> SELECT HOST_NAME(), @@SERVERNAME
>
> Than try:
>
> DECLARE @INSTANCENAME sysname
> SET @INSTANCENAME = NULLIF(RIGHT ( @@SERVERNAME, CASE WHEN
> CHARINDEX('\',@@SERVERNAME ) > 0 THEN LEN(@@SERVERNAME) -
> CHARINDEX('\',@@SERVERNAME ) ELSE 0 END ),'')
> --SELECT @INSTANCENAME
>
> IF LEFT ( @@SERVERNAME, CASE WHEN CHARINDEX('\',@@SERVERNAME ) > 0
> THEN CHARINDEX('\',@@SERVERNAME ) -1 ELSE LEN(@@SERVERNAME) END ) <>
> HOST_NAME()
> BEGIN
> DECLARE @cmd nvarchar(4000)
> SET @cmd = N'EXEC sp_dropserver ''' + @@SERVERNAME + N''';
> EXEC sp_addserver ''' + RTRIM(HOST_NAME()) + ISNULL(N'\' +
> @INSTANCENAME,'') + ''', local'
> -- PRINT @cmd
> EXEC ( @cmd )
> END
>
> John
 >> Stay informed about: Machine Name change not being recognized by SQL 
Back to top
Login to vote
Thomas49

External


Since: Aug 14, 2004
Posts: 11



(Msg. 4) Posted: Sat Jun 19, 2010 9:20 am
Post subject: RE: Machine Name change not being recognized by SQL [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

John,

You did just became a hero (one of many though).

thanks.

"Neil W" wrote:

> When running this:
> master.dbo.sp_add_log_shipping_primary_database
>
> I get the following error:
> Msg 14262, Level 16, State 1, Procedure sp_add_jobserver, Line 88
> The specified @server_name ('oldname') does not exist.
>
> Note that the machine name for server 'oldname' was changed to 'newname'
> and rebooted. As expected, @@servername and serverproperty('servername')
> return 'newname'
>
> However, somehow oldserver is getting added to the job and, of course, it is
> coming back as not existing.
>
> What has to be done to the SQL instance to get it to recognize a machine
> name
> change?
>
> I am using SQL 2005 (default instance) on Windows 2003 Server, all updates
> applied.
>
> Thanks.
>
>
>
>
> .
>
 >> Stay informed about: Machine Name change not being recognized by SQL 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Retive username / machine name - Hi, How can i retirve information as follows : 1. User name who execute an sql statement. 2. machine name (on which machine sql statement execute). 3. is sql statement execute by directly by management studio/ qa or an application. and if an appliction,....

SP to read data from another machine - I need to create a stored procedure similar to the following: create procedure dbo.pSync ( @in_db char (20), @in_server char (50) ) AS INSERT INTO Table1 (tab_col1, tab_col2) SELECT tab_col1, tab_col2 FROM @in_server.@in_db.dbo.ARCustomer WHERE..

get IP address of user machine - How could I get IP address of user (executing query on a machine other than server). I want to create a trigger on delete of a table which will insert data to a separate table storing the IP address of user.

Specs for SQL Server client machine - Hi, I'm getting a new desktop machine at work, and I've been asked to provide the kind of specs I need. Most of my stuff is SQL Server work (mainly using remote data, but occasionally on my machine). I also do a lot of VS.NET development locally. Could...

OPENROWSET Excel import failing on production machine - Hi all. I have some sql like SELECT * FROM OPENROWSET('MSDASQL', 'Driver=Microsoft Excel Driver (*.xls);DBQ=C:\aaa.xls;', 'SELECT * FROM [Sheet1$]') Which works perfectly on our development machines (Windows 2003, SQL Server 2005 SP1). When I take it...
   Database Help (Home) -> Programming All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]