Friday, January 9, 2009

Moving My Sites to a separate content database and web application

So, you have performed an in-place or gradual upgrade to MOSS 2007 and your My Sites exist on the same content database and web application as your main portal. See below for the steps to move your My Sites to a separate content database and web application.

These same steps also apply to those who simply have a need to move My Sites to a separate content database and web application.

NOTE: Service Pack 1 for MOSS 2007 must be installed before performing the following steps.

1. Create a new web application using either the Central Administration GUI or the STSADM command line tool. I recommend using the same easily identifiable name for the IIS Website and Application Pool, such as SharePoint - MySites. The associated content database will be removed in Step 4 below, so you can give it a name of WSS_Content_MySites.

2. Define managed paths for the web application created in Step 1. You only need two new paths -- an Explicit inclusion for mysite and a Wildcard inclusion for personal.

3. Create a new site collection on the web application created in Step 1. Give it an appropriate title, such as My Site Host. Be sure to use the /mysite path and choose the My Site Host template located under the Enterprise tab. After the site collection is created, click to visit the new My Site Host and click the button marked Set as My Site Host.

4. Remove the content database that was created for the web application created in Step 1. To do this, while in the Central Administration GUI, go to Application Management and click Content databases. Click the web application dropdown to select the web application created in Step 1. Click on the database that is listed (WSS_Content_MySites), place a check in the box next to Remove content database, and click OK.

5. Add a new content database to the main portal web application. In Application Management, click Content databases. Click the web application dropdown to select the main portal web application, then click Add a content database. This new database will be your My Sites database, so give it a more descriptive Database Name, such as MySites_Content. Click OK to add the new database.

6. At a command prompt, enumerate out all My Sites to an XML file by running the following command:

stsadm -o enumsites -url http://yourmainportal/personal > C:\MySites.xml

Wait for the command to finish, and do not close the command prompt.

Open the MySites.xml file with notepad and remove any site that is not a personal site, including the /mysite entry. Do not worry about the "Sites count" as the STSADM tool only sees the url paths. Save and close the MySites.xml file.

7. At the same command prompt, move the personal sites located in the MySites.xml file to the new Content Database by running the following command:

stsadm -o mergecontentdbs -url http://yourmainportal -sourcedatabasename mainportaldatabasename -destinationdatabasename databasefromStep5 -filename C:\MySites.xml -operation 3

Wait for the command to finish, and do not close the command prompt.

8. At the same command prompt, restart IIS by running the following command:

iis restart

Wait for the command to finish, and do not close the command prompt.

9. At the same command prompt, prepare to move the content database created in Step 5 by running the following command:

stsadm -o preparetomove -ContentDB DatabaseServer:DatabaseFromStep5

Wait for the command to finish, and do not close the command prompt.

10. Remove the content database created in Step 5 from the main portal web application by following the same sequence in Step 4.

11. At the same command prompt, add the content database created in Step 5 to the new My Site web application created in Step 1 by running the following command:

stsadm -o addcontentdb -url newmysiteurl -databasename databasefromStep5

Wait for the command to finish and close the command prompt (finally).

12. Confirm that the content database created in Step 5 is now associated with the new My Site web application created in Step 1.

2 comments:

  1. Wow! good one to refer...

    Chinna

    ReplyDelete
  2. Thanks for sharing this information. I really like your blog post very much. You have really shared a informative and interesting blog post with people..
    cheaterland removal

    ReplyDelete