Friday, 8 July 2011

Back up and Restore the site collection using stsadm command in SharePoint 2010



When you back up by using the Stsadm command-line tool, you can back up individual aspects of your SharePoint Products and Technologies deployment. For example, you can back up an individual site collection or you can back up the entire farm.
To export sites from your SharePoint Products and Technologies deployment, you use the following Stsadm command.
Stsadm –o export –url <URL> -filename <FileName>.cmp
To back up a site collection, you must use the following stsadm command.
stsadm –o backup –url <URL of the site collection> -filename <Name of the backup file
To back up an individual database, Web application, or the entire farm, you can use the following Stsadm command.
stsadm –o backup –directory <UNC path or local drive> -backupmethod <Full or Differential>

Restore
To import sites to your SharePoint Products and Technologies deployment, you use the following Stsadm command.
Stsadm –o import –url <URL> -filename <FileName>.cmp
To restore a site collection, you must use the following Stsadm command.
stsadm –o restore –url <URL of the site collection> -filename <Name of the backup file

To restore an entire farm you can use the following Stsadm command.
stsadm –o restore –directory <UNC path or local drive> -restoremethod <overwrite or new>






USing SharePoint 2010 Management Shell.

Restore:

Restore-SPSite -Identity <Site collection URL> -Path <Backup file> [-DatabaseServer <Database server name>] [-DatabaseName <Content database name>] [-HostHeader <Host header>] [-Force] [-GradualDelete] [-Verbose]

Backup:

Backup-SPSite -Identity <Site collection name> -Path <backup file> [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose]