---
title: "corestack_db_import"
url: https://docs.corefinity.com/mcp/tools/corestack_db_import
type: tool
last_updated: 2026-11-13
feature: database
related:
  - https://docs.corefinity.com/guides/sites/database/database-users.md
---
# corestack_db_import

**Import into the database.** Import a SQL dump (plain, gzip or zstd) into the environment's database, from an uploaded transfer or a file under the site root. A safety snapshot is taken first (always on production) and named in the result: restore it with corestack_restore_create if the import goes wrong. The sanitiser removes DEFINER clauses and statements the site user may not run; pass sanitise: false to send the dump unchanged. Once the data is in, the site's cache is flushed (cache_flushed in the result; when it is false, the data is still imported: flush it yourself as cache_flush says). Scope: exec. Also needs destructive when the target is production. Long-running: answers with a task.

- Scope: `exec`
- Also needs `destructive` when the row is production
- Confirmation: `confirm_domain`
- Runs as a task: yes

## When to use it

Import a SQL dump (plain, gzip or zstd) into the environment's database, from an uploaded transfer or a file under the site root. A safety snapshot is taken first (always on production) and named in the result: restore it with corestack_restore_create if the import goes wrong. The sanitiser removes DEFINER clauses and statements the site user may not run; pass sanitise: false to send the dump unchanged. Once the data is in, the site's cache is flushed (cache_flushed in the result; when it is false, the data is still imported: flush it yourself as cache_flush says).

## Inputs

- `site_id` (integer, ≥ 1, required)
- `transfer_id` (integer, ≥ 1)
- `path` (string, up to 1024 characters): Relative to the site root, or absolute under it.
- `safety_snapshot` (boolean, default `true`)
- `drop_existing_tables` (boolean, default `false`)
- `sanitise` (boolean, default `true`)
- `confirm_domain` (string, up to 253 characters): The site's domain, typed exactly, to import on production.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "confirm_domain": {
      "description": "The site's domain, typed exactly, to import on production.",
      "maxLength": 253,
      "type": "string"
    },
    "drop_existing_tables": {
      "default": false,
      "type": "boolean"
    },
    "path": {
      "description": "Relative to the site root, or absolute under it.",
      "maxLength": 1024,
      "type": "string"
    },
    "safety_snapshot": {
      "default": true,
      "type": "boolean"
    },
    "sanitise": {
      "default": true,
      "type": "boolean"
    },
    "site_id": {
      "minimum": 1,
      "type": "integer"
    },
    "transfer_id": {
      "minimum": 1,
      "type": "integer"
    }
  },
  "required": [
    "site_id"
  ],
  "type": "object"
}
```

## Refusals

- `import_running`: another import into the same database is running or holds the reserved import slot (taken under the environment-row lock before any safety snapshot); wait for it.
- `snapshot_failed`: `corestack_db_import`'s safety snapshot failed; nothing was changed; retry once; then tell the person.
- `transfer_changed`: the transfer's object is not the generation recorded for it, or yields more bytes than its scan did; nothing was written; upload again.
- `checksum_mismatch`: the transfer's bytes do not match its declared `sha256`; nothing was written; upload again.
- `transfer_expiring`: the transfer has less life left than `mcp.transfers.min_consume_seconds`, so the run could outlive its object; upload it again, then call again.
- `sanitise_unparsed`: the SQL-aware sanitiser met a construct it cannot close; `details` names the byte offset; stopped before that statement reached `mariadb`; fix the dump, or call again with `sanitise: false`.
- `managed_elsewhere` (message: "This site is managed by another control panel"): another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

```json
{
  "name": "corestack_db_import",
  "arguments": {
    "site_id": 4211,
    "transfer_id": 2207,
    "drop_existing_tables": false
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_db_import with site_id 4211, transfer_id 2207, drop_existing_tables false. (Import into the database.) Tell me what it returned.
```

## The same task elsewhere

- Guide: [Database users](https://docs.corefinity.com/guides/sites/database/database-users.md)
