Table Maintenance Statements
1163
By default, the server writes
ANALYZE 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
.
13.7.2.2.
BACKUP TABLE
Syntax
BACKUP TABLE
tbl_name
[,
tbl_name
] ... TO '
/path/to/backup/directory
'
Note
This statement is deprecated and is removed in MySQL 5.5. As an alternative,
mysqldump
or
mysqlhotcopy
can be used instead.
BACKUP TABLE
copies to the backup directory the minimum number of table files needed to restore
the table, after flushing any buffered changes to disk. The statement works only for
MyISAM
tables. It
copies the
.frm
definition and
.MYD
data files. The
.MYI
index file can be rebuilt from those two files.
The directory should be specified as a full path name. To restore the table, use
RESTORE TABLE
.
During the backup, a read lock is held for each table, one at time, as they are being backed up. If you
want to back up several tables as a snapshot (preventing any of them from being changed during the
backup operation), issue a
LOCK TABLES
statement first, to obtain a read lock for all tables in the
group.
BACKUP TABLE
returns a result set with the following columns.
Column
Value
Table
The table name
Op
Always
backup
Msg_type
status
,
error
,
info
,
note
, or
warning
Msg_text
An informational message
13.7.2.3.
CHECK TABLE
Syntax
CHECK TABLE
tbl_name
[,
tbl_name
] ... [
option
] ...
option
= {FOR UPGRADE | QUICK | FAST | MEDIUM | EXTENDED | CHANGED}
CHECK TABLE
checks a table or tables for errors.
CHECK TABLE
works for
MyISAM
,
InnoDB
, and (as
of MySQL 5.0.16)
ARCHIVE
tables. For
MyISAM
tables, the key statistics are updated as well.
As of MySQL 5.0.2,
CHECK TABLE
can also check views for problems, such as tables that are
referenced in the view definition that no longer exist.
CHECK TABLE
returns a result set with the following columns.
Column
Value
Table
The table name
Op
Always
check
Msg_type
status
,
error
,
info
,
note
, or
warning
Msg_text
An informational message
Note that the statement might produce many rows of information for each checked table. The last row
has a
Msg_type
value of
status
and the
Msg_text
normally should be
OK
. If you don't get
OK
, or
Table is already up to date
you should normally run a repair of the table. See
Section 7.6,
“
MyISAM
Table Maintenance and Crash Recovery”
.
Table is already up to date
means that
the storage engine for the table indicated that there was no need to check the table.
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 ...