鲲鹏社区首页
中文
注册
我要评分
文档获取效率
文档正确性
内容完整性
文档易理解
在线提单
论坛求助

核对数据库迁移结果

  1. 统计达梦数据基础信息。
    1. 统计页大小
      1
      select page;
      
    2. 通过编码格式
      1
      select unicode;
      
    3. 统计大小写敏感参数
      select case_sensitive
  2. 统计达梦数据中的对象以及表数据量。
    1. 根据指定用户统计用户下的各对象类型和数目。
      1
      select object_type,count(*) from all_objects where owner='OA8000_DM2015' group by object_type;
      
    2. 统计指定用户下所有的对象,并记录到新的记录表中。
      1
      2
      create table dm_objects(obj_owner varchar(100),obj_name varchar(100),obj_type varchar(50));
      insert into dm_objects select owner,object_name,object_type from all_objects where owner='OA8000_DM2015';
      
    3. 统计每个表的数据量到表数据记录表。
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      create table dm_tables(tab_owner varchar(100),tab_name varchar(100),tab_count int);
      begin
      for rec in (select owner,object_name from all_objects where owner='OA8000_DM2015' and object_type='TABLE') loop
      begin
      execute immediate 'insert into dm_tables select '''|| rec.owner ||''','''|| rec.object_name ||''',count(*) from '|| rec.owner || '.' || rec.object_name;
      exception when others then
      print rec.owner || '.' || rec.object_name || 'get count error';
      end;
      end loop;
      end;
      select * from dm_tables;
      
    4. 对比达梦数据库中对象和Oracle库中对象以及数据量差异。
      • 比对对象,找出没有迁移的对象:
        1
        2
        3
        4
        select * from Oracle_objects where (obj_owner,obj_name) not in (
        select obj_owner,obj_name from dm_objects
        ) --and obj_type='TABLE'
        ;
        
      • 比对表数据量,找出数据量不相等的表:
        1
        2
        3
        select a.tab_owner,a.tab_name,a.tab_count-b.tab_count from Oracle_tables a, dm_tables b
        where a.tab_owner=b.tab_owner and a.tab_name=b.tab_name
        and a.tab_count-b.tab_count<>0