Monday, March 22, 2010

Moving A Site - "Restore Did Not Complete Successfully"

I have been migrating sites from one SharePoint farm to another by means of making a "backup" or "export" from the source server and doing a "restore" or "import" on the destination server.  This is not as simple as it seems, since Microsoft is determined to make it confusing (which is not far from making it just plain difficult).

First, be aware that both SharePoint Designer and stsadm have facilities for this kind of thing.  One difference is that SPD enables the functions from the client, whereas use of stsadm requires access to the server command line.  Another difference is that SPD calls its functions "Backup Site..." and "Restore Site..." (located on the "Site > Administration" menu.  The comparable functions in stsadm are called "export" and "import";  the terms "backup" and "restore" are reserved in stsadm for site-collection level functions.

UPDATE:  Yet another difference:  SPD premits specifying that the backup should or should not include subsites.  I did not find any way to comparably restrict stsadm -o export.

A problem can occur when using SPD "Backup Site..." and "Restore Site..." when the site contains more than 25MB.  My speculation is that SPD uses "stsadm -o export ... -cabsize 25" , which is supposed to cause the backup to be in 25MB chunks.  However, stsadm can overrun the -cabsize limit (see below).  When that happens,  I think SPD has a problem dealing with files coming back to it which are larger than it expects.  See more at farhanfaiz’s Weblog

Because I have access to the source server command line, I worked around the problem by using stsadm with a much larger -cabsize, creating a single large ".cmp" file, per Web BoRG.  Then I copied that to my SPD client, and did a "Restore Site..." to the destination server.  That produced a new error: "Web site restore did not complete successfully”.  No other information was available.

I eventually resolved this by adjusting the maximum upload size on the _destination_ server.  SharePoint Designer does a "Restore Site" operation by first uploading the .cmp files.  I noticed that SharePoint Designer was not showing the uploaded file in the site during or after the (failed) restore, which led me to consider why the upload was not successful.  This upload is subject to the limitation imposed by the "Maximum upload size" set in on the destination server in the Central Administration > Application Management > General Settings page. 

If you have access to the command line on the _source_ server, you can use "stsadm -o export ...   -cabsize XXX", replacing "XXX" with the maximum size in MB.  [The maximum you may specify for "XXX" is 1023.]  NOTE, however, that the max you specify is not a guaranteed upper limit;  stsadm may overrun the size somewhat (to avoid splitting a component, I suppose).  For example, I used a '-cabsize 100" command, which created a .cmp file with 107,831 KB.  So leave yourself some headroom between the "-cabsize" and the server's "Maximum Upload Size".

At the very end of the Restore, I saw an error message:

"https://myhostname/site is busy.  Try again later."

I checked the site, and it appears that the site was actually restored successfully.  I speculate that the "busy" message was the result of SPD trying to open the newly-restored site before it was quite ready.  YMMV.

UPDATE:  I encountered another export error and discovered a workaround  -- see my next post in what I hope won't be a long series.
Reblog this post [with Zemanta]

No comments: