How to Rename a SQL Server 2008 Named Instance Without Reinstallation


1 views

Renaming a SQL Server 2008 named instance isn't as straightforward as renaming a default instance. The instance name is deeply embedded in the SQL Server configuration, Windows registry, and various metadata tables. When you need to change from something like "MySQLServer\MSSQL2008" to "MySQLServer\SQL2008", you'll need to follow a precise procedure.

Before attempting any changes:


-- Verify current instance name
SELECT @@SERVERNAME AS 'Current Server Name';
-- Check all configured instances
EXEC xp_regread 
    'HKEY_LOCAL_MACHINE', 
    'SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL';

1. Update the Windows Registry

Locate the following registry key (backup first!):

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.MSSQL2008

Rename the key to reflect the new instance name (MSSQL10.SQL2008).

2. Modify Instance Names Key

Navigate to:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL

Change the value data for your instance from "MSSQL2008" to "SQL2008".

3. Update Service Names


-- For SQL Server service
sc config "MSSQL$MSSQL2008" start= disabled
sc delete "MSSQL$MSSQL2008"
-- For SQL Server Agent
sc config "SQLAgent$MSSQL2008" start= disabled
sc delete "SQLAgent$MSSQL2008"

Updating Linked Servers

After renaming, check all linked servers:


SELECT * FROM sys.servers;
-- Update any references
EXEC sp_dropserver 'old_server\instance';
EXEC sp_addserver 'new_server\instance', 'local';

Verifying the Change

Run these checks post-rename:


-- Should show new name
SELECT @@SERVERNAME;
-- Should reflect new instance name
SELECT SERVERPROPERTY('ServerName');
  • Applications with hardcoded connection strings may break
  • Reporting Services configuration needs separate updating
  • Maintenance plans and jobs may need reconfiguration

For simpler scenarios, this T-SQL approach might work:


USE master;
GO
-- Remove the old name
EXEC sp_dropserver 'MySQLServer\MSSQL2008';
GO
-- Add the new name
EXEC sp_addserver 'MySQLServer\SQL2008', 'local';
GO

While this process works for SQL Server 2008, newer versions have more robust renaming capabilities. Always:

  1. Backup all databases first
  2. Document all configuration settings
  3. Test in non-production first
  4. Plan for downtime during the change

Renaming a SQL Server 2008 instance isn't as straightforward as renaming a database or table. The instance name is deeply embedded in the SQL Server configuration, registry, and system metadata. Many administrators assume reinstalling is the only option, but there's a better way.

Before proceeding:

  • Backup all databases and critical configurations
  • Ensure you have sysadmin privileges
  • Schedule downtime as this requires service restarts
  • Verify no applications are using the current instance name

Here's the step-by-step method to rename your SQL Server 2008 instance from "MySQLServer\MSSQL2008" to "MySQLServer\SQL2008":

-- Step 1: Verify current instance name
SELECT @@SERVERNAME AS 'Current Instance Name';

-- Step 2: Drop the old server name
EXEC sp_dropserver 'MySQLServer\MSSQL2008';

-- Step 3: Add the new server name
EXEC sp_addserver 'MySQLServer\SQL2008', 'local';

After executing these commands, you'll need to:

  1. Restart the SQL Server service
  2. Update any linked servers that reference the old name
  3. Modify connection strings in applications
  4. Update maintenance plans and jobs

If you encounter error 15028 ("The server name is not valid"), try:

-- Reset the server name to default
EXEC sp_dropserver @@SERVERNAME;
EXEC sp_addserver 'NewServerName', 'local';

Confirm the rename was successful with:

SELECT @@SERVERNAME AS 'New Instance Name';
SELECT SERVERPROPERTY('ServerName') AS 'Server Property Name';

Remember that:

  • Reporting Services configuration needs separate updates
  • Cluster configurations require additional steps
  • Some third-party tools may cache the old instance name