STSADM Backup/Restore for MOSS 2007

Often there is a need to copy a site collection in SharePoint from either one server to another, or to back it up before making some big changes, or maybe even just a desire to duplicate the site collection for testing purposes.

There are a whole slew of ways to do this, but I will recommend the simplest and most successful approach (in my experience). That is the STSADM command for backing up site collections, and the STSADM command for restoring site collections.

Backup a Site Collection

  1. On your SharePoint server hit WINDOWS + R. (Start Button > Run)
  2. Type “cmd” and click OK.
  3. In the cmd window navigate to the “C:\Program files\common files\microsoft shared\web server extensions\12\bin” directory.
  4. Type stsadm -o backup -url “http://theurlofthesitecollection” -filename “C:\MyFirstBackup.bak” -overwrite
  5. Press Enter

    When the backup is completed it will now be sitting in your C:\ with the name MyFirstBackup.bak.

At this point you can copy the file to the other server, or just perform the restore on the same server by following the steps below.

Note before restoring ensure that the target site collection you are restoring onto is a BLANK site. This will allow you to avoid some potential issues with duplicate names and ID’s.

To Restore a Site Collection

  1. On your SharePoint server hit WINDOWS + R. (Start Button > Run)
  2. Type “cmd” and click OK.
  3. In the cmd window navigate to the “C:\Program files\common files\microsoft shared\web server extensions\12\bin” directory.
  4. Type stsadm -o restore -url “http://theurlofthetargetsitecollection” -filename “C:\MyFirstBackup.bak” -overwrite
  5. Press Enter

When the restore is complete the site collection should now be replicated, or restored.

Keep in mind this is a pretty fast method. However it is not the ONLY or BEST method for backing up. It’s only my recommendation for something fast to migrate site collections, etc.

For more information on the limitations of each backup method and advantages see this wonderful TechNet Article: http://technet.microsoft.com/en-us/library/cc287880(TechNet.10).aspx