描述
任务处于:迁移中、迁移失败、暂停中、迁移完成时,可以调用这个接口查看数据迁移详情,包括每个对象的迁移状态及进度。
请求参数
返回参数
StructureInitializationDetail参数定义
DataInitializationDetail 参数定义
DataSynchronizationDetail 参数定义
示例
下面简单演示通过JAVA SDK 查看迁移任务详情的示例:
private static void describeMigrationJobDetail(String MigrationJobId) {
DescribeMigrationJobDetailRequest request = new DescribeMigrationJobDetailRequest();
request.setMigrationJobId(MigrationJobId);
request.setMigrationModeStructureInitialization(true);
request.setMigrationModeDataInitialization(true);
request.setMigrationModeDataSynchronization(true);
try {
DescribeMigrationJobDetailResponse response = client.getAcsResponse(request);
System.out.println("Get Migration Detail of Migration Job " +MigrationJobId+" Succeed!");
List<StructureInitializationDetail> struInitDetails= response.getStructureInitializationDetailList();
System.out.println("Structure Initialization Detail:");
for (int i = 0; i < struInitDetails.size(); i++) {
String objectName=struInitDetails.get(i).getObjectName();
String SrcDBName=struInitDetails.get(i).getSourceOwnerDBName();
String DestDBName = struInitDetails.get(i).getDestinationOwnerDBName();
String Status=struInitDetails.get(i).getStatus();
String errorMsg=struInitDetails.get(i).getErrorMessage();
System.out.println("ObjectName:"+objectName+"; SRCDBName:"+SrcDBName+"; DESTDBName:"
+DestDBName+"; Status:"+Status+"errorMsg:"+errorMsg);
}
List<DataInitializationDetail> dataInitDetails = response.getDataInitializationDetailList();
System.out.println("Data Initialization Detail:");
for (int i = 0; i < dataInitDetails.size(); i++) {
String tblName=dataInitDetails.get(i).getTableName();
String tbl_srcDBName=dataInitDetails.get(i).getSourceOwnerDBName();
String tbl_destDBName=dataInitDetails.get(i).getDestinationOwnerDBName();
String dataInitStatus=dataInitDetails.get(i).getStatus();
String dataInitSumRows=dataInitDetails.get(i).getTotalRowNum();
String dataInitFinishRows=dataInitDetails.get(i).getFinishRowNum();
String dataUsedTime=dataInitDetails.get(i).getMigrationTime();
String dataInitErrMSG = dataInitDetails.get(i).getErrorMessage();
System.out.println("TableName:"+tblName+"; SRCDBName:"+tbl_srcDBName
+"; DESTDBName:"+tbl_destDBName+"; SumRows:"+dataInitSumRows+"; FinishRows"
+"; UsedTime:"+dataUsedTime+"; ErrorMSG:"+dataInitErrMSG);
}
List<DataSynchronizationDetail> dataSyncDetails = response.getDataSynchronizationDetailList();
System.out.println("Data Synchronization Detail");
for (int i = 0; i < dataSyncDetails.size(); i++) {
String dataSyncTblName=dataSyncDetails.get(i).getTableName();
String dataSyncSRCDBName=dataSyncDetails.get(i).getSourceOwnerDBName();
String dataSyncDESTDBName = dataSyncDetails.get(i).getDestinationOwnerDBName();
String dataSyncStatus = dataSyncDetails.get(i).getStatus();
String dataSyncErrMsg = dataSyncDetails.get(i).getErrorMessage();
System.out.println("TableName:"+dataSyncTblName+"; SRCDBName:"+dataSyncSRCDBName
+"; DESTDBName:"+dataSyncDESTDBName+"; Status:"+dataSyncStatus+"; ErrorMSG:"+dataSyncErrMsg);
}
} catch (Exception e) {
// TODO: handle exception
System.out.println("Get Migration Detail of Migration Job " +MigrationJobId+" Failed!");
System.out.println(e.toString());
}
}