<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="innodb-table-import">
      </a>
      17.6.1.3 Importing InnoDB Tables
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045166726816">
  </a>
  <a class="indexterm" name="idm46045166725744">
  </a>
  <a class="indexterm" name="idm46045166724256">
  </a>
  <p>
   This section describes how to import tables using the
   <span class="emphasis">
    <em>
     Transportable Tablespaces
    </em>
   </span>
   feature, which
      permits importing tables, partitioned tables, or individual table
      partitions that reside in file-per-table tablespaces. There are
      many reasons why you might want to import tables:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      To run reports on a non-production MySQL server instance to
          avoid placing extra load on a production server.
     </p>
    </li>
    <li class="listitem">
     <p>
      To copy data to a new replica server.
     </p>
    </li>
    <li class="listitem">
     <p>
      To restore a table from a backed-up tablespace file.
     </p>
    </li>
    <li class="listitem">
     <p>
      As a faster way of moving data than importing a dump file,
          which requires reinserting data and rebuilding indexes.
     </p>
    </li>
    <li class="listitem">
     <p>
      To move a data to a server with storage media that is better
          suited to your storage requirements. For example, you might
          move busy tables to an SSD device, or move large tables to a
          high-capacity HDD device.
     </p>
    </li>
   </ul>
  </div>
  <p>
   The
   <span class="emphasis">
    <em>
     Transportable Tablespaces
    </em>
   </span>
   feature is
      described under the following topics in this section:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="xref" href="innodb-table-import.html#innodb-table-import-prerequsites" title="Prerequisites">
       Prerequisites
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="innodb-table-import.html#innodb-table-import-example" title="Importing Tables">
       Importing Tables
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="innodb-table-import.html#innodb-table-import-partitioned-table" title="Importing Partitioned Tables">
       Importing Partitioned Tables
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="innodb-table-import.html#innodb-table-import-partitions" title="Importing Table Partitions">
       Importing Table Partitions
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="innodb-table-import.html#innodb-table-import-limitations" title="Limitations">
       Limitations
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="innodb-table-import.html#innodb-table-import-usage-notes" title="Usage Notes">
       Usage Notes
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="innodb-table-import.html#innodb-table-import-internals" title="Internals">
       Internals
      </a>
     </p>
    </li>
   </ul>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="innodb-table-import-prerequsites">
       </a>
       Prerequisites
      </h5>
     </div>
    </div>
   </div>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       The
       <a class="link" href="innodb-parameters.html#sysvar_innodb_file_per_table">
        <code class="literal">
         innodb_file_per_table
        </code>
       </a>
       variable must be enabled, which it is by default.
      </p>
     </li>
     <li class="listitem">
      <p>
       The page size of the tablespace must match the page size of
            the destination MySQL server instance.
       <code class="literal">
        InnoDB
       </code>
       page size is defined by the
       <a class="link" href="innodb-parameters.html#sysvar_innodb_page_size">
        <code class="literal">
         innodb_page_size
        </code>
       </a>
       variable,
            which is configured when initializing a MySQL server
            instance.
      </p>
     </li>
     <li class="listitem">
      <p>
       If the table has a foreign key relationship,
       <a class="link" href="server-system-variables.html#sysvar_foreign_key_checks">
        <code class="literal">
         foreign_key_checks
        </code>
       </a>
       must be
            disabled before executing
       <code class="literal">
        DISCARD
            TABLESPACE
       </code>
       . Also, you should export all foreign
            key related tables at the same logical point in time, as
       <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
        <code class="literal">
         ALTER TABLE ...
            IMPORT TABLESPACE
        </code>
       </a>
       does not enforce foreign key
            constraints on imported data. To do so, stop updating the
            related tables, commit all transactions, acquire shared
            locks on the tables, and perform the export operations.
      </p>
     </li>
     <li class="listitem">
      <p>
       When importing a table from another MySQL server instance,
            both MySQL server instances must have General Availability
            (GA) status and must be the same version. Otherwise, the
            table must be created on the same MySQL server instance into
            which it is being imported.
      </p>
     </li>
     <li class="listitem">
      <p>
       If the table was created in an external directory by
            specifying the
       <code class="literal">
        DATA DIRECTORY
       </code>
       clause in
            the
       <a class="link" href="create-table.html" title="15.1.20 CREATE TABLE Statement">
        <code class="literal">
         CREATE TABLE
        </code>
       </a>
       statement,
            the table that you replace on the destination instance must
            be defined with the same
       <code class="literal">
        DATA DIRECTORY
       </code>
       clause. A schema mismatch error is reported if the clauses
            do not match. To determine if the source table was defined
            with a
       <code class="literal">
        DATA DIRECTORY
       </code>
       clause, use
       <a class="link" href="show-create-table.html" title="15.7.7.11 SHOW CREATE TABLE Statement">
        <code class="literal">
         SHOW CREATE TABLE
        </code>
       </a>
       to view the
            table definition. For information about using the
       <code class="literal">
        DATA DIRECTORY
       </code>
       clause, see
       <a class="xref" href="innodb-create-table-external.html" title="17.6.1.2 Creating Tables Externally">
        Section 17.6.1.2, “Creating Tables Externally”
       </a>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       If a
       <code class="literal">
        ROW_FORMAT
       </code>
       option is not defined
            explicitly in the table definition or
       <code class="literal">
        ROW_FORMAT=DEFAULT
       </code>
       is used, the
       <a class="link" href="innodb-parameters.html#sysvar_innodb_default_row_format">
        <code class="literal">
         innodb_default_row_format
        </code>
       </a>
       setting must be the same on the source and destination
            instances. Otherwise, a schema mismatch error is reported
            when you attempt the import operation. Use
       <a class="link" href="show-create-table.html" title="15.7.7.11 SHOW CREATE TABLE Statement">
        <code class="literal">
         SHOW CREATE TABLE
        </code>
       </a>
       to check
            the table definition. Use
       <a class="link" href="show-variables.html" title="15.7.7.41 SHOW VARIABLES Statement">
        <code class="literal">
         SHOW
            VARIABLES
        </code>
       </a>
       to check the
       <a class="link" href="innodb-parameters.html#sysvar_innodb_default_row_format">
        <code class="literal">
         innodb_default_row_format
        </code>
       </a>
       setting. For related information, see
       <a class="xref" href="innodb-row-format.html#innodb-row-format-defining" title="Defining the Row Format of a Table">
        Defining the Row Format of a Table
       </a>
       .
      </p>
     </li>
    </ul>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="innodb-table-import-example">
       </a>
       Importing Tables
      </h5>
     </div>
    </div>
   </div>
   <p>
    This example demonstrates how to import a regular
        non-partitioned table that resides in a file-per-table
        tablespace.
   </p>
   <div class="orderedlist">
    <ol class="orderedlist" type="1">
     <li class="listitem">
      <p>
       On the destination instance, create a table with the same
            definition as the table you intend to import. (You can
            obtain the table definition using
       <a class="link" href="show-create-table.html" title="15.7.7.11 SHOW CREATE TABLE Statement">
        <code class="literal">
         SHOW
            CREATE TABLE
        </code>
       </a>
       syntax.) If the table definition does
            not match, a schema mismatch error is reported when you
            attempt the import operation.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa11813193"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>c1 <span class="token datatype">INT</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span><span class="token operator">=</span>INNODB<span class="token punctuation">;</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       On the destination instance, discard the tablespace of the
            table that you just created. (Before importing, you must
            discard the tablespace of the receiving table.)
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa73976568"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">DISCARD</span> <span class="token keyword">TABLESPACE</span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       On the source instance, run
       <a class="link" href="flush.html#flush-tables-for-export-with-list">
        <code class="literal">
         FLUSH
            TABLES ... FOR EXPORT
        </code>
       </a>
       to quiesce the table you
            intend to import. When a table is quiesced, only read-only
            transactions are permitted on the table.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa32902837"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">FLUSH</span> <span class="token keyword">TABLES</span> t1 <span class="token keyword">FOR</span> <span class="token keyword">EXPORT</span><span class="token punctuation">;</span></code></pre>
      </div>
      <p>
       <a class="link" href="flush.html#flush-tables-for-export-with-list">
        <code class="literal">
         FLUSH
            TABLES ... FOR EXPORT
        </code>
       </a>
       ensures that changes to the
            named table are flushed to disk so that a binary table copy
            can be made while the server is running. When
       <a class="link" href="flush.html#flush-tables-for-export-with-list">
        <code class="literal">
         FLUSH
            TABLES ... FOR EXPORT
        </code>
       </a>
       is run,
       <code class="literal">
        InnoDB
       </code>
       generates a
       <code class="filename">
        .cfg
       </code>
       metadata file in the schema
            directory of the table. The
       <code class="filename">
        .cfg
       </code>
       file
            contains metadata that is used for schema verification
            during the import operation.
      </p>
      <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
       <div class="admon-title">
        Note
       </div>
       <p>
        The connection executing
        <a class="link" href="flush.html#flush-tables-for-export-with-list">
         <code class="literal">
          FLUSH
              TABLES ... FOR EXPORT
         </code>
        </a>
        must remain open while the
              operation is running; otherwise, the
        <code class="filename">
         .cfg
        </code>
        file is removed as locks are
              released upon connection closure.
       </p>
      </div>
     </li>
     <li class="listitem">
      <p>
       Copy the
       <code class="filename">
        .ibd
       </code>
       file and
       <code class="filename">
        .cfg
       </code>
       metadata file from the source
            instance to the destination instance. For example:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa58937115"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$&gt; </span><span class="token command">scp</span> <em class="replaceable">/path/to/datadir</em>/test/t1<span class="token punctuation">.</span><span class="token punctuation">{</span>ibd<span class="token punctuation">,</span>cfg<span class="token punctuation">}</span> destination-server<span class="token punctuation">:</span><em class="replaceable">/path/to/datadir</em>/test</code></pre>
      </div>
      <p>
       The
       <code class="filename">
        .ibd
       </code>
       file and
       <code class="filename">
        .cfg
       </code>
       file must be copied before
            releasing the shared locks, as described in the next step.
      </p>
      <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
       <div class="admon-title">
        Note
       </div>
       <p>
        If you are importing a table from an encrypted tablespace,
        <code class="literal">
         InnoDB
        </code>
        generates a
        <code class="filename">
         .cfp
        </code>
        file in addition to a
        <code class="filename">
         .cfg
        </code>
        metadata file. The
        <code class="filename">
         .cfp
        </code>
        file must be copied to the
              destination instance together with the
        <code class="filename">
         .cfg
        </code>
        file. The
        <code class="filename">
         .cfp
        </code>
        file contains a transfer key and
              an encrypted tablespace key. On import,
        <code class="literal">
         InnoDB
        </code>
        uses the transfer key to decrypt
              the tablespace key. For related information, see
        <a class="xref" href="innodb-data-encryption.html" title="17.13 InnoDB Data-at-Rest Encryption">
         Section 17.13, “InnoDB Data-at-Rest Encryption”
        </a>
        .
       </p>
      </div>
     </li>
     <li class="listitem">
      <p>
       On the source instance, use
       <a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
        <code class="literal">
         UNLOCK
            TABLES
        </code>
       </a>
       to release the locks acquired by the
       <a class="link" href="flush.html#flush-tables-for-export-with-list">
        <code class="literal">
         FLUSH
            TABLES ... FOR EXPORT
        </code>
       </a>
       statement:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa15553509"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">UNLOCK</span> <span class="token keyword">TABLES</span><span class="token punctuation">;</span></code></pre>
      </div>
      <p>
       The
       <a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
        <code class="literal">
         UNLOCK
            TABLES
        </code>
       </a>
       operation also removes the
       <code class="filename">
        .cfg
       </code>
       file.
      </p>
     </li>
     <li class="listitem">
      <p>
       On the destination instance, import the tablespace:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa98759167"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">IMPORT</span> <span class="token keyword">TABLESPACE</span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
    </ol>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="innodb-table-import-partitioned-table">
       </a>
       Importing Partitioned Tables
      </h5>
     </div>
    </div>
   </div>
   <p>
    This example demonstrates how to import a partitioned table,
        where each table partition resides in a file-per-table
        tablespace.
   </p>
   <div class="orderedlist">
    <ol class="orderedlist" type="1">
     <li class="listitem">
      <p>
       On the destination instance, create a partitioned table with
            the same definition as the partitioned table that you want
            to import. (You can obtain the table definition using
       <a class="link" href="show-create-table.html" title="15.7.7.11 SHOW CREATE TABLE Statement">
        <code class="literal">
         SHOW CREATE TABLE
        </code>
       </a>
       syntax.) If
            the table definition does not match, a schema mismatch error
            is reported when you attempt the import operation.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa96699336"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>i <span class="token datatype">int</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span> <span class="token operator">=</span> InnoDB <span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>i<span class="token punctuation">)</span> <span class="token keyword">PARTITIONS</span> <span class="token number">3</span><span class="token punctuation">;</span></code></pre>
      </div>
      <p>
       In the
       <code class="literal">
        /
        <em class="replaceable">
         <code>
          datadir
         </code>
        </em>
        /test
       </code>
       directory, there is a tablespace
       <code class="filename">
        .ibd
       </code>
       file for each of the three partitions.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa40559297"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">mysql&gt;</span><span class="token command"> \</span>! ls <em class="replaceable">/path/to/datadir</em>/test/
