04 June 2012

SharePoint 2007 import / export

I have been working to export site content from one SharePoint 2007 server to another using stsadm import / export.
This is my recording of a commonly occurring error that others have seen at least as far back as 2009.
The thorn in the side is that the TEMP and TMP environment variables for the account running the processes (both import and export) need to be located on a drive with sufficient space to contain the entire site being exported / imported.

stsadm –o export

In the export log, the following error will be recorded:
[5/31/2012 12:23:26 PM]: FatalError: There is not enough space on the disk.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count)
   at Microsoft.SharePoint.Deployment.ExportDataFileManager.AddFile(Stream fileStream)
   at Microsoft.SharePoint.Deployment.FileSerializer.SaveFile(SerializationInfo info, ExportObjectManager objectManager, ExportDataFileManager fileManager, SPExportSettings settings, SPWeb parentWeb, Boolean isGhosted, String setupPath, String setupPathUser, Byte setupPathVersion, String webRelativeFileUrl, Int32 size, Byte level)
   at Microsoft.SharePoint.Deployment.FileSerializer.GetDataFromDataSet(Object obj, SerializationInfo info, StreamingContext context)
   at Microsoft.SharePoint.Deployment.DeploymentSerializationSurrogate.GetObjectData(Object obj, SerializationInfo info, StreamingContext context)
   at Microsoft.SharePoint.Deployment.XmlFormatter.SerializeObject(Object obj, ISerializationSurrogate surrogate, String elementName, Boolean bNeedEnvelope)
   at Microsoft.SharePoint.Deployment.XmlFormatter.Serialize(Stream serializationStream, Object topLevelObject)
   at Microsoft.SharePoint.Deployment.ObjectSerializer.Serialize(DeploymentObject deployObject, Stream serializationStream)
   at Microsoft.SharePoint.Deployment.SPExport.SerializeObjects()
   at Microsoft.SharePoint.Deployment.SPExport.Run()
The disk being referred to is not the disk that the exported CMP files are to be written to but the disk to which the current user’s TEMP and TMP folders are located.

stsadm-o import

In the import log, the following error will be recorded:
[6/4/2012 11:47:07 AM]: Error: Failure writing to target file [6/4/2012 11:47:07 AM]: Debug:    at Microsoft.SharePoint.Library.SPRequest.ExtractFilesFromCabinet(String bstrTempDirectory, String bstrCabFileLocation)
   at Microsoft.SharePoint.Deployment.ImportDataFileManager.<>c__DisplayClass2.<Uncompress>b__0()
   at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state)
   at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()
   at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
   at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
   at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
   at Microsoft.SharePoint.Deployment.ImportDataFileManager.Uncompress(SPRequest request)
[6/4/2012 11:47:07 AM]: FatalError: Failed to read package file.
   at Microsoft.SharePoint.Deployment.ImportDataFileManager.Uncompress(SPRequest request)
   at Microsoft.SharePoint.Deployment.SPImport.Run()
***
Inner exception:
Failure writing to target file
   at Microsoft.SharePoint.Library.SPRequest.ExtractFilesFromCabinet(String bstrTempDirectory, String bstrCabFileLocation)
   at Microsoft.SharePoint.Deployment.ImportDataFileManager.<>c__DisplayClass2.<Uncompress>b__0()
   at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state)
   at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()
   at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
   at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
   at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
   at Microsoft.SharePoint.Deployment.ImportDataFileManager.Uncompress(SPRequest request)
[6/4/2012 11:47:57 AM]: Progress: Import Completed.
[6/4/2012 11:47:57 AM]: Finish Time: 6/4/2012 11:47:57 AM.
[6/4/2012 11:47:57 AM]: Completed with 0 warnings.
[6/4/2012 11:47:57 AM]: Completed with 2 errors.
The “Failure writing to target file” is again the location of the TEMP and TMP directories of the currently logged in user. This error is saying that there isn’t enough temporary disk space available.
I think the fact that SharePoint allows you to specify how large you want the CMP files to be leads you to  think that each file will be individually packed / unpacked but this is simply misleading. The entire site is exported to TEMP then written to CMP files or imported from CMP files to TEMP before written to SharePoint.
I could guess that this behaviour continues into SharePoint 2010 but haven’t confirmed this.

No comments:

Post a Comment