Tuesday, November 2, 2010

Move all SharePoint databases to another SQL server

How to move all SharePoint databases to another SQL server? Following Move all databases (by Microsoft) doesn't work for me.  After detaching and then attaching all databases to the new SQL server, and setting up SQL Server connection aliases, the error below popped up when trying to access Central Administration site.

Server Error in '/' Application.
Cannot connect to the configuration database. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: Microsoft.SharePoint.WebPartPages.WebPartPageUserException: Cannot connect to the configuration database.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 

[WebPartPageUserException: Cannot connect to the configuration database.]
   Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.EnsureInitialize(HttpRequest request) +740
   Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.BeginRequestHandler(Object oSender, EventArgs ea) +164
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171

The test of the database connection through ODBC data source was correct.  So obviously SharePoint site doesn't connect to database through ODBC.  Since I don't want to spend too much time on the trouble shooting, I added the old SQL server name and new SQL server IP to the local hosts file on the SharePoint server.   It works.

This is not the best solution, but should be good enough in most of the cases.   Just keep in mind that the old SQL instance and the new one need identical name.

No comments:

Post a Comment