描述
同步实例处于任何状态,都可以调用这个接口查看同步初始化详情。
请求参数
返回参数
示例
下面简单演示通过JAVA SDK 查询同步初始化详情的示例:
public void descInitStatus(String SyncJobId, DefaultAcsClient client) {
DescribeInitializationStatusRequest request = new DescribeInitializationStatusRequest();
request.setSynchronizationJobId(SyncJobId);
DescribeInitializationStatusResponse response = new DescribeInitializationStatusResponse();
try {
response = client.getAcsResponse(request);
System.out.println("Describe Initialization Detail of Synchronization Job "+SyncJobId+" Succeed!");
List<StructureInitializationDetail> strucInitDetails = response.getStructureInitializationDetails();
List<DataInitializationDetail> dataInitDetails = response.getDataInitializationDetails();
List<com.aliyuncs.dts.model.v20160801.DescribeInitializationStatusResponse.DataSynchronizationDetail> dataSynchronizationDetails = response.getDataSynchronizationDetails();
System.out.println("Structure Initialization Detail:");
for (int i = 0; i < strucInitDetails.size(); i++) {
System.out.println("ObjectName:"+strucInitDetails.get(i).getObjectName()
+"; ObjectType:"+strucInitDetails.get(i).getObjectType()
+"; SRCDBName:"+strucInitDetails.get(i).getSourceOwnerDBName()
+"; DESTDBName:"+strucInitDetails.get(i).getDestinationOwnerDBName()
+"; Status:"+strucInitDetails.get(i).getStatus()
+"; ErrMSG:"+strucInitDetails.get(i).getErrorMessage());
}
System.out.println("Data Initialization Detail:");
for (int i = 0; i < dataInitDetails.size(); i++) {
System.out.println("TableName:"+dataInitDetails.get(i).getTableName()
+"; SRCDBName:"+dataInitDetails.get(i).getSourceOwnerDBName()
+"; DESTDBName:"+dataInitDetails.get(i).getDestinationOwnerDBName()
+"; Status:"+dataInitDetails.get(i).getStatus()
+"; TotalRows:"+dataInitDetails.get(i).getTotalRowNum()
+"; FinishedRows:"+dataInitDetails.get(i).getFinishRowNum()
+"; UsedTime:"+dataInitDetails.get(i).getUsedTime()
+"; ErroMSG:"+dataInitDetails.get(i).getErrorMessage());
}
System.out.println("Data Synchronization Detail:");
for (int i = 0; i < dataSynchronizationDetails.size(); i++) {
System.out.println("TableName:"+dataSynchronizationDetails.get(i).getTableName()
+"; SRCDBName:"+dataSynchronizationDetails.get(i).getSourceOwnerDBName()
+"; DESTDBName:"+dataSynchronizationDetails.get(i).getDestinationOwnerDBName()
+"; Status:"+dataSynchronizationDetails.get(i).getStatus()
+"; ErrMSG:"+dataSynchronizationDetails.get(i).getErrorMessage());
}
} catch (Exception e) {
// TODO: handle exception
System.out.println("Describe Initialization Status of Synchronization Job "+SyncJobId+" Failed!");
System.out.println(e.toString());
}
}