Here we are going to share a SQL query to find the table name based on the space id logged inside the error log.
Suppose We have some below error logged inside the error log file.
2021-01-01 10:32:01 4 [ERROR] InnoDB: page [page id: space=107, page number=47347] (920 records, index id 32519).
From above error log, we can find the table name using the “space=107“.
select SPACE,NAME from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES where SPACE='107';
+-------+--------------+
| SPACE | NAME |
+-------+--------------+
| 107 | test/schools |
+-------+--------------+
1 row in set (0.00 sec)