Using Stsadm.exe to Migrate Site Data

This documentation is preliminary and is subject to change.

The SharePoint Foundation administrative application Stsadm.exe now provides an export operation that supports moving content to a content migration package, and a companion import operation that supports importing and unpacking contents of the package onto the destination site.

This topic documents only using the export and import operations in Stsadm.exe.

Note

These new operations in Stsadm.exe replace functionality that was formerly provided in the utility application Smigrate.exe.

Limitations of Using Stsadm.exe for Content Migration

Stsadm.exe provides an easy way to migrate the contents of one SharePoint Foundation site collection to another by using basic export and import operations. However, although this method is easy and simple to execute, there are are certain limitations:

  • Stsadm supports moving only entire Web sites (SPWeb instances). You are not able to export selected items or lists. Therefore, Stsadm does not support selectively updating site contents. In cases in which you need to export only selected items, use classes in the Microsoft.SharePoint.Deployment namespace.

  • You cannot retain object globally unique identifiers (GUIDs) when you migrate site objects. New identifiers are added at the migration target.

  • You can experience problems if you rerun Stsadm on site content that has already been imported. If that occurs, all list items that are not document libraries are duplicated on the target site.

  • Other minor limitations are imposed by operation parameters. For example, although the migration object model provides about 25 export/import parameters, the equivalent operations in Stsadm provide only about 10. And in some cases parameters provided in Stsadm are somewhat limited. For example, when applying security settings, Stsadm offers only two options: "no security" or "all security." You should become thoroughly familiar with the Stsadm operations and their parameters before using it for content migration.

Locating Stsadm.exe

By default, the program Stsadm.exe is installed in the %systemdrive%\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN directory.

Usage Grammar

Windows SharePoint Services 3.0 adds two new commands that support migration: export and import. The grammar by which the operations are invoked is quite simple:

   stsadm.exe -o <operation> [<parameter>]
   stsadm.exe -help [<operation>]

Stsadm.exe -o export

Exports the contents of a SharePoint Foundation Web site (SPWeb), with site schema, to one or more content migration package (.cmp) files.

Parameters

-url <URL>

Required. Specifies the URL of the SharePoint Foundation Web site (SPWeb) to export.

-filename <file name>

Required. Specifies the file name of the .cmp file to which site data is exported.

Note

If you set the -nofilecompression parameter, the specified export directory becomes the -filename parameter value.

The -filename parameter takes an optional parameter,-overwrite. which directs the export operation to overwrite any previous version of the .cmp file that has the same file name.

-overwrite

Directs the export operation to overwrite the previous version of the migration package that uses the same file name as the .cmp file.

-includeusersecurity

Specifies whether to include security information and user data.

Note

To preserve time stamps, security information, and user data, you must use the -includeusersecurity parameter.

-haltonwarning

Directs the export operation to terminate when a system warning occurs.

-haltonfatalerror

Directs the export operation to terminate when a system error occurs.

-nofilecompression

Directs the export operation not to compress the migration package file.

-nologfile

Directs the export operation not to provide a log file for the export events. Note that turning off the log file provides only minor performance gain; it is not recommended.

By default, Stsadm.exe creates a log file and places the file in the same directory as the .cmp file, or in the export directory if the -nofilecompression parameter is selected. Stsadm reports the log file names on concluding.

-versions <1, 2, 3, 4>

Provides versioning information for data in the .cmp file:

  • 1   Specifies the last major version for files and list items (default).

  • 2   Specifies the current version, either the last major or the last minor version.

  • 3   Specifies the last major and the last minor versions for files and list items.

  • 4   Specifies all versions for files and list items.

-cabsize <integer>

Specifies the maximum size of the .cmp file in megabytes. The range is from 1 to 1024 MB. If the export data exceeds the maximum specified, the data is split into multiple files.

-quiet

Directs the export operation to provide no output to the screen. This provides a minor performance gain.

Stsadm.exe -o import

Imports and unpacks the content migration package (.cmp) file and loads site data as specified in the site schema.

Parameters

-url <URL>

Required. Specifies the URL of the SharePoint Foundation Web site (SPWeb) into which the data is imported.

-filename <file name>

Required. Specifies the file name of the .cmp file to import.

Note

If you set the -nofilecompression parameter, the specified import directory becomes the -filename parameter value.

-includeusersecurity

Specifies whether to include security information and user data on import.

Note

To preserve time stamps, security information, and user data, you must use the -includeusersecurity parameter.

-haltonwarning

Directs the import operation to terminate when a system warning occurs.

-haltonfatalerror

Directs the import operation to terminate when a system error occurs.

-nofilecompression

You must set this parameter if it was used during export.

-nologfile

Directs the import operation to not provide a log file for import events. By default, Stsadm.exe creates a log file.

-updateversions <1, 2, 3, 4>

Specifies how to update data in the .cmp file:

  • 1   Directs the import operation to add new version specifiers to the current file (default).

  • 2   Directs the import operation to overwrite the file and all of its versions (delete file, then insert file).

  • 3   Directs the import operation to ignore the existing file.

  • 4   Directs the import operation to terminate the import operation if file conflicts are detected.

-quiet

Directs the export operation to provide no output to the screen. This provides a minor performance gain.

See Also

Concepts

Content Migration Overview

Reference

Microsoft.SharePoint.Deployment

Microsoft.SharePoint.SPWeb