Initial version of collation migration scripts.
This commit is contained in:
50
README.md
Normal file
50
README.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# SQL Server Collation Migration (UTF-8 / UTF-16) – Data Copy + Verification
|
||||
|
||||
This repository contains **two main scripts** to support a SQL Server 2022 migration scenario:
|
||||
|
||||
1. **Data copy (Variant B / Checkpointing)**: copies data from a source database into a target database **table-by-table** with restart capability.
|
||||
2. **Verification / compare script**: compares source & target databases **without comparing row contents** (rowcounts + schema + programmable objects + principals).
|
||||
|
||||
> Intended usage: build a new target DB (e.g. UTF-8 collation), deploy schema, run copy, then verify.
|
||||
|
||||
## Repository layout
|
||||
|
||||
- `scripts/migrate_copy_checkpoint.sql`
|
||||
Copy data source → target (restartable, per-table commit, FK-aware order, live progress output)
|
||||
|
||||
- `scripts/compare_source_target.sql`
|
||||
Compare source vs target (**textual summaries + result sets**)
|
||||
- Rowcounts per table
|
||||
- Column schema diffs
|
||||
- Views/Procs/Functions hash compare
|
||||
- Trigger hash compare
|
||||
- Users/Roles + Role memberships
|
||||
|
||||
- `docs/USAGE.md`
|
||||
How to run the migration copy safely.
|
||||
|
||||
- `docs/VERIFY.md`
|
||||
How to run and interpret the compare results.
|
||||
|
||||
## Quickstart
|
||||
|
||||
1. Open **SQL Server Management Studio** (SSMS)
|
||||
2. Ensure target DB exists and schema is deployed
|
||||
3. Run:
|
||||
- `scripts/migrate_copy_checkpoint.sql`
|
||||
4. After successful copy, run:
|
||||
- `scripts/compare_source_target.sql`
|
||||
|
||||
Both scripts show **live progress output** in SSMS (Messages tab).
|
||||
|
||||
## Configuration
|
||||
|
||||
At the top of each script set:
|
||||
|
||||
- `@SourceDb` (default `sysdb_UTF8`)
|
||||
- `@TargetDb` (default `sysdb_utf8_jr`)
|
||||
|
||||
## Notes
|
||||
|
||||
- The copy script disables triggers, constraints, and nonclustered indexes in target during load and re-enables them afterwards.
|
||||
- The compare script uses hashes (SHA2_256) for object definitions to quickly detect differences.
|
||||
Reference in New Issue
Block a user