t1<span class="token comment" spellcheck="true">#p#p0.ibd  t1#p#p1.ibd  t1#p#p2.ibd</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       On the destination instance, discard the tablespace for the
            partitioned table. (Before the import operation, you must
            discard the tablespace of the receiving table.)
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa88626999"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">DISCARD</span> <span class="token keyword">TABLESPACE</span><span class="token punctuation">;</span></code></pre>
      </div>
      <p>
       The three tablespace
       <code class="filename">
        .ibd
       </code>
       files of the
            partitioned table are discarded from the
       <code class="literal">
        /
        <em class="replaceable">
         <code>
          datadir
         </code>
        </em>
        /test
       </code>
       directory.
      </p>
     </li>
     <li class="listitem">
      <p>
       On the source instance, run
       <a class="link" href="flush.html#flush-tables-for-export-with-list">
        <code class="literal">
         FLUSH
            TABLES ... FOR EXPORT
        </code>
       </a>
       to quiesce the partitioned
            table that you intend to import. When a table is quiesced,
            only read-only transactions are permitted on the table.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69170406"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">FLUSH</span> <span class="token keyword">TABLES</span> t1 <span class="token keyword">FOR</span> <span class="token keyword">EXPORT</span><span class="token punctuation">;</span></code></pre>
      </div>
      <p>
       <a class="link" href="flush.html#flush-tables-for-export-with-list">
        <code class="literal">
         FLUSH
            TABLES ... FOR EXPORT
        </code>
       </a>
       ensures that changes to the
            named table are flushed to disk so that binary table copy
            can be made while the server is running. When
       <a class="link" href="flush.html#flush-tables-for-export-with-list">
        <code class="literal">
         FLUSH
            TABLES ... FOR EXPORT
        </code>
       </a>
       is run,
       <code class="literal">
        InnoDB
       </code>
       generates
       <code class="filename">
        .cfg
       </code>
       metadata files in the schema
            directory of the table for each of the table's tablespace
            files.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa83946914"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">mysql&gt;</span><span class="token command"> \</span>! ls <em class="replaceable">/path/to/datadir</em>/test/
