Friday, 30 September 2011

Sharepoint 2010 - Change Domain Membership

Hello,

Couple of days ago I had to change domain membership of a single server Sharepoint 2010 farm with separate database server. Browsing the Internet I found little data about this and most recommendations were based on backup/reinstall/restore procedure.

However, I thought I would give it a try with plain domain membership change and with switching Sharepoint 2010 service accounts. I encountered many problems and I will mentioned some of them here. Here's the procedure:

  • Perform full backup of Sharepoint 2010 farm from Sharepoint Central Administration
  • Create new service accounts in the destination domain
  • Make sure you know your Sharepoint 2010 farm passphrase which you entered when you initially provisioned the farm
  • Change the domain membership of  SQL database server first (in my case the SQL database was running under LocalSystem account so I had no issues with that)
  • Give the future farm account from the new domain sysadmin permissions to the SQL database engine (actually only security admin and dbcreator permissions are necessary)
  • At this point your Sharepoint is not working
  • Run stsadm -o setconfig db with the -connect switch to connect to your Sharepoint configuration database. You will have to use your new domain farm credentials here.
  • After this step, the Central Administration site should be working, however, your Sharepoint box is still in the old domain. In my case I had the domain trust established between the old and new domains.
  • Create the new Sharepoint managed accounts by selecting the accounts from the new domain: Central Administration > Security > General Security > Configure Managed Accounts
  • Change the service accounts to reflect the newly added managed accounts: Central Administration > Security > Change Service Accounts
  • Add your farm account to the local administrators group on the Sharepoint server
  • Change Sharepoint box domain membership
  • At this point, your Sharepoint sites should be accessible. However, in my case they were not working and I received 404 not found message. I realized that after I reconnected the Sharepoint farm to the configuration database, custom solutions that these sites were using were not available any more. Thankfully, I had a full farm backup and managed to restore only the farm solutions. I redeployed the solutions from the Central Administration and the sites worked!
  • At one point, after a couple of iisresets and server restarts I received "The trial period has expired" error message when I opened the Sharepoint sites. Running Sharepoint Configuration Wizard again solved this issue.
  • Looking at the "Central Administration > Manage services on service" I saw only a couple of services listed while I know there should be more. Running Install-SPService from Powershell re-registered these services. This is important step for Sharepoint Service Applications to work properly.
  • Almost all Service Applications were started and I could access the management pages for them except the two most important ones, User Profile Synchronization service and Search service. No matter what I did I could not fix them or even restore them. I ended up creating and provisioning the new services from powershell. There aren't any user generated data in these services so recreating them was not a big issue.
 Here are a few links that helped me solve problems with provisioning new service applications:

This one helped me to solve Sharepoint Server Search instance reporting "Service is offline" when trying to start/provision.
http://msdnrss.thecoderblogs.com/2011/06/unable-to-create-a-search-service-application-errors-were-encountered-during-the-configuration-of-the-search-application/

This is actually about multitenancy, but has some excellent code snippets that helped me provision User Profile Synchronization and Search service.
http://www.harbar.net/articles/sp2010mt5.aspx

I trully hope that these steps will help someone avoid the pain I suffered :)

Regards,
Dinko

Tuesday, 6 September 2011

Sharepoint 2003 to 2007 upgrade with stsadm -o attachdb fails with error - Full-text crawl manager has not been initialized

Hi,

Recently I was engaged by my colleague to assist him in upgrading an aging Sharepoint 2003 installation to Sharepoint 2010. Since the full blown Sharepoint Portal Server 2003 was still in use there was no direct upgrade path, but I had to deploy temporary MOSS 2007 farm first to upgrade database from Sharepoint 2003 to 2007 version. After this step I could upgrade to Sharepoint 2010.

I've run the pre-scan tool on Sharepoint 2003 which did gave me some trouble saying that the site I was trying to scan is not extended with WSS v2 and that I should extend it first. I've fixed this problem with running a stsadm -o upgrade which, I guess, wrote a new database version in the portal content database because the process took only a couple of second. After that the pre-scan run without any errors.

Now, onto the problem...

I've created a new web application on MOSS 2007 and used the following command on the MOSS 2007 box:

stadm -o attachdb -url http://sps -databasename SPSERVER_SITE -databaseserver -SQLSERVER

This returned an error and the database was not attached to the web application.

Upgrade completed with errors.  Review the upgrade.log file located in C:\Progra
m Files\Common Files\Microsoft Shared\Web Server Extensions\12\Logs\Upgrade.log.
  The number of errors and warnings is listed at the end of the upgrade log file
.

After examining the log files I've found this:

[DropFullTextSearch] [3.0.2.0] [DEBUG] [9/6/2011 8:23:35 PM]: Begin Rollback()
[DropFullTextSearch] [3.0.2.0] [DEBUG] [9/6/2011 8:23:35 PM]: End Rollback()
[DropFullTextSearch] [3.0.2.0] [DEBUG] [9/6/2011 8:23:35 PM]: Begin Dispose()
[DropFullTextSearch] [3.0.2.0] [DEBUG] [9/6/2011 8:23:35 PM]: End Dispose()
[DropFullTextSearch] [3.0.2.0] [DEBUG] [9/6/2011 8:23:35 PM]: Elapsed time: 00:00:00.1405800.
[SPManager] [ERROR] [9/6/2011 8:23:35 PM]: Upgrade [SPContentDatabase Name=SPSERVER_SITE2007 Parent=SPDatabaseServiceInstance] failed.
[SPManager] [ERROR] [9/6/2011 8:23:35 PM]: Full-text crawl manager has not been initialized. Any crawl started before the crawl manager was fully initialized will need to be restarted. Please restart SQL Server and retry the command. You should also check the error log to fix any failures that might have caused the crawl manager to fail.
[SPManager] [ERROR] [9/6/2011 8:23:35 PM]:    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Microsoft.SharePoint.Utilities.SqlSession.ExecuteNonQuery(SqlCommand command)
   at Microsoft.SharePoint.Upgrade.SPDatabaseSequence.ExecuteDataDefinitionMethodCore(SqlSession sqlSession, ISqlSession isqlSession, String sqlscript, SPSqlCommandFactory sqlcmdFactory, String[] strTables, Int32[] nThroughputs, SPLog logGlobal)
   at Microsoft.SharePoint.Upgrade.SPDatabaseWssAction.ExecuteDataDefinitionMethod(SqlSession sqlSession, String sqlscript)
   at Microsoft.SharePoint.Upgrade.DropFullTextSearch.Upgrade()
   at Microsoft.SharePoint.Upgrade.SPActionSequence.Upgrade()

 
It then occurred to me that back in the old days Sharepoint was using SQL full text search catalogs for its search feature, but just for WSS v2 search feature if memory serves me correctly.
When I installed the new SQL 2008 R2 I did not check the Full-Text Search component because the MOSS 2007 and Sharepoint 2010 are not using SQL Full-Text Search anymore. But it seems that for upgrade purposes the Full-Text Search component is required because the upgrade process tried to drop the existing full text catalog.

At this moment I've also reviewed the logs when I restored the Sharepoint 2003 database from SQL 2000 to SQL 2008 R2 and found this:


Log Name:      Application
Source:        MSSQLSERVER
Date:          6.9.2011. 20:15:13
Event ID:      3633
Task Category: Server
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      SQL2000.domain.local
Description:
The operating system returned the error '3(failed to retrieve text for this error. Reason: 15100)' while attempting 'ClearTree' on 'FullTextDefaultPath\ix_SPSERVER_SITE' at 'fulltext.cpp'(1816).


The solution was to simply install the Full-Text Search component on the new SQL Server 2008 R2 and run the database attach process again.