自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

記一次MySQL找回用戶數(shù)據(jù)的過程

數(shù)據(jù)庫 MySQL
有天,我們公司外區(qū)的一個(gè)銷售C說他8月3號(hào)以前的工作流記錄找不到了。經(jīng)過分析,微信號(hào)和流程數(shù)據(jù)并沒什么關(guān)系,所以初步得出結(jié)論:本來只需要更新微信號(hào)的,結(jié)果我們公司的流程系統(tǒng)管理員把用戶先刪除,再創(chuàng)建了新的用戶。

[[204530]]

事情經(jīng)過

有天,我們公司外區(qū)的一個(gè)銷售C說他8月3號(hào)以前的工作流記錄找不到了。問清緣由,原來是更新了微信號(hào)(我們公司的工作流是基于企業(yè)微信開發(fā)的)。經(jīng)過分析,微信號(hào)和流程數(shù)據(jù)并沒什么關(guān)系,所以初步得出結(jié)論:本來只需要更新微信號(hào)的,結(jié)果我們公司的流程系統(tǒng)管理員把用戶先刪除,再創(chuàng)建了新的用戶。

解決過程

1、首先想到的是直接從定時(shí)備份數(shù)據(jù)里面找回原來的用戶ID,結(jié)果發(fā)現(xiàn)系統(tǒng)只備份了十天的記錄,而工作流系統(tǒng)上顯示銷售C只有8月3號(hào)以后的流程記錄,距今已經(jīng)40多天,從自動(dòng)備份的數(shù)據(jù)里已經(jīng)無法恢復(fù)。

2、所以,只能從數(shù)據(jù)庫的二進(jìn)制記錄里分析了。進(jìn)入MySQL數(shù)據(jù)存放的目錄:

 

3、通過分析文件修改時(shí)間,得知?jiǎng)h除操作的動(dòng)作在mysql-bin.000014文件里面記錄。

4、因?yàn)槿罩疚募嵌M(jìn)制的,所以導(dǎo)出日志為sql文件:

mysqlbinlog --no-defaults mysql-bin.000014 > workflow_operator.sql

5、日志記錄比較大,導(dǎo)出后有132M,壓縮打包文件并下載到本地,只有15.2M

tar -czvf workflow_operator.tar.gz workflow_operator.sql

6、在本地使用文本工具,查找所有的刪除用戶的操作:

***定位刪除銷售C的動(dòng)作在127766行(雖然日志記錄行數(shù)比較多,但是刪除用戶的動(dòng)作比較少,所以好排查)

 

7、用戶ID找到了,所幸的是,因?yàn)橹粍h除了用戶,沒有刪除流程數(shù)據(jù)(因?yàn)榱鞒虜?shù)據(jù)是要存檔的),所以只要把銷售C的舊流程數(shù)據(jù)user_id換成新的user_id就可以了,流程表比較多,通過體力勞動(dòng),找出有舊ID的表,然后再使用update語句一起更新,終于找回了所有數(shù)據(jù):

(***四位由于涉及隱私,使用XXX代替)

  1. update flow_fr_borrow set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'
  2. update flow_fr_cost set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'
  3. update flow_fr_fixedasset set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'
  4. update flow_fr_house_lease set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'
  5. update flow_fr_purchase set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'
  6. update flow_fr_travel set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'
  7. update flow_hr_positive set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'
  8. update flow_pr_equip_borrow_sale set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'
  9. update flow_pr_equip_return set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'
  10. update flow_sa_tepe set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'
  11. update flow_sa_safore set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'
  12. update flow_sa_authorize set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'
  13. update flow_sa_business set user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where user_id = '66adfd032ccf428d9e20e864f729xxxx'
  14. update flow_hr_trial set sel_user_id = 'e76cb8bccaf74f32b94d17f74437xxxx' where sel_user_id = '66adfd032ccf428d9e20e864f729xxxx' ; 
  15. update wf_hist_order set creator = 'e76cb8bccaf74f32b94d17f74437xxxx' where creator = '66adfd032ccf428d9e20e864f729xxxx'
  16. update wf_hist_task set operator = 'e76cb8bccaf74f32b94d17f74437xxxx' where operator = '66adfd032ccf428d9e20e864f729xxxx'
  17. update wf_order set creator = 'e76cb8bccaf74f32b94d17f74437xxxx' where creator = '66adfd032ccf428d9e20e864f729xxxx'
  18. update wf_hist_task_actor set actor_Id = 'e76cb8bccaf74f32b94d17f74437xxxx' where actor_Id = '66adfd032ccf428d9e20e864f729xxxx' 

銷售C表示很開心,并邀請(qǐng)我去貴州玩的話找他 

 

責(zé)任編輯:龐桂玉 來源: 數(shù)據(jù)庫開發(fā)
相關(guān)推薦

2017-12-19 14:00:16

數(shù)據(jù)庫MySQL死鎖排查

2015-01-05 09:56:41

UDPLinux TCP

2018-02-23 13:41:05

數(shù)據(jù)庫MySQL數(shù)據(jù)恢復(fù)

2011-08-08 13:31:44

數(shù)據(jù)分析數(shù)據(jù)倉庫

2021-01-20 23:40:27

數(shù)據(jù)泄露OpenWRT攻擊

2023-10-10 12:05:45

2019-08-26 09:50:09

2011-03-25 15:21:43

2021-11-23 21:21:07

線上排查服務(wù)

2019-03-15 16:20:45

MySQL死鎖排查命令

2019-08-14 16:08:43

大數(shù)據(jù)安全互聯(lián)網(wǎng)

2021-08-19 09:50:53

Java內(nèi)存泄漏

2021-02-01 09:00:34

Ceph octopu集群運(yùn)維

2021-01-06 10:01:09

數(shù)據(jù)泄露漏洞信息安全

2022-12-01 12:14:09

2021-05-11 11:05:58

蘋果iOS隱私

2023-10-23 19:18:05

2015-10-19 18:18:44

2020-08-12 08:25:43

數(shù)據(jù)庫MySQL技術(shù)

2016-03-16 10:56:12

數(shù)據(jù)營(yíng)銷數(shù)據(jù)分析LinkedIn
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)