SQL Server → SQL Server (Docker Source, Local/On-Prem Target)
Step-by-step procedure for a same-engine SQL Server migration using the
downloadable EB_SampleDB_sqlserver.sql sample database as a
Docker-hosted source. Built to exercise the full feature set covered in this
SOP: temporal tables, SQL Agent jobs/operators/alerts, Database Mail and SSIS
detection, self-referencing foreign keys, and idempotent re-runs.
Overview & Scope
This SOP is a training/demo lab, not a production runbook — it uses the sample database bundled with Endrias Bridge to build hands-on familiarity with the parts of a SQL Server → SQL Server migration that don't show up in a plain table-and-data copy: server-level objects (SQL Agent, Database Mail, SSIS, linked servers), system-versioned temporal tables, and self-referencing foreign keys.
What This Lab Exercises
| Feature | Status | What to expect |
|---|---|---|
| Schema + data copy, 37 tables | Core | Full referential-integrity copy — PKs, FKs, indexes, defaults, check constraints. |
| System-versioned temporal table | Auto | dbo.products + dbo.products_history. SYSTEM_VERSIONING is disabled before copy and re-enabled after, automatically. |
| Self-referencing FK | Auto | dbo.gov_employees.supervisor_id → gov_employees.employee_id. Disabled with NOCHECK during parallel copy, re-validated after. |
| SQL Agent jobs, operator, alert | Opt-in | 3 jobs (1 disabled by design), 1 operator, 1 alert. Requires the Migrate tab checkbox — off by default. |
| Database Mail | Detect only | 1 sample profile. Health Check flags it; never auto-migrated (credentials are encrypted, unrecoverable). |
| SSIS package (legacy storage) | Detect only | 1 sample package. Health Check flags it; not auto-migrated. |
| Views, procs, functions, triggers, table types | Auto | Applied automatically on the schema-objects step of a same-engine migration. |
| Post-migration verification | Auto | Row counts + checksums per table, including the temporal table's open-row sentinel. |
| Re-apply Schema Objects (idempotent re-run) | Auto | Safe to run any number of times after a successful migration — already-correct objects are skipped, not re-broken. |
Prerequisites — Source (Docker)
| Requirement | Notes |
|---|---|
| Docker Desktop installed and running | Any recent version; no special configuration needed |
| SQL Server 2022 container, port 1433 published to the host | See Step 1 for the exact docker run command |
sample_databases/EB_SampleDB_sqlserver.sql downloaded |
Same file the website download serves — the website/ and sample_databases/ copies are kept identical |
| SQL Server Agent running inside the container | Starts automatically with the container; required for the SQL Agent jobs/operator/alert section of the script |
Prerequisites — Target (Local / On-Prem SQL Server)
| Requirement | Notes |
|---|---|
| Any SQL Server 2016+ instance reachable from the migration host | Native Windows install, another Docker container, or a VM — all work identically |
| SQL login with rights to create databases, or the target database pre-created | The wizard auto-creates the target database if it doesn't exist and the login has dbcreator |
| SQL Server Agent running (only if testing the Agent-objects checkbox) | Not required for the base schema+data copy |
| ODBC Driver 18 for SQL Server installed on the migration host | Bundled with the Endrias Bridge installer |
EB_SampleDB)
instead of silently landing in whatever database your login defaults to.
This applies to the initial migration and to a later "Re-apply
Schema Objects" run.Stand Up the Docker Source
Run a fresh SQL Server 2022 container and load the sample database script into it.
docker run -d --name eb-sqlserver-demo -p 1433:1433 ^
-e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=YourStrong!Passw0rd" ^
mcr.microsoft.com/mssql/server:2022-latest
REM Wait ~10-15 seconds for the instance to finish starting, then:
sqlcmd -S localhost,1433 -U sa -P "YourStrong!Passw0rd" -C ^
-i EB_SampleDB_sqlserver.sql
The script is idempotent — safe to re-run against the same container as many
times as you want while practicing. It builds EB_SampleDB with all
37 tables across 6 industries, plus the temporal table, SQL Agent objects,
Database Mail profile, and SSIS package listed above.
sqlcmd -S localhost,1433 -U sa -P "YourStrong!Passw0rd" -C -Q "
SELECT COUNT(*) AS tables FROM EB_SampleDB.sys.tables;
SELECT temporal_type_desc FROM EB_SampleDB.sys.tables WHERE name='products';
SELECT COUNT(*) AS jobs FROM msdb.dbo.sysjobs WHERE name LIKE 'EB_%';
SELECT COUNT(*) AS mail_profiles FROM msdb.dbo.sysmail_profile;
"
Expected: 38 tables (37 + products_history), SYSTEM_VERSIONED_TEMPORAL_TABLE, 3 jobs, 1 mail profile.
Configure Connections
Open Endrias Bridge and fill in Step 5's Source and Target connection fields.
SOURCE DATABASE
TARGET DATABASE
Run DMF Health Check
From the Tools tab, click Run DMF Scan. Against a fully-loaded sample database, expect exactly these flags — anything else is worth investigating.
Load Tables & Set Options
Switch to the Migrate tab, click Load Tables from Source, confirm all 37 tables are checked, and tick the SQL Agent checkbox to include jobs/operator/alert in this run.
Start Migration & Monitor
Click Start Migration. Watch for these specific log lines — they confirm the temporal-table and self-referencing-FK handling engaged correctly, not just that the copy finished.
self-ref FK disabled for bulk copy / re-enabled and
validated pair on gov_employees is the one to watch for —
this is exactly the mechanism that prevents a live FK violation from a child
row (e.g. an employee) landing in a different parallel-copy segment than its
own parent row (its supervisor).Verify Results
Post-migration verification runs automatically (if left checked in Step 4). Expect a clean pass on every table, including the temporal table.
gov_employees and products are called out
deliberately — they're the two tables that exercise the self-referencing-FK
and temporal-table fixes respectively. If either shows a row-count mismatch or
a "date value out of range" error, the target build predates those fixes.Re-apply Schema Objects (Idempotency Check)
From the Migrate tab, click Re-apply Schema Objects — this should be safe to run any number of times after a successful migration.
Known Issues & Fixes This Lab Validates
| Issue | Details |
|---|---|
| Self-referencing FK data loss | Fixed — a self-referencing table (like gov_employees) used to
risk a silent, permanent 1-row loss during parallel copy if the FK-disable
guard failed to engage. Step 5's log lines confirm it now runs on every SQL
Server target. |
| Temporal table verification crash | Fixed — a system-versioned temporal table's year-9999 "still open" sentinel
used to crash verification with "date value out of range." Step 6 confirms
products now verifies clean. |
| Re-apply Schema Objects on a versioned table | Fixed — re-running schema objects against an already-versioned temporal table used to fail outright (error 13592). Step 7 confirms it now skips cleanly instead. |
| Blank Target Database field | Fixed — leaving Step 5's Database field blank now correctly defaults to the source database's name for both the initial migration and Re-apply Schema Objects, instead of landing in whichever database your login defaults to. |
| Database Mail / SSIS packages | By design, detect-only. Neither can be fully automated — Database Mail's SMTP password and SSIS packages both require manual handling regardless of migration tool (see the SQL Server Agent operators/alerts note below for the same class of limitation). |
| SQL Agent operators/alerts on AWS RDS | Not applicable to this lab (target is a plain SQL Server instance, not RDS) — but if you swap the target for RDS, expect operators/alerts to be automatically skipped there; only jobs migrate on RDS. See SOP: SQL Server → AWS RDS. |