Home > Blogroll, development, error, MOSS, MS SharePoint Sever, sharepoint, sps, Uncategorized > SharePoint Site Backup and Restore

SharePoint Site Backup and Restore

If  you are moving your site from testing to production, site backup and restore (using STSADM command line tool)  is the way to go. Other ways include SQL Server, Sharepoint Designer, DPM etc. However, site backup and restore using STSADM is probably the easiest and fastest one.

Backup the site using the following STSADM Command:
Stsadm –o backup –url http://<server name>:<port> -filename <path\name to be used for the backup file>

Example:
Stsadm –o backup –url http://vanillargk:5555 –filename "e:\backup5555.bak"

After the backup has been completed, “Operation Completed Successfully” message should be displayed.
 
Create a new Web Application for restoring the site:
Go to Central Administration -> Application Management -> under SharePoint Web Application Management -> click Create or Extend Web Application. Fill in the required information, click Ok and wait until the progress continues.

Once the new web application is created, run the following STSADM command and restore the site using the backup file created above.

Stsadm –o restore –url http://<server>:<port> -filename <path\name of the backup file>
Stsadm –o restore –url http://vanillargk:6666  –filename "e:\backup5555.bak"

Restored site should be up and running.
 
If it is not (and you are receiving weird errors in your browser), keep reading:

Now it could be the case that you have customized your site. So, we must deploy those customizations properly for the site to work as expected. This is typically a scenario while moving your site from Testing to Production environment. First you have to add the solutions (if any created) to the farm.

Add a Solution to the SharePoint Farm:
Add the solution package to the farm by running the following commands. Make sure full path of WSP file is supplied.
 
stsadm –o addsolution –filename <path to mysolution.internet.test.wsp>

Deploy the Solution to the restored site:
Now we need to deploy the newly added solution to our restored site. Click the solution name and select ‘Deploy’ button from top. Select the appropriate web application in the deployment settings and click OK. This will take several minutes to deploy mysolution.internet.test.wsp resources (list templates, features, assemblies, master pages, styles). Once the solution has been deployed, reset IIS to ensure all deployed changes are picked up by the web application.

You can also deploy the solution from the command line with the following SharePoint admin command.

stsadm -o deploysolution -name mysolution.internet.test.wsp -url <site> -immediate -allowgacdeployment –allowcaspolicies

Make sure all your assemblies (DLLs) are available in Global Assembly Cache (GAC) usually placed at c:\windows\assembly.  

 Activate features installed by mysolution.internet.test.wsp solution package:
Go to the newly restored site, click Site Actions, click Site Settings, click Site Collection Features. Click Activate button to activate any Site Collection Feature.

Go to the newly restored site, click Site Actions, Site Settings, Site Features.
Click Activate button to activate any Site Features.

Update Web.Config file:
It will be usually a case that your solution package will deploy a few DLLs with it. So we need to add all those Safe Control entries, Assembly Bindings, Keys and any other web.config changes to our newly restored sites’s web.config. Weird browser errors that I mentioned above usually appear due to these missing entries in web.config, specially when you are restoring on the same machine/server…….As assemblies will already be there in the GAC if the restore operation was performed on the same machine….you just need to make web.config entries to the restored site…..adding and deploying of the solution could be skipped. So lets do the copy paste operation from the old web.config to the new web.config. Just compare the two web configs and copy/paste the missing entries into the new. 

Web.config file could be found at the following path:
<drive letter>:\Inetpub\wwwroot\wss\VirtualDirectories\<port number>\web.config
 

Example:
C:\Inetpub\wwwroot\wss\VirtualDirectories\6666\web.config 
 

Usually these changes will include Safe Controls, AssemblyBindings, PageParserPaths and Keys etc. After making these changes your site should be ready in Production.

If you are worried about the bad habit of Moss saving absolute URLs for the page layout in the properties of a publishing page, then relax, solution is already in the market:

http://blogs.technet.com/stefan_gossner/archive/2009/05/01/red-is-green-up-is-down-and-the-unsupported-suddenly-becomes-supported.aspx

Hope this helps…

P.S. If you need to know more, important information in the comments below.

