mysql資料恢復
書接上文,把未刪除表資料也恢復出來:
http://blog.sina.com.cn/s/blog_5037eacb0102vq45.html
這裡沒有使用獨立表空間,使用獨立表空間也是一樣的道理。
只是多了一個 ./stream_parser .ibd檔案的過程。 然後在指定資料頁的時候 換一個.ibd的路徑。
[root@10-4-1-104 ]# ./c_parser -4f pages-ibdata1/FIL_PAGE_INDEX/0000000000000001.page -t dictionary/SYS_TABLES.sql |grep song1
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/tmp//dumps/default/SYS_TABLES' REPLACE INTO TABLE `SYS_TABLES` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'SYS_TABLES\t' (`NAME`, `ID`, `N_COLS`, `TYPE`, `MIX_ID`, `MIX_LEN`, `CLUSTER_NAME`, `SPACE`);
000000055333 A900000D7D0110 SYS_TABLES "song1/song1" 228 2 1 0 0 "" 0
--檢視228頁
[root@10-4-1-104 ]# ./c_parser -4f pages-ibdata1/FIL_PAGE_INDEX/0000000000000003.page -t dictionary/SYS_INDEXES.sql |grep 228
000000055333 A900000D7D014D SYS_INDEXES 228 423 "GEN\_CLUST\_INDEX" 0 1 0 630
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/tmp//dumps/default/SYS_INDEXES' REPLACE INTO TABLE `SYS_INDEXES` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'SYS_INDEXES\t' (`TABLE_ID`, `ID`, `NAME`, `N_FIELDS`, `TYPE`, `SPACE`, `PAGE_NO`);
000000055333 A900000D7D014D SYS_INDEXES 228 423 "GEN\_CLUST\_INDEX" 0 1 0 630
-- 主鍵索引在 423頁
--把上節得到的表定義語句放好
[root@10-4-1-104 ]# cd song1
[root@10-4-1-104 song1]# ll
total 4
-rw-r--r-- 1 root root 130 Jul 16 10:53 song1.sql
[root@10-4-1-104 song1]# cat song1.sql
CREATE TABLE `song1`(
`id` INT,
`name` VARCHAR(10) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci') ENGINE=InnoDB;
[root@10-4-1-104 song1]# cd ..
--抽資料。 如果是使用獨立表空間,這裡的資料頁路徑要換一換
[root@10-4-1-104 ]# ./c_parser -6f pages-ibdata1/FIL_PAGE_INDEX/0000000000000423.page -t song1/song1.sql > dumps/default/song1 2> dumps/default/song1_load.sql
[root@10-4-1-104 ]# cat dumps/default/song1
-- Page id: 630, Format: COMPACT, Records list: Valid, Expected records: (1 1)
000000000700 000000055334 AA00000D7E0110 song1 8 "song"
-- Page id: 630, Found records: 1, Lost records: NO, Leaf page: YES
-- Page id: 630, Format: COMPACT, Records list: Valid, Expected records: (0 0)
-- Page id: 630, Found records: 0, Lost records: NO, Leaf page: YES
-- Page id: 630, Format: COMPACT, Records list: Valid, Expected records: (1 1)
000000000700 000000055334 AA00000D7E0110 song1 8 "song"
-- Page id: 630, Found records: 1, Lost records: NO, Leaf page: YES
[root@10-4-1-104 ]# cat dumps/default/song1_load.sql
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/tmp//dumps/default/song1' REPLACE INTO TABLE `song1` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'song1\t' (`id`, `name`);
--準備把資料放到庫中
[root@10-4-1-104 ~]# mysql -u root -S /data/mysqld.sock -ptest --local-infile=1
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 27
Server version: 5.5.24-ucloudrel1-log Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| d1 |
| db_song_recover |
| mysql |
| performance_schema |
| song1 |
| song1_recover |
| t |
| test |
| ttt |
+--------------------+
10 rows in set (0.00 sec)
mysql> use song1_recover;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+-------------------------+
| Tables_in_song1_recover |
+-------------------------+
| sys_columns |
| sys_fields |
| sys_indexes |
| sys_tables |
+-------------------------+
4 rows in set (0.00 sec)
mysql> CREATE TABLE `song1`(
-> `id` INT,
-> `name` VARCHAR(10) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci') ENGINE=InnoDB;
Query OK, 0 rows affected (0.06 sec)
mysql> source /tmp//dumps/default/song1_load.sql
Query OK, 0 rows affected (0.00 sec)
Query OK, 2 rows affected (0.00 sec)
Records: 2 Deleted: 0 Skipped: 0 Warnings: 0
mysql> select * from song1;
+------+------+
| id | name |
+------+------+
| 8 | song |
| 8 | song |
+------+------+
2 rows in set (0.00 sec)
這裡取出來 兩條記錄, 看來沒有人為指定主鍵,還是有些問題。不過想資料回來,也是萬幸了。
轉載請註明源出處
QQ 273002188 歡迎一起學習
http://blog.sina.com.cn/s/blog_5037eacb0102vq45.html
這裡沒有使用獨立表空間,使用獨立表空間也是一樣的道理。
只是多了一個 ./stream_parser .ibd檔案的過程。 然後在指定資料頁的時候 換一個.ibd的路徑。
[root@10-4-1-104 ]# ./c_parser -4f pages-ibdata1/FIL_PAGE_INDEX/0000000000000001.page -t dictionary/SYS_TABLES.sql |grep song1
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/tmp//dumps/default/SYS_TABLES' REPLACE INTO TABLE `SYS_TABLES` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'SYS_TABLES\t' (`NAME`, `ID`, `N_COLS`, `TYPE`, `MIX_ID`, `MIX_LEN`, `CLUSTER_NAME`, `SPACE`);
000000055333 A900000D7D0110 SYS_TABLES "song1/song1" 228 2 1 0 0 "" 0
--檢視228頁
[root@10-4-1-104 ]# ./c_parser -4f pages-ibdata1/FIL_PAGE_INDEX/0000000000000003.page -t dictionary/SYS_INDEXES.sql |grep 228
000000055333 A900000D7D014D SYS_INDEXES 228 423 "GEN\_CLUST\_INDEX" 0 1 0 630
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/tmp//dumps/default/SYS_INDEXES' REPLACE INTO TABLE `SYS_INDEXES` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'SYS_INDEXES\t' (`TABLE_ID`, `ID`, `NAME`, `N_FIELDS`, `TYPE`, `SPACE`, `PAGE_NO`);
000000055333 A900000D7D014D SYS_INDEXES 228 423 "GEN\_CLUST\_INDEX" 0 1 0 630
-- 主鍵索引在 423頁
--把上節得到的表定義語句放好
[root@10-4-1-104 ]# cd song1
[root@10-4-1-104 song1]# ll
total 4
-rw-r--r-- 1 root root 130 Jul 16 10:53 song1.sql
[root@10-4-1-104 song1]# cat song1.sql
CREATE TABLE `song1`(
`id` INT,
`name` VARCHAR(10) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci') ENGINE=InnoDB;
[root@10-4-1-104 song1]# cd ..
--抽資料。 如果是使用獨立表空間,這裡的資料頁路徑要換一換
[root@10-4-1-104 ]# ./c_parser -6f pages-ibdata1/FIL_PAGE_INDEX/0000000000000423.page -t song1/song1.sql > dumps/default/song1 2> dumps/default/song1_load.sql
[root@10-4-1-104 ]# cat dumps/default/song1
-- Page id: 630, Format: COMPACT, Records list: Valid, Expected records: (1 1)
000000000700 000000055334 AA00000D7E0110 song1 8 "song"
-- Page id: 630, Found records: 1, Lost records: NO, Leaf page: YES
-- Page id: 630, Format: COMPACT, Records list: Valid, Expected records: (0 0)
-- Page id: 630, Found records: 0, Lost records: NO, Leaf page: YES
-- Page id: 630, Format: COMPACT, Records list: Valid, Expected records: (1 1)
000000000700 000000055334 AA00000D7E0110 song1 8 "song"
-- Page id: 630, Found records: 1, Lost records: NO, Leaf page: YES
[root@10-4-1-104 ]# cat dumps/default/song1_load.sql
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/tmp//dumps/default/song1' REPLACE INTO TABLE `song1` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'song1\t' (`id`, `name`);
--準備把資料放到庫中
[root@10-4-1-104 ~]# mysql -u root -S /data/mysqld.sock -ptest --local-infile=1
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 27
Server version: 5.5.24-ucloudrel1-log Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| d1 |
| db_song_recover |
| mysql |
| performance_schema |
| song1 |
| song1_recover |
| t |
| test |
| ttt |
+--------------------+
10 rows in set (0.00 sec)
mysql> use song1_recover;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+-------------------------+
| Tables_in_song1_recover |
+-------------------------+
| sys_columns |
| sys_fields |
| sys_indexes |
| sys_tables |
+-------------------------+
4 rows in set (0.00 sec)
mysql> CREATE TABLE `song1`(
-> `id` INT,
-> `name` VARCHAR(10) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci') ENGINE=InnoDB;
Query OK, 0 rows affected (0.06 sec)
mysql> source /tmp//dumps/default/song1_load.sql
Query OK, 0 rows affected (0.00 sec)
Query OK, 2 rows affected (0.00 sec)
Records: 2 Deleted: 0 Skipped: 0 Warnings: 0
mysql> select * from song1;
+------+------+
| id | name |
+------+------+
| 8 | song |
| 8 | song |
+------+------+
2 rows in set (0.00 sec)
這裡取出來 兩條記錄, 看來沒有人為指定主鍵,還是有些問題。不過想資料回來,也是萬幸了。
轉載請註明源出處
QQ 273002188 歡迎一起學習
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25099483/viewspace-1735940/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 寶塔資料庫恢復 mysql資料庫丟失恢復 mysql資料庫刪除庫恢復 寶塔mysql資料庫恢復資料庫MySql
- MySQL資料庫的恢復MySql資料庫
- mysql誤刪資料恢復MySql資料恢復
- MySQL 資料庫增量資料恢復案例MySql資料庫資料恢復
- 【資料庫資料恢復】linux系統下MYSQL資料庫資料恢復案例資料庫資料恢復LinuxMySql
- Mysql資料備份與恢復MySql
- 使用innobackupex恢復mysql資料庫MySql資料庫
- 恢復資料,資料塊恢復
- 資料恢復:AMDU資料抽取恢復資料恢復
- MySQL資料庫遷移與MySQL資料庫批量恢復MySql資料庫
- MySQL 通過 binlog 恢復資料MySql
- MySQL 透過 binlog 恢復資料MySql
- Oracle & MySQL & PostgreSQL資料庫恢復支援OracleMySql資料庫
- Mysql 誤刪資料進行恢復MySql
- 【資料庫資料恢復】華為雲ECS網站伺服器mysql資料庫資料恢復案例資料庫資料恢復網站伺服器MySql
- 【資料庫資料恢復】EXT3檔案系統下MYSQL資料庫恢復案例資料庫資料恢復MySql
- 伺服器資料恢復-誤操作導致mysql資料庫資料丟失的資料恢復案例伺服器資料恢復MySql資料庫
- 資料庫資料恢復—無備份,binlog未開啟的Mysql資料庫資料恢復案例資料庫資料恢復MySql
- 【資料庫資料恢復】SAP資料庫資料恢復案例資料庫資料恢復
- Mysql效能壓測、Binlog恢復資料MySql
- 利用binlog日誌恢復mysql資料MySql
- 【Mysql】如何透過binlog恢復資料MySql
- MySQL誤操作後如何快速恢復資料MySql
- MySQL重做日誌恢復資料的流程MySql
- 通過binlog恢復mysql資料庫MySql資料庫
- mysql使用binlog進行資料恢復MySql資料恢復
- mysql的資料庫備份與恢復MySql資料庫
- MySQL--binlog日誌恢復資料MySql
- 伺服器資料恢復—雲伺服器mysql資料庫表資料被delete的資料恢復案例伺服器資料恢復MySql資料庫delete
- 【北亞資料庫資料恢復】誤操作導致資料丟失的華為雲mysql資料恢復案例資料庫資料恢復MySql
- 【資料庫資料恢復】透過恢復NDF檔案修復資料庫的資料恢復過程資料庫資料恢復
- 【資料庫資料恢復】Sql Server資料庫資料恢復案例資料庫資料恢復SQLServer
- 【Vsan資料恢復】Vsan資料恢復案例資料恢復
- Vsan資料恢復—Vsan資料恢復案例資料恢復
- 【北亞資料庫資料恢復】使用delete未加where子句刪除全表資料的Mysql資料庫資料恢復資料庫資料恢復deleteMySql
- Sybase ASE資料庫恢復,Sybase資料恢復,資料誤刪除恢復工具READSYBDEVICE資料庫資料恢復dev
- Mysql資料庫delete刪除後資料恢復報告MySql資料庫delete資料恢復
- 使用Mysqldump備份和恢復MySQL資料庫MySql資料庫