[SQL Server] 如何為Instance重新命名

當Server Sysprep 完 OOBE (Out-of-Box Experience)後, GUID 通常都會重新分派, 但如果之前安裝了SQL server 的話, Instance 名因為儲了在master DB 內, 故有機會與Seed image 同名.

要檢查的話, 可以執行以下SQL statement 去查看現在的Instance 名稱.

SELECT @@SERVERNAME AS 'Server Name';

若要修改的話, 則要執行以下SQL script.

sp_dropserver '<<Old Server Name>>';
GO
sp_addserver '<<New Server Name>>', local;
GO

Restart SQL server 後, 再執行上便的Select statement 確定結果.

Reference

boltblog, https://blog.dhampir.no/content/renaming-an-mssql-instance-invalid-urn-filter-on-server-level

About C.H. Ling 262 Articles
a .net / Java developer from Hong Kong and currently located in United Kingdom. Thanks for Google because it solve many technical problems so I build this blog as return. Besides coding and trying advance technology, hiking and traveling is other favorite to me, so I will write down something what I see and what I feel during it. Happy reading!!!

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.