Sunday 20 May 2012

How to change SQL Server Name or Instance Name

applies to all SQL ver including Denali.
i. Open SQL Server Management Studio and click New Query.
ii. Type Select @@ServerName to verify that the server name. In this example, Windows 2003 from WIN2K3R2EE to SQL Server is used. If windows hostname is changed doesn't mean that SQL Server 2005 name will be automatically changed. It will still return the old name. Let's fix it.
3. Next, type sp_dropserver 'WIN2K3R2EE'
4. You are now ready to add the correct name by typing sp_addserver 'SQLSERVER'. local
at this point if you need to change instance name, execute the below query:
sp_dropserver 'Server Name\old_Instance_name'
go 
sp_addserver 'ServerName\New Instance Name','local'
go


5. Restart sql server and the sql server agent by opening a command prompt and typing net stop mssqlserver and net start msssqlserver. To stop and start the sql server agent, type net stop or start sqlserveragent.
6. Click New Query in SQL Server Management Studio and type select @@servername to verify everything is correct and you have successfully changed the sql server name.

0 comments: