STSADM is a SharePoint administrative tool which generally resides in the “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN” folder within the SharePoint 2007 environment and in the “C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\BIN” folder in a SharePoint 2010 environment.
This tool is to be run on the same server of SharePoint by people who are member of Administrators group. In this section we are going to see how this tool can be used to export a site, library or list and import it back when required. These are the general command formats to export a site, library or list and import it back:
stsadm -o Export -URL -Filename -Quiet -Overwrite
stsadm -o Import -URL -Filename -Quiet
The Overwrite switch is required to overwrite a file if it is already existing on the specified location during an export operation whereas the Quiet switch is used to suppress the detail messages generated on the screen during the command execution. Similar to PowerShell cmdlets, you can specify the parameters for including security related detail and all the versions of the documents or lists with the STSADM tool as well. To learn about complete syntax, click here.
The first command, given below, will export the contents of all sites of the specified site collection.
The second command will export the contents of the specified site only.
TThe third command will export the content of the Shared Documents library of the specified site.
stsadm -o Export -URL http://mktaraliw2k8r2:8081 -Filename \\MKTARALIW2K8R2\SharePointBackupFolder\STAllSites.cmp -Overwrite -Quiet
stsadm -o Export -URL http://mktaraliw2k8r2:8081/hr -Filename \\MKTARALIW2K8R2\SharePointBackupFolder\STHRSite.cmp -Overwrite -Quiet
stsadm -o Export -URL “http://mktaraliw2k8r2:8081/hr/Shared Documents” -Filename \\MKTARALIW2K8R2\SharePointBackupFolder\STSharedDocuments.cmp -Overwrite -Quiet
The first command, given below, will import contents of all sites available in the exported file to the specified site collection.
The second command will import the contents to the specified site, and in this case the site must exist and the contents will be overwritten.
The third command will import the content to the specified site and document library, in this case the contents of the specified library will be overwritten.
stsadm -o Import -URL http://mktaraliw2k8r2:8081 -Filename \\MKTARALIW2K8R2\SharePointBackupFolder\STAllSites.cmp -Quiet
stsadm -o Import -URL http://mktaraliw2k8r2:8081/hr -Filename \\MKTARALIW2K8R2\SharePointBackupFolder\STHRSite.cmp -Quiet
stsadm -o Import -URL “http://mktaraliw2k8r2:8081/hr” -Filename \\MKTARALIW2K8R2\SharePointBackupFolder\STSharedDocuments.cmp -Quiet
- While you can still use the old STSADM tool to perform content export and import, it is recommended not to use this tool (unless you are forced to use it for backward compatibility) as this tool has been deprecated and provided in SharePoint 2010 only for backward compatibility.
- The SharePoint 2010 Central Administration UI provides a way to export a site, library or list but not for importing it back. You need to use PowerShell cmdlets or old STSADM tool for importing it back.
- A log file gets created after an export and import operation (with this name : .export during export and .import during import), which contains all the details about the operation execution.
- The granular backup/export and restore/import operations are more processing and read-intensive, as it uses Transact-SQL queries as opposed to farm backup.
- If your SQL Server version supports database snapshot (Enterprise and Developer editions) , it is recommended to use UseSqlSnapshot parameter with Export-SPWeb command for a more consistent backup.
- Workflows are not included when we export/import contents of sites, libraries, or lists.