用Python 脚本查看MySQL表空间中页的汇总情况

用Python 脚本查看MySQL表空间中页的汇总情况

下载脚本

Python脚本下载地址

登录MySQL将脏页刷盘

如果不要求是最新的数据页,也可以跳过此步

Database changed
mysql> flush table orders;
Query OK, 0 rows affected (0.03 sec)

用python 命令执行python脚本文件

可以输入innodb的文件路径,也可以输入目录路径

root@localhost:/home/mysql/python# python3 py_innodb_page_info.py
请输入innodb文件的路径或者所在目录:/home/mysql/data/mysqldata1/mydata/okex

结果如下:

----------------------------------------------------------------------------------------------------
|                                            orders.ibd                                            |
----------------------------------------------------------------------------------------------------
| type                      | level |   prev   |  offset  |   next   |       lsn        | checksum |
| File Space Header         | 0000  | 000138a3 | 00000000 | 00000001 | 000000007512a88d | 1608b4c3 |
| Insert Buffer Bitmap      | 0000  | 00000000 | 00000001 | 00000000 | 00000000750d1b17 | a1690ae9 |
| File Segment inode        | 0000  | 00000000 | 00000002 | 00000000 | 000000007512a88d | 40e4f813 |
| Tablespace SDI index Page | 0000  | ffffffff | 00000003 | ffffffff | 0000000074eb0886 | a76286aa |
| B-tree Node               | 0001  | ffffffff | 00000004 | ffffffff | 000000007512a88d | af65c135 |
| B-tree Node               | 0001  | ffffffff | 00000005 | ffffffff | 00000000750d1b17 | c9ddd99f |
| B-tree Node               | 0000  | ffffffff | 00000006 | 00000007 | 0000000074ebfa21 | fc198af7 |
| B-tree Node               | 0000  | 00000006 | 00000007 | 00000008 | 0000000074ec57a7 | 23b46a35 |
| B-tree Node               | 0000  | 00000007 | 00000008 | 00000009 | 0000000074ecb5bc | 343bf92d |
| B-tree Node               | 0000  | 00000008 | 00000009 | 0000000a | 0000000074ed13dd | 0f9e4e58 |
| B-tree Node               | 0000  | 00000009 | 0000000a | 0000000b | 0000000074ed7288 | 88ebf2fa |
| B-tree Node               | 0000  | 0000000a | 0000000b | 0000000c | 0000000074edd226 | 5528cedc |
| B-tree Node               | 0000  | 0000000b | 0000000c | 0000000d | 0000000074ee320f | e4fab741 |
| B-tree Node               | 0000  | 0000000c | 0000000d | 0000000e | 0000000074ee9305 | 75561edd |
| B-tree Node               | 0000  | 0000000d | 0000000e | 0000000f | 0000000074eef2c3 | fec7b09b |
| B-tree Node               | 0000  | 0000000e | 0000000f | 00000010 | 0000000074ef52a6 | 234a7e8a |
| B-tree Node               | 0000  | 0000000f | 00000010 | 00000011 | 0000000074efb2d6 | 500ed4c7 |
| B-tree Node               | 0000  | 00000010 | 00000011 | 00000012 | 0000000074f011b3 | 653b7e49 |
| B-tree Node               | 0000  | 00000011 | 00000012 | 00000013 | 0000000074f0e2ab | 10fa3da0 |
| B-tree Node               | 0000  | 00000012 | 00000013 | 00000016 | 0000000074f142b9 | fe41ff5a |
| B-tree Node               | 0000  | 00000025 | 00000014 | 00000015 | 00000000750dad4d | 70cbf94a |
| B-tree Node               | 0000  | 00000014 | 00000015 | 00000020 | 0000000075129e81 | dc09a96f |
| B-tree Node               | 0000  | 00000013 | 00000016 | 00000017 | 0000000074f1a20e | fe20433a |
| B-tree Node               | 0000  | 00000016 | 00000017 | 00000018 | 0000000074f20128 | efcc8a4e |
| B-tree Node               | 0000  | 00000017 | 00000018 | 00000019 | 0000000074f260e0 | 120d2131 |
| B-tree Node               | 0000  | 00000018 | 00000019 | 0000001a | 0000000074f2bff6 | cb504b12 |
| B-tree Node               | 0000  | 00000019 | 0000001a | 0000001b | 0000000074f31f4b | 0ead695f |
| B-tree Node               | 0000  | 0000001a | 0000001b | 0000001c | 0000000074f37e86 | b083a8b1 |
| B-tree Node               | 0000  | 0000001b | 0000001c | 0000001d | 0000000074f3df08 | cae34e0c |
| B-tree Node               | 0000  | 0000001c | 0000001d | 00000021 | 000000007501e1de | 7f66a4d4 |
| B-tree Node               | 0000  | 00000028 | 0000001e | 00000029 | 000000007512a88d | 0e284e65 |
| B-tree Node               | 0000  | 00000020 | 0000001f | ffffffff | 00000000750eef50 | 4f67a52a |
| B-tree Node               | 0000  | 00000015 | 00000020 | 0000001f | 00000000751018cd | 3779bb0d |
| B-tree Node               | 0000  | 0000001d | 00000021 | 00000022 | 000000007503796d | c1d1d323 |
| B-tree Node               | 0000  | 00000021 | 00000022 | 00000023 | 00000000750ad855 | 730a5d95 |
| B-tree Node               | 0000  | 00000022 | 00000023 | 00000024 | 00000000750cac12 | 02bce45a |
| B-tree Node               | 0000  | 00000023 | 00000024 | 00000026 | 00000000750d2dd3 | 968b8dbb |
| B-tree Node               | 0000  | ffffffff | 00000025 | 00000014 | 000000007512adf9 | 7d3697af |
| B-tree Node               | 0000  | 00000024 | 00000026 | 00000027 | 00000000750e452f | 1c2190bf |
| B-tree Node               | 0000  | 00000026 | 00000027 | 00000028 | 00000000751001fa | d6edb78a |
| B-tree Node               | 0000  | 00000027 | 00000028 | 0000001e | 000000007512a88d | ea8941fd |
| B-tree Node               | 0000  | 0000001e | 00000029 | ffffffff | 000000007512add0 | 6a1bc15a |
| Freshly Allocated Page    | 0000  | 00000000 | 00000000 | 00000000 | 0000000000000000 | 00000000 |
----------------------------------------------------------------------------------------------------
|     Total number of page: 43      |
-------------------------------------
| File Space Header         |   1   |
| Insert Buffer Bitmap      |   1   |
| File Segment inode        |   1   |
| Tablespace SDI index Page |   1   |
| B-tree Node               |  38   |
| Freshly Allocated Page    |   1   |
-------------------------------------

  • 10
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

marc2719

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值