Monday, May 9, 2011

Moving Content Database from One Site to Other Site / One Env to Other Environment


In our source server, let us do the following steps: 


1. In the Command Prompt, let us change to the directory where the STSADM command-line tool is located. By default, it is on C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN. 


2. The next step is to prepare our content database before moving it by setting up the profile and membership synchronization service. It prevents the synchronization service from failing and losing related settings. To do this, let us type the following command, and then press Enter: 


STSADM –o preparetomove –contentdb <content database name>

stsadm -o preparetomove -ContentDB Usildb218-qa:WSS_Content_sales_Prod


3. Now, let us detach our content database by executing the command below. We have to take note, however, that removing the content database simply removes the association of the database with our SharePoint Web application and does not exactly delete the database. 


STSADM -o deletecontentdb –url <URL name> -databasename <database name> -databaseserver <database server name> 


stsadm -o deletecontentdb -url "https://kmqa.ca.com/sales" -databasename WSS_Content_sales_Prod -databaseserver usildb218-qa


4. Let us open our Microsoft SQL Server 2008 Management Studio, and detach the content database. Finally, we will copy the corresponding .mdf and .ldf files to our destination server. 


In our destination server, let us do the following steps: 


NOTE: It is assumed that you have created a corresponding Web site in you destination server and deleted its content database – like what we have did in steps 2 and 3. With this, we are now ready to restore/move the content database of our source server to the destination server. Thanks Amlan for the comment. 


5. Let us open our Microsoft SQL Server 2008 Management Studio, and attach the content database that we transferred in the previous step. 


6. In the Command Prompt, let us change to the directory where the STSADM command-line tool is located. By default, it is on C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN. 


7. Now, to add the content database to our destination server, let us type the following command, and then press Enter: 


STSADM –o addcontentdb –url <URL name> -databasename <database name> -databaseserver <database server name> 






stsadm -o addcontentdb -url "http://kmdev.ca.com/sales" -databasename "WSS_Content_sales_Prod" -databaseserver "usildb218-qa"


8. And finally let us start a full crawl. We must be aware, moreover, that a full crawl will occur the first time even if the next crawling scheduled is set to incremental mode in the content database we have restored.




No comments:

Post a Comment