Migrate managed metadata to new SharePoint farm. Fix cannot bulk load error




Managed metadata is very good and powerful tool in SharePoint. But it has some not very comfortable specialties during migration data from one farm to another, for example, from test environment to productive. You can export your managed metadata from one site and import it into another one. But here's the problem that each termset and term has its own GUID. After you import managed data into the new farm, new GUID’s will be assigned to managed data items.

If content of your SharePoint site collection works with managed metadata, you will have a lot of errors if you just create backup of your SharePoint site collection and restore it in a new environment because GUIDS of termset will be changed. It is concerned on lookup values in lists that looked up at managed metadata. It means that list item values will be valueless.

Script to export managed metadata from SharePoint farm

# Script to export managed metadata from SharePoint farm
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue   
cls

$metadataService = Get-SPServiceApplication | where {$_.DisplayName -like '*Metadata Service*'}
$metadataServiceGUID = $metadataService.Id
$proxymetadataService  = Get-SPServiceApplicationProxy | where {$_.DisplayName -like '*Metadata Service*'}
$proxymetadataServiceGUID = $proxymetadataService.Id
Export-SPMetadataWebServicePartitionData -Identity "$metadataServiceGUID" -ServiceProxy "$proxymetadataServiceGUID" - Path "c:\Backup\metaData_SPSiteURL20160423.bak";

 

The import syntax is similar to export, but here you should use not GUID but the link to SPServiceApplicationProxy

 

Script to export managed metadata from SharePoint farm

# Script to export managed metadata from SharePoint farm
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue   
cls

$metadataService = Get-SPServiceApplication | where {$_.DisplayName -like '*Metadata Service*'}
$metadataServiceGUID = $metadataService.Id
$proxymetadataService  = Get-SPServiceApplicationProxy | where {$_.DisplayName -like '*Metadata Service*'}

Import-SPMetadataWebServicePartitionData $metadataServiceGUID -ServiceProxy $proxymetadataService -Path "\\server\metaData_SPSiteURL20160423.bak" –OverwriteExisting

During import you might see the error that cannot bulk load because the file could not be opened:

 

Import-SPMetadataWebServicePartitionData : Cannot bulk load because the file "C:\backup\44e7f0e0d6464876a179cd312abf41f5\ECMGroup.dat" could not be opened. Operating system error code 3(failed to  retrieve text for this error. Reason: 15105).

This error is if path value is on local disc, for example: "c:\backup\mymanagedmetadata.bak"

If you change path to UNC share to "\\server\backup\mymanagedmetadata.bak", than the error code will be "code 5" with equivalent error text.

 

To fix the error about cannot bulk load you should save managed metadata export file to SQL server of your SharePoint farm and to set path value to UNC share like this:

"\\SQLSErver\backup\mymanagedmetadata.bak"

 




No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment





MarkiMarta.com. Notes of web-specialist
Since 2009
18+