Thursday, September 24, 2009

How to Backup/Restore using STSADM command

The STSADM command is used for backing up and restoring site collections. You can use this command to take the backup with full functionality and restore to new site collection. The way to backup and restore a SharePoint site using this command is:

  • Stsadm –o backup –url -filename
  • And then at a later date you can restore the site using
  • Stsadm –o restore –url -filename

Backup a Site Collection:

  • On your SharePoint server hit WINDOWS + R.
  • Type “cmd” and click OK.
  • In the cmd window navigate to the “C:\Program files\common files\microsoft shared\web server extensions\12\bin” directory.
  • Type stsadm -o backup -url “http://Server001/demo” -filename “C:\MyFirstBackup.bak” -overwrite
  • 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.

Restore a Site Collection:

  • On your SharePoint server hit WINDOWS + R.
  • Type “cmd” and click OK.
  • In the cmd window navigate to the “C:\Program files\common files\microsoft shared\web server extensions\12\bin” directory.
  • Type stsadm -o restore -url “http://Server001/Newsite” -filename “C:\MyFirstBackup.bak” -overwrite
  • Press Enter

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

Note: STSADM is not user friendly with error messages. Check the Application Event Log. The message received in the command window may not be indicative of the true problem.

No comments: