rename - Update sys.servers after renaming SQL Server Host -


i'm upgrade sql server 2012 instance sql server 2014.

i've cloned host windows vm , renamed foo-2012 foo-2014. on restart, sql server instance noticed updated own name, can log foo-2014. good.

unfortunately (single) entry in sys.servers still foo-2012 means running

select *  [foo-2012].[bardb].[dbo].tfoobartable 

fails with:

could not find server 'rw-db-2014' in sys.servers. verify correct server name specified. if necessary, execute stored procedure sp_addlinkedserver add server sys.servers.

fine.

i run exec sp_addlinkedserver 'foo-2014', 'sql server' , entry.

but new entry has islinked=1 (whereas existing entry has islinked=0).

documentation indicates setting important (especially app has strong opinions on distr.trans. :( )

i can't edit/add to/modify sys.servers directly. attempt gives:

ad hoc updates system catalogs not allowed.

i remove new entry (exec sp_dropserver 'foo-2014') succeeds, , try using exec sp_addserver 'foo-2014', 'local' reports

the server 'foo-2014' exists

immediately re-running drop reports

the server 'rw-db-2014' not exist. use sp_helpserver show available servers.

how fix this?

you need first remove old server foo-2012 have no rows in sys.servers, , add 'local':

exec sp_dropserver 'foo-2012'; go exec sp_addserver 'foo-2014', 'local';  go 

then need restart mssqlserver service in order change take effect, per documentation sp_addserver :

the local definition takes effect after database engine restarted.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -