xxy d91f4f33eb change files structure před 5 roky
..
全量迁移 d91f4f33eb change files structure před 5 roky
增量迁移 d91f4f33eb change files structure před 5 roky
0_MigrationSteps.md d91f4f33eb change files structure před 5 roky
0_delete_redundance_data.sql d91f4f33eb change files structure před 5 roky
0_update_data_dbfield.sql d91f4f33eb change files structure před 5 roky
0_update_data_relation_appendix.sql d91f4f33eb change files structure před 5 roky
0_update_data_relation_appendix_1.sql d91f4f33eb change files structure před 5 roky
0_update_data_relation_appendix_2.sql d91f4f33eb change files structure před 5 roky
0_update_data_table.sql d91f4f33eb change files structure před 5 roky
1_data_migration_logger.sql d91f4f33eb change files structure před 5 roky
1_data_migration_offset.sql d91f4f33eb change files structure před 5 roky
2_step2.md d91f4f33eb change files structure před 5 roky
3_sp_data_migration_mas_publishedvideo.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_mas_videostream.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_masid.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_masvideo.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_wcmappendix.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_wcmchannel.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_wcmchannelchildindexquote.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_wcmchannelsyn.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_wcmfolderpublishconfig.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_wcmtemplate.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_wcmtemplateargument.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_wcmtemplateemploy.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_wcmtemplatenest.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_wcmtemplatequote.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_wcmwebsite.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_xwcmclassinfo.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_xwcmclassinfoview.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_xwcmdbfieldinfo.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_xwcmmaterial.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_xwcmmetaviewemployer.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_xwcmmetaviewfieldgroup.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_xwcmtableinfo.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_xwcmviewfieldinfo.sql d91f4f33eb change files structure před 5 roky
3_sp_data_migration_xwcmviewinfo.sql d91f4f33eb change files structure před 5 roky
4_sp_city_appendix.sql d91f4f33eb change files structure před 5 roky
4_sp_city_base.sql d91f4f33eb change files structure před 5 roky
4_sp_city_data.sql d91f4f33eb change files structure před 5 roky
4_sp_city_mas.sql d91f4f33eb change files structure před 5 roky
4_sp_city_n.sql d91f4f33eb change files structure před 5 roky
5_caller.sql d91f4f33eb change files structure před 5 roky
6_recover.sql d91f4f33eb change files structure před 5 roky
readme.md d91f4f33eb change files structure před 5 roky

readme.md

迁移方式

参见 http://wiki.devdemo.trs.net.cn/pages/viewpage.action?pageId=12027628

迁移方式(新)

