ALTER TABLESPACEtablespace_name{ADD|DROP} DATAFILE 'file_name' [INITIAL_SIZE [=]size] [WAIT] ENGINE [=]engine_name
This statement can be used either to add a new data file to or drop a data file from a tablespace.
The ADD DATAFILE variant allows you to specify
an initial size using an INITIAL_SIZE clause,
where size is measured in bytes; the
default value is 128M (128 megabytes). You may
optionally follow this integer value with a one-letter
abbreviation for an order of magnitude, similar to those used in
my.cnf. Generally, this is one of the letters
M (for megabytes) or G (for
gigabytes).
Once a data file has been created, its size cannot be changed;
however, you can add more data files to the tablespace using
additional ALTER TABLESPACE ... ADD DATAFILE
statements.
Using DROP DATAFILE with ALTER
TABLESPACE drops the data file
'file_name' from the tablespace. This
file must already have been added to the tablespace using
CREATE TABLESPACE or ALTER
TABLESPACE; otherwise an error will result.
Both ALTER TABLESPACE ... ADD DATAFILE and
ALTER TABLESPACE ... DROP DATAFILE require an
ENGINE clause which specifies the storage
engine used by the tablespace. The only accepted values for
engine_name are NDB
and NDBCLUSTER.
WAIT is parsed but otherwise ignored, and so
has no effect in MySQL 6.0. It is intended for future
expansion.
When ALTER TABLESPACE ... ADD DATAFILE is used
with ENGINE = NDB, a data file is created on
each Cluster data node. You can verify that the data files were
created and obtain information about them by querying the
INFORMATION_SCHEMA.FILES table. For example,
the following query shows all data files belonging to the
tablespace named newts:
mysql>SELECT LOGFILE_GROUP_NAME, FILE_NAME, EXTRA->FROM INFORMATION_SCHEMA.FILES->WHERE TABLESPACE_NAME = 'newts' AND FILE_TYPE = 'DATAFILE';+--------------------+--------------+----------------+ | LOGFILE_GROUP_NAME | FILE_NAME | EXTRA | +--------------------+--------------+----------------+ | lg_3 | newdata.dat | CLUSTER_NODE=3 | | lg_3 | newdata.dat | CLUSTER_NODE=4 | | lg_3 | newdata2.dat | CLUSTER_NODE=3 | | lg_3 | newdata2.dat | CLUSTER_NODE=4 | +--------------------+--------------+----------------+ 2 rows in set (0.03 sec)
See Section 26.21, “The INFORMATION_SCHEMA FILES Table”.
For more information on using ALTER TABLESPACE
with Disk Data storage for MySQL Cluster, see
MySQL Cluster Disk Data Tables. For information on
using ALTER TABLESPACE with Falcon, see
Section 13.7.4, “Creating Tables and Indexes within Falcon”.

User Comments
Add your own comment.