---
description: "From analysing an external source to the Firebird import: steps, checks and troubleshooting."
---

# From analysis to import

This guide follows the full path: register a SQL Server source, analyse it, translate in the workshop, create the target database and import the data. Each step ends with a check that prevents discovering a problem at the very end.

| Step | Screen | Expected result |
|---|---|---|
| 1. Source | Explorer → **External databases** | connection tested, source registered |
| 2. Analysis | **Analyse and save** | catalogue + blank compilation |
| 3. Workshop | `/migration/external/{project}` | skeletons translated and tested |
| 4. Target | **Migrate data** | Firebird database created |
| 5. Import | import wizard | data loaded, constraints active |
| 6. Verification | SQL, comparison, `gfix` | counts and plans consistent |

## Before you start

- **5.0** (system database) and **6.0** (target) kits installed and readable: see [Firebird kits](/en/guide/kits-firebird);
- SQL Server account with **read-only** access;
- disk space for the target database and the backups;
- a **copy** of the target database if it already exists, plus a system database backup;
- a **Firebird 6.0** target if the schema uses the `MSSQL_SCHEMA` compatibility views (Firebird schemas).

## 1. Register the external source

In the explorer, **External databases → + External…**:

1. unique name, **Microsoft SQL Server** engine;
2. connection string (encrypted at rest, never logged);
3. **Test connection**: version, database and volume must appear.

A `.fbk` or `.fdb` file is restored, not analysed: these are two different entries.

## 2. Analyse the schema

The **Analyse and save** button saves the source and starts the analysis in the background. The progress page shows the phases (read, resolution, DDL, blank compilation) and allows cancellation.

At the end, check the top of the report:

- **Target**: the intended Firebird version (6.0 for `MSSQL_SCHEMA`);
- **counts**: tables, views, procedures, functions, triggers, constraints, indexes;
- **diagnostics**: adjusted types, skeletons, warnings — these are not errors;
- **blank compilation**: it uses **the catalogue target** and a **32 KB** workspace database.

Compilation codes to know:

| Code | Cause | Action |
|---|---|---|
| `firebird.kit.missing` | target version kit missing | install the kit (`fetch-kits.sh -k 6.0`) |
| `firebird.database.create` + localhost | embedded engine not loaded | see [Firebird kits](/en/guide/kits-firebird), check `plugins/` and `lib/` |
| `firebird.compile.schema_requires_fb6` | target < 6.0 with `CREATE SCHEMA` | remove `ExternalAnalysis:TargetVersion`, target 6.0 |
| `key size exceeds…` | index key too large for the page | 16/32 KB target (the tool recommends the size) |
| `COLLATION UNICODE …` | ICU collations from another engine | `gfix -icu` with the runtime (see Installation) |

A compilation error does not prevent opening the workshop: failing statements are listed with their number.

## 3. Work in the workshop

**Open the Workshop** asks for a project name, creates a project bound to the snapshot and opens the project page. The workshop contains:

- the list of translated objects with their state (to translate, translated, tested, skeleton, failure);
- editable skeletons: original T-SQL body in comments, Firebird header;
- **object-by-object testing**: commit if compilation succeeds, rollback and detailed error otherwise;
- recurring **domains**, applied to tables and headers;
- SQL **comment import** (`COMMENT ON`) per language;
- the append-only **log** and state snapshots;
- **rebuilding** the workspace database from the full script.

Project roles: **viewer**, **commenter**, **editor**, **owner**. An administrator sees all projects; others only see the projects they belong to.

Good practice: translate and test tables and constraints first, then views, procedures, functions and triggers. The rebuild must no longer report errors before the import.

## 4. Prepare the target database

In **Migrate data**, choose the target database (or create it):

- **16 or 32 KB page**: essential as soon as an Identity `VARCHAR(450)` key is indexed;
- **UTF8** charset, dialect 3;
- a path accessible to the service account, with room for data and the journal;
- back up the empty database immediately before the first load.

The wizard flags index keys that do not fit the chosen page and recommends a larger size.

## 5. Import the data

Select the tables (dependencies are ordered automatically), then start the import:

1. **load** phase: tables, domains, streaming load in batches, triggers disabled;
2. **finalize** phase: `NOT NULL`, PK/unique/FK/CHECK, indexes, comments, generators;
3. full schema in passes: functions and procedures (name + signature), views, triggers.

Monitor progress, loaded rows and per-table errors. The import is traceable and can be restarted after a fix.

## 6. Verify the result

- per-table counts: rows read = rows written;
- constraints and indexes present, triggers **active**;
- collations and charsets of text columns;
- value samples (dates, decimals, accented text);
- `gfix -v -full` on the target database;
- execution plans of sensitive queries;
- optional comparison with the source (comparison tool).

Finally: back up the target database and take a **snapshot** of the demo VM.

## Quick troubleshooting

| Symptom | First check |
|---|---|
| "Test connection" fails | network, port 1433, read-only SQL account, TLS |
| analysis stuck at 80% | blank compilation: read the statement and message |
| `CREATE SCHEMA` refused | 6.0 target (compilation follows the catalogue) |
| `key size exceeds…` | 16/32 KB page, or reduce the indexed column |
| empty workshop | project not created, or account not a project member |
| import interrupted | disk space, locks, triggers; restart and check the log |
| slow target database | `gfix -v -full`, `gstat`, missing indexes |

## Final checklist

- [ ] source registered and connection tested;
- [ ] analysis complete, blank compilation without errors;
- [ ] workshop with no skeleton left on used objects;
- [ ] target database at 16/32 KB, backed up while empty;
- [ ] import complete, triggers active, counts consistent;
- [ ] `gfix -v -full` and samples verified;
- [ ] final backup and VM snapshot.
