The ‘allplicationdb’ is using innoDB and consuming a large amount of file system space.
You have a /backup partition available on NFS where backups are stored. You investigate
and gather the following information: [mysqld] Datadir=/var/lib/mysql/
Innodb_file_per_table=0 Three tables are stored in the innoDB shared tablespace and the
details are as follows: The table data_current has 1,000,000 rows. The table data_reports
has 1,500,000 rows. The table data_archive has 4,500,000 rows. Shell> is -1 /var/lib/mysql/
-rw-rw—- 1 mysql mysql 744G Aug 26 14:34 ibdata1 -rw-rw—- 1 mysql mysql 480M Aug 26
14:34 ib_logfile0 -rw-rw—- 1 mysql mysql 480M Aug 26 14:34 ib_logfile1 … You attempt to
free space from ibdata1 by taking a mysqldump of the data_archive table and storting it on
your backup partition. Shell> mysqldump – u root – p applicationdb data_archive >
/backup/data_archive.sql Mysql> DROP TABLE data_archive; Which set of actions will
allow you to free disk space back to the file system?
A.
Execute OPTIMIZE TABLE so that the InnoDB engine frees unused pages on disk back
to the file system: Mysql> OPTIMIZE TABLE data_current, data_reports;
B.
Set the server to use its own tablespace, and then alter the table so that data is moved
from the shared tablespace to its own: Mysql> SET GLOBAL innodb_file_per_table=1;
Mysql> ALTER TABLE data_current ENGINE=InnoDB; Mysql> ALTER TABLE data_repors
ENGINE=InnoDB;
C.
Take a backup, stop the server, remove the data files, and restore the backup: Shell>
mysqldump – u root –p applicationdb / > /backup/applicationdb.sql Shell> /etc/init.d/mysql
stop Shell> cd /var/lib/mysql/ Shell> rm ibdata1 ib_logfile0 ib_logfile1 Shell> /etc/init.d/mysql
start Shell> mysql – u root – p applicationdb < /backup/applicationdb.sql
D.
Enable compression on the table, causing InnoDB to release unused pages on disk to
the file system: Mysql> SET GLOBLE innodb_file_per_table=1; Mysql> SET GLOBLE
innodb_file_format=Barramcuda; Mysql> ALTER TABLE data_current
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; Mysql> ALTER TABLE
data_history ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
C
c