开发者社区> 问答> 正文

如何查看初始化详情



描述


同步实例处于任何状态,都可以调用这个接口查看同步初始化详情。

请求参数

参数说明数据类型参数说明
ActionString系统默认参数,这个接口的接口定义,取值为:DescribeDataLoadStatus
SynchronizationJobIdString
参数说明数据类型是否必须参数说明
ActionString系统默认参数,这个接口的接口定义,取值为:DescribeDataLoadStatus
SynchronizationJobIdString同步实例ID
StructureInitializationBoolean查看结构初始化详情
DataInitializationBoolean查看全量数据初始化详情
DataSynchronizationBoolean查看增量初始化详情
PageSizeInteger每页记录数,取值:30/50/100默认值:30,只有当配置项:StructureInitialization、DataInitialization、DataSynchronization 只有一个为True时,这个配置项才生效
PageNumInteger页码,大于0,且不超过Integer的最大值,默认值:1。只有当配置项:StructureInitialization、DataInitialization、DataSynchronization 只有一个为True时,这个配置项才生效


返回参数

参数名称数据类型参数说明
<公共参数>接口请求ID


示例


下面简单演示通过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());
        }
    }

展开
收起
云栖大讲堂 2017-10-31 16:32:05 1788 0
0 条回答
写回答
取消 提交回答
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载

相关实验场景

更多