I am trying to find the best way to accomplish the following: Move an existing share point application's content and meta databases, back them up and restore them to a different machine. In order to do this I am using the stsadm tool as follows: To backup, I use this command:

stsadm -o backup -url http://devpn-004:1234 -directory c:\sharePointBackup -filename testBackup.bak -backupmethod full -percentage 10

To restore, I use this command:

stsadm -o restore -url %1 -directory c:\sharePointBackup -restoremethod overwrite -percentage 10

The backup completes successfully. However, when I try to restore, I get the following errors:

Provisioning of the web application, SharePoint - 1234, has encountered the following error: System.ArgumentException: The IIS Web Site you have selected is in use by SharePoint.
You must select another port or hostname.

Object MySharepointDB1234 failed in event OnRestore. For more information, see the error log located in the backup directory.
SqlException: Login failed for user ''. The user is not associated with a trusted SQL Server connection.

The machine on which the restore takes place already has an existing web application at the port specified, and since the overwrite flag is used, I would expect no errors. I would appreciate any help and insight on the best practice to backup from machine a and restore to machine b a complete application.

2 Answers 2


you can use stsadm -o export and import options.


Did you provision the application before doing a restore? I would provision a test site collection to validate that the application is working before trying to restore a site collection to it.

I'm not familiar with the %1 for the URL, you may want to specify the actual url.

  • Mike, The site is successfully provisioned and up. The %1 character is my batch file artifact. It is replaced with an actual myrul:1234 even when run with these parameters, I still get the "Used by sharepoint error".
    – laconicdev
    Jul 26, 2010 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.