久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

MySQL中怎么找回用戶數(shù)據(jù)

164次閱讀
沒有評論

共計 2934 個字符,預(yù)計需要花費(fèi) 8 分鐘才能閱讀完成。

本篇文章給大家分享的是有關(guān) MySQL 中怎么找回用戶數(shù)據(jù),丸趣 TV 小編覺得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著丸趣 TV 小編一起來看看吧。

解決過程

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

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

3、通過分析文件修改時間,得知刪除操作的動作在 mysql-bin.000014 文件里面記錄。

4、因為日志文件是二進(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 的動作在 127766 行 (雖然日志記錄行數(shù)比較多,但是刪除用戶的動作比較少,所以好排查)

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

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

update flow_fr_borrow set user_id =  e76cb8bccaf74f32b94d17f74437xxxx  where user_id =  66adfd032ccf428d9e20e864f729xxxx  update flow_fr_cost set user_id =  e76cb8bccaf74f32b94d17f74437xxxx  where user_id =  66adfd032ccf428d9e20e864f729xxxx  update flow_fr_fixedasset set user_id =  e76cb8bccaf74f32b94d17f74437xxxx  where user_id =  66adfd032ccf428d9e20e864f729xxxx  update flow_fr_house_lease set user_id =  e76cb8bccaf74f32b94d17f74437xxxx  where user_id =  66adfd032ccf428d9e20e864f729xxxx  update flow_fr_purchase set user_id =  e76cb8bccaf74f32b94d17f74437xxxx  where user_id =  66adfd032ccf428d9e20e864f729xxxx  update flow_fr_travel set user_id =  e76cb8bccaf74f32b94d17f74437xxxx  where user_id =  66adfd032ccf428d9e20e864f729xxxx  update flow_hr_positive set user_id =  e76cb8bccaf74f32b94d17f74437xxxx  where user_id =  66adfd032ccf428d9e20e864f729xxxx  update flow_pr_equip_borrow_sale set user_id =  e76cb8bccaf74f32b94d17f74437xxxx  where user_id =  66adfd032ccf428d9e20e864f729xxxx  update flow_pr_equip_return set user_id =  e76cb8bccaf74f32b94d17f74437xxxx  where user_id =  66adfd032ccf428d9e20e864f729xxxx  update flow_sa_tepe set user_id =  e76cb8bccaf74f32b94d17f74437xxxx  where user_id =  66adfd032ccf428d9e20e864f729xxxx  update flow_sa_safore set user_id =  e76cb8bccaf74f32b94d17f74437xxxx  where user_id =  66adfd032ccf428d9e20e864f729xxxx  update flow_sa_authorize set user_id =  e76cb8bccaf74f32b94d17f74437xxxx  where user_id =  66adfd032ccf428d9e20e864f729xxxx  update flow_sa_business set user_id =  e76cb8bccaf74f32b94d17f74437xxxx  where user_id =  66adfd032ccf428d9e20e864f729xxxx  update flow_hr_trial set sel_user_id =  e76cb8bccaf74f32b94d17f74437xxxx  where sel_user_id =  66adfd032ccf428d9e20e864f729xxxx  ; update wf_hist_order set creator =  e76cb8bccaf74f32b94d17f74437xxxx  where creator =  66adfd032ccf428d9e20e864f729xxxx  update wf_hist_task set operator =  e76cb8bccaf74f32b94d17f74437xxxx  where operator =  66adfd032ccf428d9e20e864f729xxxx  update wf_order set creator =  e76cb8bccaf74f32b94d17f74437xxxx  where creator =  66adfd032ccf428d9e20e864f729xxxx  update wf_hist_task_actor set actor_Id =  e76cb8bccaf74f32b94d17f74437xxxx  where actor_Id =  66adfd032ccf428d9e20e864f729xxxx

以上就是 MySQL 中怎么找回用戶數(shù)據(jù),丸趣 TV 小編相信有部分知識點(diǎn)可能是我們?nèi)粘9ぷ鲿姷交蛴玫降摹OM隳芡ㄟ^這篇文章學(xué)到更多知識。更多詳情敬請關(guān)注丸趣 TV 行業(yè)資訊頻道。

正文完
 
丸趣
版權(quán)聲明:本站原創(chuàng)文章,由 丸趣 2023-08-03發(fā)表,共計2934字。
轉(zhuǎn)載說明:除特殊說明外本站除技術(shù)相關(guān)以外文章皆由網(wǎng)絡(luò)搜集發(fā)布,轉(zhuǎn)載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 乌苏市| 靖安县| 佳木斯市| 监利县| 襄樊市| 东明县| 海盐县| 柳江县| 马鞍山市| 建瓯市| 六枝特区| 克什克腾旗| 若羌县| 菏泽市| 开江县| 庄河市| 西吉县| 东阿县| 余庆县| 天气| 滦平县| 蕲春县| 孝感市| 墨竹工卡县| 扎鲁特旗| 汝阳县| 潜江市| 郑州市| 余姚市| 彭泽县| 海门市| 洪洞县| 武定县| 江川县| 阳东县| 唐山市| 遂宁市| 新昌县| 清镇市| 交口县| 石城县|