软件简介:
===================================第一步:准备数据================================
首先将两个区的数据库按以下方式放在一个sql服务器下:
源帐号数据库:db_account
源角色数据库:db_game
目标帐号数据库:db_account2
目标角色数据库:db_game2
====================================第二步:清理数据================================
--清理30级以下的角色
delete from db_game.t_user where level=30;
delete from db_game2.t_user where level=30;
--清理没有建立角色的帐号
DELETE FROM db_account.t_account WHERE NOT accountid IN (
SELECT DISTINCT accountid
FROM db_game.t_user);
DELETE FROM db_account2.t_account WHERE NOT accountid IN (
SELECT DISTINCT accountid
FROM db_game2.t_user);
--清理帐号钻石消费记录 t_gold_used
delete from db_account.t_gold_used;
delete from db_account2.t_gold_used;
--清理登陆日志t_login
delete from db_account.t_login;
delete from db_account2.t_login;
--清理正在删除的行会
delete from db_game.t_user_guild where deleted=1;
delete from db_game2.t_user_guild where deleted=1;
delete from db_game.t_user_guild_terr where deleted=1;
delete from db_game2.t_user_guild_terr where deleted=1;
--清理行会杀人数据
delete from db_game.t_guild_kill_record;
delete from db_game2.t_guild_kill_record;
--清理行会对战数据
delete from db_game.t_guild_war_pair;
delete from db_game2.t_guild_war_pair;
--清理拜师数据
delete from db_game.request_teacher_list;
delete from db_game2.request_teacher_list;
--清理杀人数据
delete from db_game.t_murder;
delete from db_game2.t_murder;
--清理pve排行数据
delete from db_game.t_pve_rank;
delete from db_game2.t_pve_rank;
====================================第二步:整理源数据================================
查询重复帐号id
select accountid from db_account.t_account order by accountid asc;
select accountid from db_account2.t_account order by accountid desc;
查看accountid最小值为: n1
查看accountid2最大值为: n2
N = n2 - n1 + 1
修改重复帐号id(操作之前需要取消源数据的t_account主键和自动递增)
update db_account.t_account set accountid=accountid+N;
update db_game.t_user set accountid=accountid+N;
--查询重复帐号名称
SELECT name FROM db_account.t_account WHERE name IN (SELECT name FROM db_account2.t_account);
--修改重复帐号名称+a
update db_account.t_account set name= Concat(name,'a') WHERE name IN (SELECT name FROM db_account2.t_account);
查询重复角色id
SELECT dbid FROM db_game.t_user WHERE dbid IN (SELECT dbid FROM db_game2.t_user);
--查询重复角色名称
SELECT name FROM db_game.t_user WHERE name IN (SELECT name FROM db_game2.t_user);
--修改重复角色可以改名
update db_game.t_user set changename=1 WHERE name IN (SELECT name FROM db_game2.t_user);
--修改重复角色名称+★(可以不改。玩家上线必须改名才允许进入游戏)
update db_game.t_user set name= Concat(name,'★') WHERE name IN (SELECT name FROM db_game2.t_user);
--查询重复行会id
SELECT guildid FROM db_game.t_user_guild WHERE guildid IN (SELECT guildid FROM db_game2.t_user_guild);
--查询重复行会名
SELECT name FROM db_game.t_user_guild WHERE name IN (SELECT name FROM db_game2.t_user_guild);
SELECT guild FROM db_game.t_user WHERE guild IN (SELECT guild FROM db_game2.t_user);
--修改重复行会名+
update db_game.t_user_guild set name= Concat(name,'') WHERE name IN (SELECT name FROM db_game2.t_user_guild);
update db_game.t_user set guild= Concat(guild,'') WHERE guild IN (SELECT guild FROM db_game2.t_user);
====================================第三步:处理角色名称数据(可选)================================
--查询重复拍卖id
SELECT auctionitemid FROM db_game.t_auction_item WHERE auctionitemid IN (SELECT auctionitemid FROM db_game2.t_auction_item);
--查询重复邮件id
SELECT mailid FROM db_game.t_user_mail WHERE mailid IN (SELECT mailid FROM db_game2.t_user_mail);
--修改相关重复角色名称+★(可以不改。玩家上线必须改名才允许进入游戏)
update db_game.t_auction_item set ownername= Concat(ownername,'★') WHERE ownername IN (SELECT name FROM db_game2.t_user);
update db_game.t_defend_equip_rank set ownername= Concat(ownername,'★') WHERE ownername IN (SELECT name FROM db_game2.t_user);
update db_game.t_main_trump_rank set ownername= Concat(ownername,'★') WHERE ownername IN (SELECT name FROM db_game2.t_user);
update db_game.t_user_mail set sendername= Concat(sendername,'★') WHERE sendername IN (SELECT name FROM db_game2.t_user);
update db_game.t_user_mail set recvname= Concat(recvname,'★') WHERE recvname IN (SELECT name FROM db_game2.t_user);
update db_game.t_student set studentname= Concat(studentname,'★') WHERE studentname IN (SELECT name FROM db_game2.t_user);
update db_game.t_teacher set teachername= Concat(teachername,'★') WHERE teachername IN (SELECT name FROM db_game2.t_user);
====================================第四步:开始将源数据合并到目标数据================================
开始合并:
使用Navicat for MySQL的数据传输方式:
将源帐号数据db_account通过直接传输的方式合并到db_account2,数据库物件只选t_account表格,其它的不用选
将源角色数据db_game通过直接传输的方式合并到db_game2,数据库物件取消t_user_dungeon_team,t_vars,t_war_area表格,其它全选
注意:传输数据前要将 高级菜单==创建表 选项取消
====================================合并结束,db_account2与db_game2数据为最终一二区合并数据================================
by Siline 2010.7.1
下载地址:
|