Adding, Removing, or Resizing
InnoDB
Data and Log Files
1260
when it runs out of space. The increment size can be changed by setting the value of the
innodb_autoextend_increment
[1237]
system variable, which is measured in MB.
Alternatively, you can increase the size of your tablespace by adding another data file. To do this, you
have to shut down the MySQL server, change the tablespace configuration to add a new data file to the
end of
innodb_data_file_path
[1240]
, and start the server again.
If your last data file was defined with the keyword
autoextend
, the procedure for reconfiguring the
tablespace must take into account the size to which the last data file has grown. Obtain the size of
the data file, round it down to the closest multiple of 1024 × 1024 bytes (= 1MB), and specify the
rounded size explicitly in
innodb_data_file_path
[1240]
. Then you can add another data file.
Remember that only the last data file in the
innodb_data_file_path
[1240]
can be specified as
auto-extending.
As an example, assume that the tablespace has just one auto-extending data file
ibdata1
:
innodb_data_home_dir =
innodb_data_file_path = /ibdata/ibdata1:10M:autoextend
Suppose that this data file, over time, has grown to 988MB. Here is the configuration line after
modifying the original data file to not be auto-extending and adding another auto-extending data file:
innodb_data_home_dir =
innodb_data_file_path = /ibdata/ibdata1:988M;/disk2/ibdata2:50M:autoextend
When you add a new file to the tablespace configuration, make sure that it does not exist.
InnoDB
will
create and initialize the file when you restart the server.
Currently, you cannot remove a data file from the tablespace. To decrease the size of your tablespace,
use this procedure:
1. Use
mysqldump
to dump all your
InnoDB
tables.
2. Stop the server.
3. Remove all the existing tablespace files, including the
ibdata
and
ib_log
files. If you want to
keep a backup copy of the information, then copy all the
ib*
files to another location before the
removing the files in your MySQL installation.
4. Remove any
.frm
files for
InnoDB
tables.
5. Configure a new tablespace.
6. Restart the server.
7. Import the dump files.
If you want to change the number or the size of your
InnoDB
log files, use the following instructions.
The procedure to use depends on the value of
innodb_fast_shutdown
[1241]
:
• If
innodb_fast_shutdown
[1241]
is not set to 2: Stop the MySQL server and make sure that
it shuts down without errors (to ensure that there is no information for outstanding transactions in
the log). Copy the old log files into a safe place in case something went wrong during the shutdown
and you need them to recover the tablespace. Delete the old log files from the log file directory, edit
my.cnf
to change the log file configuration, and start the MySQL server again.
mysqld
sees that no
InnoDB
log files exist at startup and creates new ones.
• If
innodb_fast_shutdown
[1241]
is set to 2: Set
innodb_fast_shutdown
[1241]
to 1:
mysql>
SET GLOBAL innodb_fast_shutdown = 1;
Then follow the instructions in the previous item.
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...