注: 中间库:每个节点使用不同中间库,库名可以不限制 mas中间库:库名固定为trs_data_migration_mas

  1. 数据准备与wiki中相同。中间库可以根据节点自己区分。

    • 将wiki中记录的表,元数据表以及mas表迁移到对应的中间库中。
    • 中间库,在Navicat中,中间库运行1-3的所有存储过程。

      #删除有问题的素材库数据
      DELETE FROM xwcmmaterial WHERE MATERIALTYPE = 1 and FILENAME is NULL;
      DELETE FROM xwcmmaterial WHERE MATERIALTYPE = 2 and MASID is NULL;
      #查询表中是否存在唯一建重复
      SELECT DOCID,CHNLID FROM wcmchnldoc GROUP BY DOCID,CHNLID HAVING COUNT(1) > 1;
      create table t_chnldoc as SELECT MAX(RECID) as 'RECID',DOCID,CHNLID,count(1) datacount FROM wcmchnldoc GROUP BY DOCID,CHNLID HAVING COUNT(1) > 1 ;
      DELETE FROM wcmchnldoc WHERE recid IN(SELECT recid FROM t_chnldoc);
      
      1. 迁移站点,栏目,视图,模板等基本数据。(用户可以在新系统中增加角色,调整视图和模板)
      2. 中间库,处理数据中视图字段,使字段字段对应;

        # 相关视频 FieldType 由 51 变为 20
        update XWCMDBFieldInfo set FieldType=20 where FieldType=51;
        update XWCMViewFieldInfo set FieldType=20 where FieldType=51;
        # 相关图片 FieldType 由 50 变为 32
        update XWCMDBFieldInfo set FieldType=32 where FieldType=50;
        update XWCMViewFieldInfo set FieldType=32 where FieldType=50;
        # 相关文档 FieldType 由 57 变为 31
        update XWCMDBFieldInfo set FieldType=31 where FieldType=57;
        update XWCMViewFieldInfo set FieldType=31 where FieldType=57;
        # mw_文本框 FieldType 由 53 变为 3
        update XWCMDBFieldInfo set FieldType=3 where FieldType in (53,65);
        update XWCMViewFieldInfo set FieldType=3 where FieldType in (53,65);
        # mw_是否按钮 FieldType 由 54 变为 5
        update XWCMDBFieldInfo set FieldType=5 where FieldType=54;
        update XWCMViewFieldInfo set FieldType=5 where FieldType=54;
        # mw_时间按钮FieldType 由 55 变为 11
        update XWCMDBFieldInfo set FieldType=11 where FieldType=55;
        update XWCMViewFieldInfo set FieldType=11 where FieldType=55;
        # mw_复杂编辑器 FieldType 由 63 变为 12
        update XWCMDBFieldInfo set FieldType=12 where FieldType=63;
        update XWCMViewFieldInfo set FieldType=12 where FieldType=63;
        
    • 中间库,迁移站点,栏目,视图到trs_hycloud_iip;

      call sp_city_base(节点ID);
      
      • 中间库,处理元数据表信息;需要先对迁移元数据表进行整理,将需要迁移的元数据表拷贝到中间库;
      • 执行存储过程update_data_dbfield.sql和update_data_table.sql,。中间库,删除多余字段元数据,添加默认的元数据字段

        # 注意该脚本结果为sql 脚本。需要复制脚本再执行一遍。
        call update_data_table('_city4',0);
        
      • 中间库,中间库修改元数据表名;

        #获取修改元数据的表名的SQL;拷贝以下SQL生成的结果,运行生成的SQL。
        SELECT
        CONCAT( 'ALTER TABLE ', table_name, ' RENAME TO ', table_name, '_city4', ';' ) sqls 
        FROM
        information_schema.TABLES 
        WHERE
        table_schema = '中间库的数据库名称,比如:trs_data_migration_city4' 
        AND table_name LIKE 'wcmmetatable%';
        
        • 中间库,生成创建表sql以保存元数据表索引;拷贝以下SQL生成的结果,运行生成的SQL。 sql SELECT concat('create table trs_hycloud_iip.wcmmetatable',TABLENAME,'_city5 like ','wcmmetatable',TABLENAME,'_city5;') from xwcmtableinfo;
  2. 迁移数据 和 附件。

    • 中间库,将wcmdocuemnt,wcmchnldoc 元数据表中的数据拷贝到trs_hycloud_iip;拷贝以下SQL生成的结果,运行生成的SQL。

      #生成插入数据sql
      SELECT concat('INSERT INTO trs_hycloud_iip.wcmmetatable',TABLENAME,'_city5 SELECT * from ','wcmmetatable',TABLENAME,'_city5;') from xwcmtableinfo;
      
      • 中间库,执行迁移脚本 sql call sp_city_data(节点ID);
    • 中间库,迁移附件 注意必须要对迁移数据表建主键索引

      ALTER TABLE `xwcmmaterial`
      ADD PRIMARY KEY (`MATERIALID`);
      ALTER TABLE `xwcmmaterialquote`
      ADD INDEX (`MATERIALID`) USING BTREE ,
      ADD INDEX (`DOCID`) USING BTREE ;
      
      • mas中间库 #mas数据迁移 call sp_city_mas();

      #迁移附件 call sp_city_appendix(节点ID, masID的偏移量); ```

    • 中间库,修改元数据中相关图片,相关视频字段不对

    • masurl 例如:http://172.16.150.78/mas/openapi/pages.do?method=exPlay&appKey=gov&id=

      call update_data_relation_appendix(节点ID, masurl前缀, 起始tabelID,起始docId);