本文讲述SharePoint 2013/2010 在Farm之间迁移 managed metadata service的数据。
1. 在源Farm的SharePoint Management Shell 中执行以下脚本
$mmsApplication = Get-SPServiceApplication | ? {$_.TypeName -eq "Managed Metadata Service"}$mmsProxy = Get-SPServiceApplicationProxy | ? {$_.TypeName -eq "Managed Metadata Service Connection"}Export-SPMetadataWebServicePartitionData $mmsApplication.Id -ServiceProxy $mmsProxy -Path "C:\mmsdata.cab"
注意如果有多个Metadata data service application 或proxy,请使用如下脚本(替换MetaData Service Service Application Name 和MetaData Service Application Proxy Name):
$mmsApplication = Get-SPServiceApplication | ? {($_.TypeName -eq "Managed Metadata Service") -and ($_.DisplayName -eq "MetaData Service Service Application Name")} $mmsProxy = Get-SPServiceApplicationProxy | ? {($_.TypeName -eq "Managed Metadata Service Connection") -and ($_.DisplayName -eq "MetaData Service Application Proxy Name")} Export-SPMetadataWebServicePartitionData $mmsApplication.Id -ServiceProxy $mmsProxy -Path "C:\mmsdata.cab"
MetaData Service Application Proxy NameMetaData Service Application Proxy Name 可以使用Get-SPServiceApplication 来查看
MetaData Service Service Application Name 可以使用 Get-SPServiceApplication来查看
2. 将mmsdata.cab拷贝到目标Farm (WFE 或App) Server的C 盘
3.在目标Farm的Sql Server上将managed metadata service的service account 设置成Sql server对应实例的bulk admin角色,否则在第四步将遇到如下错误
Import-SPMetadataWebServicePartitionData: You do not have permission to use the bulk load statement
注意:
a. 如果是默认的情况managed metadata service的service account为Network service, 具体可以去IIS里面查看对应Application pool的account
b. 如果使用standalone的安装模式安装SharePoint, 对应数据库的实例名为 .\SharePoint
4. 在第步相同的目标Farm (WFE 或App) Server上启动SharePoint Management Shell并执行如下脚本:
$mmsApplication = Get-SPServiceApplication | ? {$_.TypeName -eq "Managed Metadata Service"} $mmsProxy = Get-SPServiceApplicationProxy | ? {$_.TypeName -eq "Managed Metadata Service Connection"} Import-SPMetadataWebServicePartitionData $mmsApplication.Id -ServiceProxy $mmsProxy -Path "C:、mmsdata.cab" -OverwriteExisting
这种方法的好处是迁移过去的term store, term set, term都会保留源Farm中的guid,如果有feature 关联到term store(如列表的某一列数据源为某个term set), 那个这个feature迁移到目标Farm时不需要变更其帮定的Guid.