10月9号
What two statements are true regarding FLUSH TABLES FOR EXPORT?
A. It is the safest way to extract tables from the shared tablespace.
B. Partitioned tables are not supported.
C. It can be used to export TEMPORARY tables.
D. Table only exports when the table has its own tablespace.
E. The InnoDB Storage engine must be used for the table being exported.
解析:
官网原文:
The FLUSH TABLES ... FOR EXPORT
statement requires that you have the SELECT
privilege for each table. Because this statement acquires table locks, you must also have the LOCK TABLES
privilege for each table, in addition to the RELOAD
privilege that is required to use any FLUSH
statement.
This statement applies only to existing base (non-TEMPORARY
) tables. If a name refers to a base table, that table is used. If it refers to a TEMPORARY
table, it is ignored. If a name applies to a view, an ER_WRONG_OBJECT
error occurs. Otherwise, an ER_NO_SUCH_TABLE
error occurs.
InnoDB
supports FOR EXPORT
for tables that have their own .ibd
file file (that is, tables created with the innodb_file_per_table
setting enabled). InnoDB
ensures when notified by the FOR EXPORT
statement that any changes have been flushed to disk. This permits a binary copy of table contents to be made while the FOR EXPORT
statement is in effect because the .ibd
file is transaction consistent and can be copied while the server is running. FOR EXPORT
does not apply to InnoDB
system tablespace files, or to InnoDB
tables that have FULLTEXT
indexes.
FLUSH TABLES ...FOR EXPORT
does not work with partitioned InnoDB
tables prior to MySQL 5.6.17, but is supported for such tables in MySQL 5.6.17 and later. (Bug #16943907)
When notified by FOR EXPORT
, InnoDB
writes to disk certain kinds of data that is normally held in memory or in separate disk buffers outside the tablespace files. For each table, InnoDB
also produces a file named
in the same database directory as the table. The table_name
.cfg.cfg
file contains metadata needed to reimport the tablespace files later, into the same or different server.
When the FOR EXPORT
statement completes, InnoDB
will have flushed all dirty pages to the table data files. Any change buffer entries are merged prior to flushing. At this point, the tables are locked and quiescent: The tables are in a transactionally consistent state on disk and you can copy the .ibd
tablespace files along with the corresponding .cfg
files to get a consistent snapshot of those tables.
参考资料:
A应该不是最安全的,安全的应该是sqldump,for export会锁表,只有表空间文件复制时需要使用(A错)
分区不可用 B对
临时表不可用,会忽略,c错
D对
myisam也可用 E错
答案应该是BD