t1<span class="token comment" spellcheck="true">#p#p0.ibd  t1#p#p1.ibd  t1#p#p2.ibd</span>
t1<span class="token comment" spellcheck="true">#p#p0.cfg  t1#p#p1.cfg  t1#p#p2.cfg</span></code></pre>
      </div>
      <p>
       The
       <code class="filename">
        .cfg
       </code>
       files contain metadata that is
            used for schema verification when importing the tablespace.
       <a class="link" href="flush.html#flush-tables-for-export-with-list">
        <code class="literal">
         FLUSH
            TABLES ... FOR EXPORT
        </code>
       </a>
       can only be run on the
            table, not on individual table partitions.
      </p>
     </li>
     <li class="listitem">
      <p>
       Copy the
       <code class="filename">
        .ibd
       </code>
       and
       <code class="filename">
        .cfg
       </code>
       files from the source instance
            schema directory to the destination instance schema
            directory. For example:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa89120728"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal">$&gt;scp <em class="replaceable">/path/to/datadir</em>/test/t1*<span class="token punctuation">.</span><span class="token punctuation">{</span>ibd<span class="token punctuation">,</span>cfg<span class="token punctuation">}</span> destination-server<span class="token punctuation">:</span><em class="replaceable">/path/to/datadir</em>/test</code></pre>
      </div>
      <p>
       The
       <code class="filename">
        .ibd
       </code>
       and
       <code class="filename">
        .cfg
       </code>
       files must be copied before releasing the shared locks, as
            described in the next step.
      </p>
      <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
       <div class="admon-title">
        Note
       </div>
       <p>
        If you are importing a table from an encrypted tablespace,
        <code class="literal">
         InnoDB
        </code>
        generates a
        <code class="filename">
         .cfp
        </code>
        files in addition to a
        <code class="filename">
         .cfg
        </code>
        metadata files. The
        <code class="filename">
         .cfp
        </code>
        files must be copied to the
              destination instance together with the
        <code class="filename">
         .cfg
        </code>
        files. The
        <code class="filename">
         .cfp
        </code>
        files contain a transfer key and
              an encrypted tablespace key. On import,
        <code class="literal">
         InnoDB
        </code>
        uses the transfer key to decrypt
              the tablespace key. For related information, see
        <a class="xref" href="innodb-data-encryption.html" title="17.13 InnoDB Data-at-Rest Encryption">
         Section 17.13, “InnoDB Data-at-Rest Encryption”
        </a>
        .
       </p>
      </div>
     </li>
     <li class="listitem">
      <p>
       On the source instance, use
       <a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
        <code class="literal">
         UNLOCK
            TABLES
        </code>
       </a>
       to release the locks acquired by
       <a class="link" href="flush.html#flush-tables-for-export-with-list">
        <code class="literal">
         FLUSH
            TABLES ... FOR EXPORT
        </code>
       </a>
       :
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa43920461"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">UNLOCK</span> <span class="token keyword">TABLES</span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       On the destination instance, import the tablespace of the
            partitioned table:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa36538825"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">IMPORT</span> <span class="token keyword">TABLESPACE</span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
    </ol>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="innodb-table-import-partitions">
       </a>
       Importing Table Partitions
      </h5>
     </div>
    </div>
   </div>
   <p>
    This example demonstrates how to import individual table
        partitions, where each partition resides in a file-per-table
        tablespace file.
   </p>
   <p>
    In the following example, two partitions (
    <code class="literal">
     p2
    </code>
    and
    <code class="literal">
     p3
    </code>
    ) of a four-partition table are
        imported.
   </p>
   <div class="orderedlist">
    <ol class="orderedlist" type="1">
     <li class="listitem">
      <p>
       On the destination instance, create a partitioned table with
            the same definition as the partitioned table that you want
            to import partitions from. (You can obtain the table
            definition using
       <a class="link" href="show-create-table.html" title="15.7.7.11 SHOW CREATE TABLE Statement">
        <code class="literal">
         SHOW CREATE
            TABLE
        </code>
       </a>
       syntax.) If the table definition does not
            match, a schema mismatch error is reported when you attempt
            the import operation.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa11461249"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> t1 <span class="token punctuation">(</span>i <span class="token datatype">int</span><span class="token punctuation">)</span> <span class="token keyword">ENGINE</span> <span class="token operator">=</span> InnoDB <span class="token keyword">PARTITION</span> <span class="token keyword">BY</span> <span class="token keyword">KEY</span> <span class="token punctuation">(</span>i<span class="token punctuation">)</span> <span class="token keyword">PARTITIONS</span> <span class="token number">4</span><span class="token punctuation">;</span></code></pre>
      </div>
      <p>
       In the
       <code class="literal">
        /
        <em class="replaceable">
         <code>
          datadir
         </code>
        </em>
        /test
       </code>
       directory, there is a tablespace
       <code class="filename">
        .ibd
       </code>
       file for each of the four partitions.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa81549461"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">mysql&gt;</span><span class="token command"> \</span>! ls <em class="replaceable">/path/to/datadir</em>/test/
