查到mysqld的pid
[mysql@mvxl0782 binlog]$ netstat -nltp|grep mysqld
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 :::3306 :::* LISTEN 18401/mysqld
這里18401
2.利用進(jìn)程pid查看對(duì)應(yīng)的文件描述符
[mysql@mvxl0782 binlog]$ ll /proc/18401/fd|egrep 'ib_|ibdata'
lrwx------ 1 mysql mysql 64 8月 11 10:33 10 -> /mysql/server/data/ib_logfile1
lrwx------ 1 mysql mysql 64 8月 11 10:33 11 -> /mysql/server/data/ib_logfile2
lrwx------ 1 mysql mysql 64 8月 11 10:33 4 -> /mysql/server/data/ibdata1
lrwx------ 1 mysql mysql 64 8月 11 10:33 9 -> /mysql/server/data/ib_logfile0
上面的10、11、4和9就是我們要恢復(fù)的文件
3、關(guān)閉前端業(yè)務(wù)或執(zhí)行flush tables with read lock; 不讓有數(shù)據(jù)寫入
4、驗(yàn)證有沒有數(shù)據(jù)寫入
a.先輸入下面命令,讓臟頁(yè)盡快寫入到磁盤里
set global innodb_max_dirty_pages_ptc=0;
b.查看binlog日志寫入情況,確保file和position沒有變化 show master status;
c.最后查看innodb狀態(tài)信息,確保臟頁(yè)已刷入到磁盤中
show engine inndodb status\G
TRANSACTIONS
...........
trx id counter A21837
Purge don for trx's n:o<A21837 undo n:o<0
##確保后臺(tái)purge進(jìn)程把undo log全部清除掉,事務(wù)ID要一致
INSERT BUFFER AND ADAPTIVE HASH INDEX
Ibuf:size 1,free kust keb 65,seg size67,0 merges
##插入buffer合并插入緩存等于1
LOG
Log sequence number xxxx
Log flushed up to xxxx
Last checkpoint at xxx
##確保這3個(gè)值不在變化
BUFFER POOL AND MEMORY
............
Modified db pages 0
##確保臟頁(yè)數(shù)量為0
ROW OPERATIONS
..................
0.00 inserts/s,0.00 updates/s,0.00 deletes/s,0.00 reads/s
#確保插入、更新、刪除為0
5.恢復(fù)操作
[mysql@mvxl0782 binlog]$ ll /proc/18401/fd|egrep 'ib_|ibdata'
lrwx------ 1 mysql mysql 64 8月 11 10:33 10 -> /mysql/server/data/ib_logfile1
lrwx------ 1 mysql mysql 64 8月 11 10:33 11 -> /mysql/server/data/ib_logfile2
lrwx------ 1 mysql mysql 64 8月 11 10:33 4 -> /mysql/server/data/ibdata1
lrwx------ 1 mysql mysql 64 8月 11 10:33 9 -> /mysql/server/data/ib_logfile0
將上面文件復(fù)制并改名:
cp 10 /mysql/server/data/ib_logfile1
cp 11 /mysql/server/data/ib_logfile2
cp 4 /mysql/server/data/ibdata1
cp 9 /mysql/server/data/ib_logfile0
授權(quán):
cd /mysql/server/data
chown -R mysql:dba ib*
最后重啟mysql
分享標(biāo)題:mysqlibdata文件誤刪除恢復(fù)-創(chuàng)新互聯(lián)
轉(zhuǎn)載來(lái)于:http://jinyejixie.com/article40/dpeseo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設(shè)、ChatGPT、動(dòng)態(tài)網(wǎng)站、網(wǎng)站排名、品牌網(wǎng)站制作、用戶體驗(yàn)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容