1.5 KiB
1.5 KiB
Usage – Data Copy (Variant B / Checkpointing)
Preconditions
- Target database exists (e.g. UTF-8 collation)
- Target schema is deployed (tables, constraints, indexes, views, procs, triggers, users/roles etc.)
- You can connect to the SQL Server instance with sufficient permissions.
Run
Open scripts/migrate_copy_checkpoint.sql in SSMS.
At the top configure:
@SourceDb(default:sysdb_UTF8)@TargetDb(default:sysdb_utf8_jr)
Optional behavior:
-
@ModeRESUME(default): skip tables already markedDONERESET: reset state and rerun all tables
-
@StopOnError1(default): stop on first table error0: continue with next tables; checkdbo.MigrationStateafterwards
-
@BatchSize- used for tables with
IDENTITY (int/bigint)to copy in chunks
- used for tables with
Execute the script.
Monitoring
The script prints progress like:
... | TABLE_START | dbo.TableX... | TABLE_DONE | dbo.TableX | Old=... New=...... | TABLE_FAILED | dbo.TableX | Error ...
In target DB you also have:
dbo.MigrationState(table-level status)dbo.MigrationCopyLog(append-only log)
Useful queries:
USE sysdb_utf8_jr;
SELECT * FROM dbo.MigrationState ORDER BY Status, TableSchema, TableName;
SELECT TOP 200 * FROM dbo.MigrationCopyLog ORDER BY LogId DESC;
Rerun behavior
Each table is copied as:
DELETE FROM target.tableINSERT INTO target.table SELECT ... FROM source.table
So reruns are safe. The checkpoint state enables resuming.