jump to navigation

How to move sharepoint sites from testing environment to production environment? February 13, 2007

Posted by rehmangul in MOSS, MS SharePoint Sever.
Tags: , , , , , , , ,
trackback

Update (19/04/2009):
Use backup and restore! Click here to view the post how to backup and restore your site from testing to production.

—————–
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 environment. The approach what we take for ASP.NET applications will not work out for sharepoint sites because 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 Eg: 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:

Backup:
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

Restore:
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

Comments»

1. Kevin - April 2, 2008

Does this relate to Sharepoint Server 2007?

Or is this for sharepoint 2003?

2. laura - April 22, 2008

Does it matter if the virtual server is running on windows server 2003 x32, and the physical server, to which we are migrating to, is running on windows server 2003 x64?

3. Mike - June 3, 2008

how does it differ from using stsadm command line tool? I keep getting this error when trying to restore from virtual test lab server to production and it seems that orphaned items is the cause:

Exception from HRESULT: 0×80040E2F

4. Omar Ghazal - May 24, 2009

what about the automatic update of the standby server? Can i use batch files to backup production server and restore the backup files in the standby servers?

5. courtney - November 5, 2009

this seems to apply to SP 2003. If I replace smigrate with stsadm, will it work the same?