t1<span class="token comment" spellcheck="true">#p#p0.ibd  t1#p#p1.ibd  t1#p#p2.ibd t1#p#p3.ibd</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       On the destination instance, discard the partitions that you
            intend to import from the source instance. (Before importing
            partitions, you must discard the corresponding partitions
            from the receiving partitioned table.)
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa3197096"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">DISCARD</span> <span class="token keyword">PARTITION</span> p2<span class="token punctuation">,</span> p3 <span class="token keyword">TABLESPACE</span><span class="token punctuation">;</span></code></pre>
      </div>
      <p>
       The tablespace
       <code class="literal">
        .ibd
       </code>
       files for the two
            discarded partitions are removed from the
       <code class="literal">
        /
        <em class="replaceable">
         <code>
          datadir
         </code>
        </em>
        /test
       </code>
       directory on the destination instance, leaving the following
            files:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa56833927"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">mysql&gt;</span><span class="token command"> \</span>! ls <em class="replaceable">/path/to/datadir</em>/test/
t1<span class="token comment" spellcheck="true">#p#p0.ibd  t1#p#p1.ibd</span></code></pre>
      </div>
      <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
       <div class="admon-title">
        Note
       </div>
       <p>
        When
        <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
         <code class="literal">
          ALTER
              TABLE ... DISCARD PARTITION ... TABLESPACE
         </code>
        </a>
        is
              run on subpartitioned tables, both partition and
              subpartition table names are permitted. When a partition
              name is specified, subpartitions of that partition are
              included in the operation.
       </p>
      </div>
     </li>
     <li class="listitem">
      <p>
       On the source instance, run
       <a class="link" href="flush.html#flush-tables-for-export-with-list">
        <code class="literal">
         FLUSH
            TABLES ... FOR EXPORT
        </code>
       </a>
       to quiesce the partitioned
            table. When a table is quiesced, only read-only transactions
            are permitted on the table.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa10303444"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">FLUSH</span> <span class="token keyword">TABLES</span> t1 <span class="token keyword">FOR</span> <span class="token keyword">EXPORT</span><span class="token punctuation">;</span></code></pre>
      </div>
      <p>
       <a class="link" href="flush.html#flush-tables-for-export-with-list">
        <code class="literal">
         FLUSH
            TABLES ... FOR EXPORT
        </code>
       </a>
       ensures that changes to the
            named table are flushed to disk so that binary table copy
            can be made while the instance is running. When
       <a class="link" href="flush.html#flush-tables-for-export-with-list">
        <code class="literal">
         FLUSH
            TABLES ... FOR EXPORT
        </code>
       </a>
       is run,
       <code class="literal">
        InnoDB
       </code>
       generates a
       <code class="filename">
        .cfg
       </code>
       metadata file for each of the
            table's tablespace files in the schema directory of the
            table.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-terminal"><div class="docs-select-all right" id="sa3224582"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">mysql&gt;</span><span class="token command"> \</span>! ls <em class="replaceable">/path/to/datadir</em>/test/
t1<span class="token comment" spellcheck="true">#p#p0.ibd  t1#p#p1.ibd  t1#p#p2.ibd t1#p#p3.ibd</span>
t1<span class="token comment" spellcheck="true">#p#p0.cfg  t1#p#p1.cfg  t1#p#p2.cfg t1#p#p3.cfg</span></code></pre>
      </div>
      <p>
       The
       <code class="filename">
        .cfg
       </code>
       files contain metadata that
            used for schema verification during the import operation.
       <a class="link" href="flush.html#flush-tables-for-export-with-list">
        <code class="literal">
         FLUSH
            TABLES ... FOR EXPORT
        </code>
       </a>
       can only be run on the
            table, not on individual table partitions.
      </p>
     </li>
     <li class="listitem">
      <p>
       Copy the
       <code class="filename">
        .ibd
       </code>
       and
       <code class="filename">
        .cfg
       </code>
       files for partition
       <code class="literal">
        p2
       </code>
       and partition
       <code class="literal">
        p3
       </code>
       from the source instance schema directory to the destination
            instance schema directory.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa14633015"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-terminal"><span class="token prompt">$&gt; </span><span class="token command">scp</span> t1<span class="token comment" spellcheck="true">#p#p2.ibd t1#p#p2.cfg t1#p#p3.ibd t1#p#p3.cfg destination-server:<em class="replaceable">/path/to/datadir</em>/test</span></code></pre>
      </div>
      <p>
       The
       <code class="filename">
        .ibd
       </code>
       and
       <code class="filename">
        .cfg
       </code>
       files must be copied before releasing the shared locks, as
            described in the next step.
      </p>
      <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
       <div class="admon-title">
        Note
       </div>
       <p>
        If you are importing partitions from an encrypted
              tablespace,
        <code class="literal">
         InnoDB
        </code>
        generates a
        <code class="filename">
         .cfp
        </code>
        files in addition to a
        <code class="filename">
         .cfg
        </code>
        metadata files. The
        <code class="filename">
         .cfp
        </code>
        files must be copied to the
              destination instance together with the
        <code class="filename">
         .cfg
        </code>
        files. The
        <code class="filename">
         .cfp
        </code>
        files contain a transfer key and
              an encrypted tablespace key. On import,
        <code class="literal">
         InnoDB
        </code>
        uses the transfer key to decrypt
              the tablespace key. For related information, see
        <a class="xref" href="innodb-data-encryption.html" title="17.13 InnoDB Data-at-Rest Encryption">
         Section 17.13, “InnoDB Data-at-Rest Encryption”
        </a>
        .
       </p>
      </div>
     </li>
     <li class="listitem">
      <p>
       On the source instance, use
       <a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
        <code class="literal">
         UNLOCK
            TABLES
        </code>
       </a>
       to release the locks acquired by
       <a class="link" href="flush.html#flush-tables-for-export-with-list">
        <code class="literal">
         FLUSH
            TABLES ... FOR EXPORT
        </code>
       </a>
       :
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa69950741"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">UNLOCK</span> <span class="token keyword">TABLES</span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       On the destination instance, import table partitions
       <code class="literal">
        p2
       </code>
       and
       <code class="literal">
        p3
       </code>
       :
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa81255421"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">USE</span> test<span class="token punctuation">;</span>
<span class="token prompt">mysql&gt;</span> <span class="token keyword">ALTER</span> <span class="token keyword">TABLE</span> t1 <span class="token keyword">IMPORT</span> <span class="token keyword">PARTITION</span> p2<span class="token punctuation">,</span> p3 <span class="token keyword">TABLESPACE</span><span class="token punctuation">;</span></code></pre>
      </div>
      <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
       <div class="admon-title">
        Note
       </div>
       <p>
        When
        <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
         <code class="literal">
          ALTER
              TABLE ... IMPORT PARTITION ... TABLESPACE
         </code>
        </a>
        is run
              on subpartitioned tables, both partition and subpartition
              table names are permitted. When a partition name is
              specified, subpartitions of that partition are included in
              the operation.
       </p>
      </div>
     </li>
    </ol>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="innodb-table-import-limitations">
       </a>
       Limitations
      </h5>
     </div>
    </div>
   </div>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       The
       <span class="emphasis">
        <em>
         Transportable Tablespaces
        </em>
       </span>
       feature
            is only supported for tables that reside in file-per-table
            tablespaces. It is not supported for the tables that reside
            in the system tablespace or general tablespaces. Tables in
            shared tablespaces cannot be quiesced.
      </p>
     </li>
     <li class="listitem">
      <p>
       <a class="link" href="flush.html#flush-tables-for-export-with-list">
        <code class="literal">
         FLUSH
            TABLES ... FOR EXPORT
        </code>
       </a>
       is not supported on tables
            with a
       <code class="literal">
        FULLTEXT
       </code>
       index, as full-text
            search auxiliary tables cannot be flushed. After importing a
            table with a
       <code class="literal">
        FULLTEXT
       </code>
       index, run
       <a class="link" href="optimize-table.html" title="15.7.3.4 OPTIMIZE TABLE Statement">
        <code class="literal">
         OPTIMIZE TABLE
        </code>
       </a>
       to rebuild the
       <code class="literal">
        FULLTEXT
       </code>
       indexes. Alternatively, drop
       <code class="literal">
        FULLTEXT
       </code>
       indexes before the export
            operation and recreate the indexes after importing the table
            on the destination instance.
      </p>
     </li>
     <li class="listitem">
      <p>
       Due to a
       <code class="literal">
        .cfg
       </code>
       metadata file limitation,
            schema mismatches are not reported for partition type or
            partition definition differences when importing a
            partitioned table. Column differences are reported.
      </p>
     </li>
    </ul>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="innodb-table-import-usage-notes">
       </a>
       Usage Notes
      </h5>
     </div>
    </div>
   </div>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       With the exception of tables that contain instantly added or
            dropped columns,
       <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
        <code class="literal">
         ALTER TABLE ...
            IMPORT TABLESPACE
        </code>
       </a>
       does not require a
       <code class="filename">
        .cfg
       </code>
       metadata file to import a table.
            However, metadata checks are not performed when importing
            without a
       <code class="filename">
        .cfg
       </code>
       file, and a warning
            similar to the following is issued:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-none"><div class="docs-select-all right" id="sa37317852"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">Message: InnoDB: IO Read error: (2, No such file or directory) Error opening '.\
test\t.cfg', will attempt to import without schema verification
1 row in set (0.00 sec)</code></pre>
      </div>
      <p>
       Importing a table without a
       <code class="filename">
        .cfg
       </code>
       metadata file should only be considered if no schema
            mismatches are expected and the table does not contain any
            instantly added or dropped columns. The ability to import
            without a
       <code class="filename">
        .cfg
       </code>
       file could be useful in
            crash recovery scenarios where metadata is not accessible.
      </p>
      <p>
       Attempting to import a table with columns that were added or
            dropped using
       <code class="literal">
        ALGORITHM=INSTANT
       </code>
       without
            using a
       <code class="filename">
        .cfg
       </code>
       file can result in
            undefined behavior.
      </p>
     </li>
     <li class="listitem">
      <p>
       On Windows,
       <code class="literal">
        InnoDB
       </code>
       stores database,
            tablespace, and table names internally in lowercase. To
            avoid import problems on case-sensitive operating systems
            such as Linux and Unix, create all databases, tablespaces,
            and tables using lowercase names. A convenient way to ensure
            that names are created in lowercase is to set
       <a class="link" href="server-system-variables.html#sysvar_lower_case_table_names">
        <code class="literal">
         lower_case_table_names
        </code>
       </a>
       to 1
            before initializing the server. (It is prohibited to start
            the server with a
       <a class="link" href="server-system-variables.html#sysvar_lower_case_table_names">
        <code class="literal">
         lower_case_table_names
        </code>
       </a>
       setting that is different from the setting used when the
            server was initialized.)
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-none"><div class="docs-select-all right" id="sa87072305"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">[mysqld]
lower_case_table_names=1</code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       When running
       <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
        <code class="literal">
         ALTER TABLE ...
            DISCARD PARTITION ... TABLESPACE
        </code>
       </a>
       and
       <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
        <code class="literal">
         ALTER TABLE ...
            IMPORT PARTITION ... TABLESPACE
        </code>
       </a>
       on subpartitioned
            tables, both partition and subpartition table names are
            permitted. When a partition name is specified, subpartitions
            of that partition are included in the operation.
      </p>
     </li>
    </ul>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="innodb-table-import-internals">
       </a>
       Internals
      </h5>
     </div>
    </div>
   </div>
   <p>
    The following information describes internals and messages
        written to the error log during a table import procedure.
   </p>
   <p>
    When
    <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
     <code class="literal">
      ALTER TABLE
        ... DISCARD TABLESPACE
     </code>
    </a>
    is run on the destination
        instance:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       The table is locked in X mode.
      </p>
     </li>
     <li class="listitem">
      <p>
       The tablespace is detached from the table.
      </p>
     </li>
    </ul>
   </div>
   <p>
    When
    <a class="link" href="flush.html#flush-tables-for-export-with-list">
     <code class="literal">
      FLUSH
        TABLES ... FOR EXPORT
     </code>
    </a>
    is run on the source instance:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       The table being flushed for export is locked in shared mode.
      </p>
     </li>
     <li class="listitem">
      <p>
       The purge coordinator thread is stopped.
      </p>
     </li>
     <li class="listitem">
      <p>
       Dirty pages are synchronized to disk.
      </p>
     </li>
     <li class="listitem">
      <p>
       Table metadata is written to the binary
       <code class="filename">
        .cfg
       </code>
       file.
      </p>
     </li>
    </ul>
   </div>
   <p>
    Expected error log messages for this operation:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-none"><div class="docs-select-all right" id="sa57015015"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">[Note] InnoDB: Sync to disk of '"test"."t1"' started.
[Note] InnoDB: Stopping purge
[Note] InnoDB: Writing table metadata to './test/t1.cfg'
[Note] InnoDB: Table '"test"."t1"' flushed to disk</code></pre>
   </div>
   <p>
    When
    <a class="link" href="lock-tables.html" title="15.3.6 LOCK TABLES and UNLOCK TABLES Statements">
     <code class="literal">
      UNLOCK
        TABLES
     </code>
    </a>
    is run on the source instance:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       The binary
       <code class="literal">
        .cfg
       </code>
       file is deleted.
      </p>
     </li>
     <li class="listitem">
      <p>
       The shared lock on the table or tables being imported is
            released and the purge coordinator thread is restarted.
      </p>
     </li>
    </ul>
   </div>
   <p>
    Expected error log messages for this operation:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-none"><div class="docs-select-all right" id="sa80755193"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">[Note] InnoDB: Deleting the meta-data file './test/t1.cfg'
[Note] InnoDB: Resuming purge</code></pre>
   </div>
   <p>
    When
    <a class="link" href="alter-table.html" title="15.1.9 ALTER TABLE Statement">
     <code class="literal">
      ALTER TABLE
        ... IMPORT TABLESPACE
     </code>
    </a>
    is run on the destination
        instance, the import algorithm performs the following operations
        for each tablespace being imported:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       Each tablespace page is checked for corruption.
      </p>
     </li>
     <li class="listitem">
      <p>
       The space ID and log sequence numbers (LSNs) on each page
            are updated.
      </p>
     </li>
     <li class="listitem">
      <p>
       Flags are validated and LSN updated for the header page.
      </p>
     </li>
     <li class="listitem">
      <p>
       Btree pages are updated.
      </p>
     </li>
     <li class="listitem">
      <p>
       The page state is set to dirty so that it is written to
            disk.
      </p>
     </li>
    </ul>
   </div>
   <p>
    Expected error log messages for this operation:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-none"><div class="docs-select-all right" id="sa41480151"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">[Note] InnoDB: Importing tablespace for table 'test/t1' that was exported
from host '<em class="replaceable">host_name</em>'
[Note] InnoDB: Phase I - Update all pages
[Note] InnoDB: Sync to disk
[Note] InnoDB: Sync to disk - done!
[Note] InnoDB: Phase III - Flush changes to disk
[Note] InnoDB: Phase IV - Flush complete</code></pre>
   </div>
   <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
    <div class="admon-title">
     Note
    </div>
    <p>
     You may also receive a warning that a tablespace is discarded
          (if you discarded the tablespace for the destination table)
          and a message stating that statistics could not be calculated
          due to a missing
     <code class="filename">
      .ibd
     </code>
     file:
    </p>
    <div class="copytoclipboard-wrapper">
     <pre class="programlisting language-none"><div class="docs-select-all right" id="sa49039601"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">[Warning] InnoDB: Table "test"."t1" tablespace is set as discarded.
7f34d9a37700 InnoDB: cannot calculate statistics for table
"test"."t1" because the .ibd file is missing. For help, please refer to
http://dev.mysql.com/doc/refman/en/innodb-troubleshooting.html</code></pre>
    </div>
   </div>
  </div>
 </div>
 <br/>
</div>