Advertisements
  1. Sig Weber
    April 27, 2009 at 2:31 pm

    FYIO: Microsoft strongly recommends not to use STSADM backup/restore between different farms. I believe there’s even a MSKB about it…

    In our environment the development, staging and production SharePoint infrastructure are all different farms, hence we stay away from STSADM backup/restore.

    In fact, we’re not doing this because Microsoft recommends it, but rather because we had already some trouble where the navigation of a sitecollection moved with STSADM backup/restore got corrupted and we could no longer add new navigation nodes manually.

    It turned out to be a missing entry in a particular SQL table, once added all went well. But this is very unsupported by Microsoft.

    Just my $0.2 US 😉

  2. April 28, 2009 at 1:52 pm

    Okey, you actually raised a very good point.

    So, you are refering to the following Microsoft article that says that moving a farm using STSADM is obsolete:

    http://technet.microsoft.com/en-us/library/cc263236.aspx

    and from here they will point you to “Moving to Another Farm” using SQL Server Tools:

    http://technet.microsoft.com/en-us/library/cc261918.aspx

    Before I say why I was able to use STSADM, I will take this opportunity to share some important info:

    You can use STSADM command to backup and restore on the same farm:

    http://technet.microsoft.com/en-us/library/cc261704.aspx

    and you should not use STSADM command to restore to another farm, that’s right.

    To restore to another farm, you must use SQL Server tools:

    http://technet.microsoft.com/en-us/library/cc261918.aspx

    and here is the important information: the specs of the farm on which you are restoring should still be exactly the same as the one from which backup is taken from. Specs means server names, software updates, number of servers…

    Now if you are restoring to another farm which has different specs, then it will not be called as MOVING to another farm, it will be either MIGRATING or UPGRADING to anohter farm…..good news is that its still doable:

    http://technet.microsoft.com/en-us/library/cc262370.aspx

    So, what have I done above in the post?
    I haven’t actually moved the farm at all. I have simply moved a Site Collection from one farm to another.

    So, the trick here is that moving farms is complicated……largely due to config and central admin databases because they contain computer specific information (in short)…….so why dont we simply move our site collection and probably relax 🙂 :

    http://technet.microsoft.com/en-us/library/cc706871.aspx

    You can also move individual content databases using STSADM:

    http://technet.microsoft.com/en-us/library/cc262792.aspx

    Site Collection backup/restore that we did above will actually backup and restore the content DB.

    Rehman

  3. blueflake
    August 24, 2009 at 2:47 pm

    I’m getting confused by all the options and different opinions in blogs. I’m going to move one or more site collections from one farm to a completely different one (new server names but same domain).

    If I understand the link below correctly, Stefan Gossner basically says that in that kind of scenario the “Best is to use SQL backup/restore.”

    If it’s a publishing site, one only needs to be sure to have SP2 and the April CU installed (so that links to pagelayouts are fixed), and then there are no problems using SQL backup/restore.

    http://blogs.technet.com/stefan_gossner/archive/2009/05/01/red-is-green-up-is-down-and-the-unsupported-suddenly-becomes-supported.aspx#3257724

  4. Faisal
    September 7, 2009 at 4:31 pm

    I want to transfer one site from sharepoint 2003 to MOSS. The servers have got different settings. I have tried to backup/restore technique but it seems not working because it shows me a message “Your backup is from a different version of Windows SharePoint Services and cannot be restored to a server running the current version. The backup file should be restored to a server with version ‘6.0.2.8165’ or later.”

    Please suggest me what to do. Do I need to use stsadm -addcontentdb command to upgrdae complete SP2003 box.

    Many Thanks

  5. Lee A. goergen
    November 9, 2009 at 9:16 pm

    I am moving (migrating) a farm from 32 bit sharepoint to 64 bit sharepoint. Can I prepare the new farm and use restore with the -restoremethod new option. It seems to prompt for all the new http nodes and database names.

  6. bill Programer
    January 13, 2010 at 4:03 pm

    hi to all.
    i want to restore a backup over sharepoint site , but it seems not working because it shows this messages :

    ————————————————————————–
    [1/11/2010 11:15:08 AM]: Error: Object SharePoint – 80 failed in event OnRestore. For more information, see the error log located in the backup directory.
    ArgumentException: The IIS Web Site you have selected is in use by SharePoint. You must select another port or hostname.
    [1/11/2010 11:15:08 AM]: Debug: at Microsoft.SharePoint.Administration.SPWebApplication.CreateIisSettingsObject(String iisServerComment, Boolean secureSocketsLayer, String iisHostHeader, Int32 iisPort, Boolean iisAllowAnonymous, Boolean iisEnsureNTLM, DirectoryInfo iisRootDirectory, SPFarm farm)
    at Microsoft.SharePoint.Administration.SPWebApplication.CreateDefaultInstance(SPWebService service, Guid id, String applicationPoolId, IdentityType identityType, String applicationPoolUsername, SecureString applicationPoolPassword, String iisServerComment, Boolean secureSocketsLayer, String iisHostHeader, Int32 iisPort, Boolean iisAllowAnonymous, DirectoryInfo iisRootDirectory, Uri defaultZoneUri, Boolean iisEnsureNTLM, Boolean createDatabase, String databaseServer, String databaseName, String databaseUsername, String databasePassword, SPSearchServiceInstance searchServiceInstance, Boolean isPaired, Boolean autoActivateFeatures)
    at Microsoft.SharePoint.Administration.SPWebApplication.OnRestore(Object sender, SPRestoreInformation args)
    [1/11/2010 11:15:08 AM]: Verbose: Starting object: WSS_Content.
    [1/11/2010 11:15:08 AM]: Verbose: [WSS_Content] SQL Server Connection String: Data Source=BSCLIENT5\;Initial Catalog=WSS_Content;Integrated Security=True.
    [1/11/2010 11:15:25 AM]: Error: Object WSS_Content failed in event OnRestore. For more information, see the error log located in the backup directory.
    SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server)

    ————————————————————————
    please help me !!!!!!!!!!!!!!!!!!!!!!!!!1

  7. Rizwan
    December 1, 2012 at 11:03 am

    AOA brother,
    im new in Share point 2010, Could you guide me How to Perform a Full Backup in SharePoint 2010

  1. April 18, 2009 at 4:50 pm
  2. May 2, 2009 at 7:00 am
  3. January 6, 2010 at 8:49 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: