> ## Documentation Index
> Fetch the complete documentation index at: https://cockroachlabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# MOLT Fetch Troubleshooting

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

This page describes common issues that can occur while using <InternalLink path="molt-fetch">MOLT Fetch</InternalLink> and suggests ways to troubleshoot those issues.

<Tip>
  Some of the contents of this page are specific to your source database (PostgreSQL, MySQL, or Oracle). Select your source using the dropdown at the top right of this page.
</Tip>

### Fetch issues

#### Fetch exits early due to mismatches

When run in `none` or `truncate-if-exists` mode, `molt fetch` exits early in the following cases, and will output a log with a corresponding `mismatch_tag` and `failable_mismatch` set to `true`:

* A source table is missing a primary key.

* A source primary key and target primary key have mismatching types.
  <Tip>
    These restrictions (missing or mismatching primary keys) can be bypassed with <InternalLink path="molt-fetch#skip-primary-key-matching">`--skip-pk-check`</InternalLink>.
  </Tip>

* A <InternalLink version="stable" path="string">`STRING`</InternalLink> primary key has a different <InternalLink version="stable" path="collate">collation</InternalLink> on the source and target.

* A source and target column have mismatching types that are not <InternalLink path="molt-fetch#type-mapping">allowable mappings</InternalLink>.

* A target table is missing a column that is in the corresponding source table.

* A source column is nullable, but the corresponding target column is not nullable (i.e., the constraint is more strict on the target).

`molt fetch` can continue in the following cases, and will output a log with a corresponding `mismatch_tag` and `failable_mismatch` set to `false`:

* A target table has a column that is not in the corresponding source table.
* A source column has a `NOT NULL` constraint, and the corresponding target column is nullable (i.e., the constraint is less strict on the target).
* A <InternalLink version="stable" path="default-value">`DEFAULT`</InternalLink>, <InternalLink version="stable" path="check">`CHECK`</InternalLink>, <InternalLink version="stable" path="foreign-key">`FOREIGN KEY`</InternalLink>, or <InternalLink version="stable" path="unique">`UNIQUE`</InternalLink> constraint is specified on a target column and not on the source column.

<View title="PostgreSQL">
  <Tip>
    The instructions in this section are specific to **PostgreSQL** source databases. To see instructions for other source database types, select a different option from the dropdown at the top right of this page.
  </Tip>
</View>

<View title="MySQL">
  <Tip>
    The instructions in this section are specific to **MySQL** source databases. To see instructions for other source database types, select a different option from the dropdown at the top right of this page.
  </Tip>

  ##### Failed to export snapshot: no rows in result set

  ```
  failed to export snapshot: please ensure that you have GTID-based replication enabled: sql: no rows in result set
  ```

  This typically occurs on a new MySQL cluster that has not had any writes committed. The GTID set will not appear in `SHOW MASTER STATUS` until at least one transaction has been committed on the database.

  **Resolution:** Execute a minimal transaction to initialize the GTID set:

  ```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
  START TRANSACTION;
  SELECT 1;
  COMMIT;
  ```

  Verify that the GTID set now appears:

  ```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
  SHOW MASTER STATUS;
  ```

  This should return a valid GTID value instead of an empty result.
</View>

<View title="Oracle">
  <Tip>
    The instructions in this section are specific to **Oracle** source databases. To see instructions for other source database types, select a different option from the dropdown at the top right of this page.
  </Tip>

  ##### ORA-01950: no privileges on tablespace

  If you receive `ORA-01950: no privileges on tablespace 'USERS'`, it means the Oracle table owner (`migration_schema` in the preceding examples) does not have sufficient quota on the tablespace used to store its data. By default, this tablespace is `USERS`, but it can vary. To resolve this issue, grant a quota to the table owner. For example:

  ```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
  -- change UNLIMITED to a suitable limit for the table owner
  ALTER USER migration_schema QUOTA UNLIMITED ON USERS;
  ```

  #### No tables to drop and recreate on target

  When expecting a bulk load but seeing `no tables to drop and recreate on the target`, ensure the migration user has `SELECT` and `FLASHBACK` privileges on each table to be migrated. For example:

  ```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
  GRANT SELECT, FLASHBACK ON migration_schema.employees TO C##MIGRATION_USER;
  GRANT SELECT, FLASHBACK ON migration_schema.payments TO C##MIGRATION_USER;
  GRANT SELECT, FLASHBACK ON migration_schema.orders TO C##MIGRATION_USER;
  ```

  #### Table or view does not exist

  If the Oracle migration user lacks privileges on certain tables, you may receive errors stating that the table or view does not exist. Either use `--table-filter` to <InternalLink path="molt-fetch#schema-and-table-selection">limit the tables to be migrated</InternalLink>, or grant the migration user `SELECT` privileges on all objects in the schema. Refer to <InternalLink version="stable" path="create-user">Create migration user on source database</InternalLink>.

  #### Oracle sessions remain open after forcefully stopping `molt` or `replicator`

  If you shut down `molt` or `replicator` unexpectedly (e.g., with `kill -9` or a system crash), Oracle sessions opened by these tools may remain active.

  * Check your operating system for any running `molt` or `replicator` processes and terminate them manually.
  * After confirming that both processes have stopped, ask a DBA to check for active Oracle sessions using:

    ```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
    SELECT sid, serial#, username, status, osuser, machine, program
    FROM v$session
    WHERE username = 'C##MIGRATION_USER';
    ```

    Wait until any remaining sessions display an `INACTIVE` status, then terminate them using:

    ```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
    ALTER SYSTEM KILL SESSION 'sid,serial#' IMMEDIATE;
    ```

    Replace `sid` and `serial#` in the preceding statement with the values returned by the `SELECT` query.
</View>

## See also

* <InternalLink path="molt-fetch">MOLT Fetch</InternalLink>
* <InternalLink path="migration-overview">Migration Overview</InternalLink>
* <InternalLink path="molt-replicator">MOLT Replicator</InternalLink>
* <InternalLink path="molt-verify">MOLT Verify</InternalLink>
