Moving MOSS 2007 DBs to another SQL Server instance

A colleague of mine asked for help in moving a set of MOSS databases from one SQL server to another. This is not an uncommon scenario, for example it’s used in the Microsoft proposed site recovery scenario (with a mirrored SQL Server). He followed the step by step guide defined in this blog post:; but the stsadm –o renameserver command always terminated with an impossible to connect to sql server error (error 26).

The only difference I could find between the Microsoft scenario and ours is the fact that the MOSS databases are hosted by a SQL Named Instance (vs the default instance). Trying the stsadm command with the full SQL server name (SQLServer\InstanceName) would return the same error. Interesting case indeed.

After some analysis, network and SQL tracing this is what I understood:

  1. stsadm connects to the config database as specified in the registry (see the referenced msdn post)
  2. stsadm checks for references to the old server in TimerLocks, then enumerates all content DBs using the hierarchy defined in the Objects table
  3. alas in the Objects table there’s still the old instance name so the SQL connection won’t work, hence error 26

To make it works:

  • Follow the msdn post until it mandates to run stsadm
  • create a SQL alias with the old sqlserver name\instance so that it points to the new sql server (I actually created an alias also for oldservername –> newservername\instance name, I don’t think it’s useful, but I didn’t have the time to drill through further, so just in case…)
  • run stsadm (now it completes successfully)
  • manually adjust the instance name in the Objects Table (see query below)
  • remove the SQL alias

The query used to manually modify the Objects table in the config database is:

declare @ID uniqueidentifier

select @ID=O1.ID from objects O

inner join Objects O1 on O1.ParentId=O.Id


update Objects set Name=’NEWINSTANCENAME’

where Id= @ID

I think there are a couple of alternatives (I didn’t try them so I cannot say for sure)

  1. Modify the Objects table before running stsadm, this way the SQL alias should not be necessary
  2. Set the SQL Alias to Newservername\oldinstancename (I think stsadm tries to connect to this hybrid string before trying other alternatives)

Obviously this is not supported and maybe opening a case with PSS will result in a different solution.

– Daniele

This posting is provided "AS IS" with no warranties, and confers no rights.

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: