Repair SharePoint Foundation 2010 after moving the databases
Published: March 10, 2011
Applies To: Windows Small Business Server 2011 Standard
Problem You successfully moved the SharePoint Foundation 2010 databases, but now the internal website is not responding, or you are experiencing other issues, such as problems with the router configuration or with Internet Information Services (IIS).
Solution Manually move the SharePoint Foundation 2010 databases.
To manually move the Windows SharePoint Services databases
Connect to Microsoft SQL Server:
Click Start, click All Programs, then click Microsoft SQL Server 2008 R2.
Right-click SQL Server Management Studio, and then click Run as administrator.
On the User Account Control page, click Continue.
In the Connect to Server dialog box, do the following:
In Server type, click Database Engine.
In Server name, type np:\\.\pipe\MSSQL$Microsoft##SSEE\sql\query.
In Authentication, click Windows Authentication.
Click Connect.
In Microsoft SQL Server Management Studio Express, browse to <root>\Databases, and then expand it. The following databases are listed:
ShareWebDb Database for the internal website.
SharePoint_AdminContent_{GUID}, SharePoint_Config_{GUID}, WSS_Content, and WSS_Search_Win**** Databases that the SharePoint Foundation 2010 engine uses.
System Databases and SUSDB Databases that should not be changed.
If there are any additional databases, they are also listed.
You need to move all databases except the System Databases and SUSDB.
Locate the database files:
The default location of the files is C:\Windows\SYSMSI\SSEE\MSSQL.2005\MSSQL\DATA\. In that folder, there should be a file named <name>.mdf and a file named <name>_log.ldf, where <name> is the name of the target database.
If the files are not in the default location, in the Microsoft SQL Server Management Studio Express window, click New Query, type
Select filename from sysdatabases where name = ‘<database name>’
, where <database name> is the name of the database listed in Step 2, and then click Execute. The location of the database file is displayed.
Verify that there is enough space on the target drive, and then complete Steps 5-8 for each database listed in Step 2 (except System Databases and SUSDB, which should not be moved).
If the database is for the SharePoint Foundation 2010 engine, skip this step. If the database is for the internal website or for another site that was created after Setup, set the database to Read Only:
Click Start, click Administrative Tools, and then click SharePoint 3.0 Central Administration.
On the User Account Control page, click Continue.
Click Application Management, click SharePoint Site Management, click Site collection quotas and locks.
In Site Collection, click the site that you want to lock.
In Site Lock Information, click Read-only (blocks additions, updated, and deletions), and then in Additional lock information, type a reason for locking the site.
Click OK.
Move the database:
Note
If any of these steps fail, roll back to the previous setting by following the instructions in Step 7.
1. Run the following SQL command to set the database offline: `alter database [db1] set OFFLINE with ROLLBACK IMMEDIATE`, where *db1* is the name of the database that you are moving. You must include the brackets.
2. Run the following SQL command to detach the database: `sp_detach_db [db1]`, where *db1* is the name of the database that you are moving. You must include the brackets.
3. Copy the physical database files (MDF and LDF) to the destination location in Windows Explorer.
4. Run the following SQL command to attach the new database: `sp_attach_db @dbname = N‘db1’, @filename1=’Datafile_Path’, @filename2=’Logfile_Path’`, where:
1. *db1* is the name of the database that you are moving
2. *Datafile\_Path* is the path to the MDF file
3. *Logfile\_Path* is the path to the LDF log file
You must enclose the parameters in single quote marks.
5. Run the following SQL command to bring the new database online: `alter database [db1] set ONLINE`, where *db1* is the name of the database that you are moving. You must include the brackets.
6. If Steps 6a-6e are successful, delete the original database files.
If Step 6 is not successful, do the following:
If Step 6a fails, ignore it and proceed to Step 8.
If Step 6b fails, complete Step 6e to roll back to the original state.
If Step 6c or Step 6d fails, run the following SQL command to roll back:
sp_attach_db @dbname = N‘db1’, @filename1=’Original_Datafile_Path’, @filename2=’Original_Logfile_Path’
, where:- db1 is the name of the database you are moving, Original Datafile Path is the path to the MDF file, and Original Logfile Path is the path to the LDF log file
You must enclose the parameters in single quote marks. After the command has been performed, complete Step 6e.
If Step 6e fails, complete Step 6b, and then complete Step 7c.
Unlock the database for the internal website:
Click Start, click Administrative Tools, and then click SharePoint 3.0 Central Admininstration.
On the User Account Control page, click Continue.
In SharePoint Site Management, click Site collection quotas and locks.
In Site Collection, select the site that you want to unlock.
In Site Lock Information, click Not locked.
Click OK.