Friday 28 September 2012

Back up a site collection in SharePoint Server 2010



Use Windows PowerShell to back up a site collection in SharePoint Server
You can use Windows PowerShell to back up a site collection manually or as part of a script that can be run at scheduled intervals.
To back up a site collection by using Windows PowerShell
  1. Verify that you meet the following minimum requirements: See Add-SPShellAdmin.
  2. On the Start menu, click All Programs.
  3. Click Microsoft SharePoint 2010 Products.
  4. Click SharePoint 2010 Management Shell.
  5. At the Windows PowerShell command prompt type the following command:
PowerShell
Backup-SPSite -Identity <Site collection name> -Path <backup file> [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose]
Backup Steps
1. Navigate to the Central Administration => Backup and Restore
2. Under “Farm Backup and Restore” section click “Perform a backup”.
3. Now you’ll be landed in the following page where you can select the site or site collection you want to take backup:




4. Click next and you’ll be navigated to the following page where you can select backup type (full or differential) and backup location:
Restoring Steps
To restore follow the steps:
1. Navigate to the Central Administration => Backup and Restore.
2. Under “Farm Backup and Restore” section click “Restore from a backup”. Follow the wizard to restore from a backup.

Backup/Restore from one server to another or from one Site Collection to another (with PowerShell command)

In some cases, you have developed a SharePoint site collection in your dev or stg machine and now you want to move the site with data from dev/stg to production. In such cases the process shown in the section “Backup/Restore in the same server and same site  collection” will not work. The recommended way is to use PowerShell command to take backup and restore the backup.
Backup a Site collection with PowerShell command
In SharePoint 2010, PowerShell command Backup-SPSite is used for taking backup. you can get details of the command from the msdn link. The following command will backup the site collection ‘http://myserver’.
Backup-SPSite -Identity http://myserver -Path "c:\backup\file.bak"
Restore a Site Collection with PowerShell command
To restore site collection you’ll use the following command. Use –Force if you want to overwrite the existing site collection
Restore-SPSite -Identity http://myserver -Path "c:\backup\file.bak"
However, once I had restored the backup I could not access the site. The problem was that I needed to deploy the custom SharePoint solution. So in case of site collection migration (with backup/restore) from one server to another or from one site collection to another, the steps should be:
1.    Restore the backup.
2.    If your source site collection (from where you taken backup) uses custom SharePoint solution, then deploy the solution in the destination site collection (where you are restoring the backup). If you try to access the site without deploying solution then you may get the site non-functional.
3.    Now you can try to access the site.

No comments:

Post a Comment