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: http://blogs.msdn.com/johnlee/archive/2008/03/09/move-wss3-0-moss2007-databases-to-different-server.aspx; 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:
- stsadm connects to the config database as specified in the registry (see the referenced msdn post)
- stsadm checks for references to the old server in TimerLocks, then enumerates all content DBs using the hierarchy defined in the Objects table
- 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)
- Modify the Objects table before running stsadm, this way the SQL alias should not be necessary
- 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.
This posting is provided "AS IS" with no warranties, and confers no rights.