From 4aeb18b7d8835a4498c71498f093657dbb81d796 Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Mon, 9 Sep 2013 00:51:36 +0200 Subject: [PATCH] Added script to show InnoDB file_per_table files. --- db-inno-files.php | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 db-inno-files.php diff --git a/db-inno-files.php b/db-inno-files.php new file mode 100755 index 0000000..db03034 --- /dev/null +++ b/db-inno-files.php @@ -0,0 +1,48 @@ +#!/usr/bin/php +prepare($sql); +echo '.'; + +$stmt->execute(); +echo '.'; + +$data = $stmt->fetchAll(PDO::FETCH_ASSOC); +echo ' OK' . PHP_EOL; + +$tbl_file = 0; +$tbl_ibdt = 0; +foreach ($data as $table) { + $filename = $mysql_dir . DIRECTORY_SEPARATOR . encode_filename($table['table_schema']) . DIRECTORY_SEPARATOR . encode_filename($table['table_name']) . '.ibd'; + if (!file_exists($filename)) { + $tbl_ibdt++; + echo 'ibdata: ' . $table['table_schema'] . '.' . $table['table_name'] . PHP_EOL; + } else { + $tbl_file++; + } +} + +echo 'innodb_file_per_table : ' . $tbl_file . PHP_EOL; +echo 'Tables in ibdata1 file: ' . $tbl_ibdt . PHP_EOL; + + +function encode_filename($filename) +{ + $filename = str_replace('.', '@002e', $filename); + return $filename; +}