您好,登錄后才能下訂單哦!
查到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.利用進程pid查看對應的文件描述符
[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就是我們要恢復的文件
3、關閉前端業務或執行flush tables with read lock; 不讓有數據寫入
4、驗證有沒有數據寫入
a.先輸入下面命令,讓臟頁盡快寫入到磁盤里
set global innodb_max_dirty_pages_ptc=0;
b.查看binlog日志寫入情況,確保file和position沒有變化 show master status;
c.最后查看innodb狀態信息,確保臟頁已刷入到磁盤中
show engine inndodb status\G
TRANSACTIONS
...........
trx id counter A21837
Purge don for trx's n:o<A21837 undo n:o<0
##確保后臺purge進程把undo log全部清除掉,事務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個值不在變化
BUFFER POOL AND MEMORY
............
Modified db pages 0
##確保臟頁數量為0
ROW OPERATIONS
..................
0.00 inserts/s,0.00 updates/s,0.00 deletes/s,0.00 reads/s
#確保插入、更新、刪除為0
5.恢復操作
[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
將上面文件復制并改名:
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
授權:
cd /mysql/server/data
chown -R mysql:dba ib*
最后重啟mysql
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。