Table Maintenance Statements
1168
in the
.MYI
unavailable to the repair process, which can have deleterious
consequences:
• The current
AUTO_INCREMENT
value is lost.
• The link to deleted records in the table is lost, which means that free space
for deleted records will remain unoccupied thereafter.
• The
.MYI
header indicates whether the table is compressed. If the server
ignores this information, it cannot tell that a table is compressed and repair
can cause change or loss of table contents. This means that
USE_FRM
should
not be used with compressed tables. That should not be necessary, anyway:
Compressed tables are read only, so they should not become corrupt.
Caution
As of MySQL 5.0.62, if you use
USE_FRM
for a table that was created by a
different version of the MySQL server than the one you are currently running,
REPAIR TABLE
will not attempt to repair the table. In this case, the result set
returned by
REPAIR TABLE
contains a line with a
Msg_type
value of
error
and a
Msg_text
value of
Failed repairing incompatible .FRM file
.
Prior to MySQL 5.0.62, do not use
USE_FRM
if your table was created by a
different version of the MySQL server. Doing so risks the loss of all rows in the
table. It is particularly dangerous to use
USE_FRM
after the server returns this
message:
Table upgrade required. Please do
"REPAIR TABLE `
tbl_name
`" to fix it!
If
USE_FRM
is not used,
REPAIR TABLE
checks the table to see whether an upgrade is required. If
so, it performs the upgrade, following the same rules as
CHECK TABLE ... FOR UPGRADE
. See
Section 13.7.2.3, “
CHECK TABLE
Syntax”
, for more information. As of MySQL 5.0.62,
REPAIR TABLE
without
USE_FRM
upgrades the
.frm
file to the current version.
By default, the server writes
REPAIR TABLE
statements to the binary log so that they replicate to
replication slaves. To suppress logging, use the optional
NO_WRITE_TO_BINLOG
keyword or its alias
LOCAL
.
Important
In the event that a table on the master becomes corrupted and you run
REPAIR
TABLE
on it, any resulting changes to the original table are not propagated to
slaves.
You may be able to increase
REPAIR TABLE
performance by setting certain system variables. See
Section 8.3.2.4, “Speed of
REPAIR TABLE
Statements”
.
13.7.2.7.
RESTORE TABLE
Syntax
RESTORE TABLE
tbl_name
[,
tbl_name
] ... FROM '
/path/to/backup/directory
'
Note
This statement is deprecated and is removed in MySQL 5.5.
RESTORE TABLE
restores the table or tables from a backup that was made with
BACKUP TABLE
. The
directory should be specified as a full path name.
Existing tables are not overwritten; if you try to restore over an existing table, an error occurs. Just as
for
BACKUP TABLE
,
RESTORE TABLE
currently works only for
MyISAM
tables. Restored tables are not
replicated from master to slave.
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...