Thursday, July 12, 2012

How to move the Sharepoint Sites from Testing(Staging) Server to Production Server?

The major problem will be faced by the sharepoint developers/administrators starts when they complete the customization and move all their work to the Production Server. The approach what we take for ASP.NET applications will not work out for sharepoint sitesbecause all the page contents and configurations are stored in the database. So every developer will be thinking that there needs to be deployment project like MSI to easily deploy the sharepoint sites in the different machine other than the machine/server where we have developed. Microsoft has provided a command line tool to migrate all your works to another machine which is called as SMIGRATE.exe. This tool is available in your server (Which you have installed SPS and WSS) under the path..

Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\Bin
either in C drive are D drive (Where you have installed the SPS and WSS). You can use this tool to backup and restore. To use this tool you must be a site administrator for both the web site being backed up and restored. You can see the switches of this utility by typing smigrate -h in your command line provided the exe path is included in your path list otherwise navigate to directory where you are having the exe file and run the command.
Note: It will restore all your work which you have done using front page extension and sharepint admin pages. It will not move all you virtual server excluded path files. You should move the files manually to the destination virtual server .
Example:you have used User controls to build the webparts and images. You have to place those .ascx and image files to the excluded folder. For that you need manually create the same folder structure in the destination virtual server path and move all the files from your source virtual server to here.Important: It is not like backup and restore like database. You can not restore a site on top of the existing web site which are templates applied already. It means when ever you are creating a site or sub site in the sharepoint server it will ask to choose the template at the final stage of site creation procedure. If you want to restore a site you have stop the site creation procedure at that point and restore your site from the backup.Procedure to Backup and restore Sharepoint sites:

1. Make a note of all the excluded directories which are available in your source virtual server.
2. Navigate to
c:\program files\common files\Microsoft shared\web server extensions\60\Bin
(with assumption you have sharepoint installed on c drive) in your command prompt.
3. Run the command
smigrate -w http://Sites/ -f “d:\Backup.fwp” -u \ -pw
4. Now you can have a backup of your site at the specified location
1. Create a folder in your sharepoint server Eg: C:\Restore
2. Open your IIS and create a new web site and map it to C:\Restore
3. Open the sharepoint central administration.
4. Create a portal site by mapping the exiting virtual server created at step 2
5. Step 4 will take some time to create a portal site. After successful creation of the portal site, Open the portal site home page and select the Sites link
6. Create a new site using Create site option in the left side of the page.
7. Note down the URL of your new site. (Eg: http://Sites/8. Stop the progress and close the browser when the select template page comes.
9. Use smigrate -r -w < -f “d:\Backup.fwp” -u \ -pw
10. Copy your source web.config from your source virtual server and replace the web.config in your destination virtual server path (This is needed if you have done any change on the source web.config)
11. Copy all your excluded folders from your source virtual server to destination.
12. Browse the center Administration->Sharepoint Portal server->Configure virtual server settings from the Virtual Server List page->(Select the Virtual server)->Define managed paths to exclude the directories.Now you have a new site with the replica of the existing one.
At this stage you will have question in your mind what is the procedure if any page are list has been created after deployed into production. All pages you can copy and paste it in the destination server using MS FrontPage 2003.

No comments:

Post a Comment