From 5529f489422c1c8ba9e57ac5ab9a44f3e0f8afd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Doma=C5=84ski?= Date: Mon, 10 Aug 2026 13:24:35 +0000 Subject: [PATCH] Aug 10, 2026, 3:24 PM --- projects/PARHEON/migration.md | 732 +++++++++++++++++++++++----------- 1 file changed, 506 insertions(+), 226 deletions(-) diff --git a/projects/PARHEON/migration.md b/projects/PARHEON/migration.md index ac2dea0..e316ce5 100644 --- a/projects/PARHEON/migration.md +++ b/projects/PARHEON/migration.md @@ -1,257 +1,537 @@ -Dla SQL Server Standalone runbook jest prostszy niż dla FCI, ale paradoksalnie częściej kończy się problemami, bo ludzie zapominają o jobach, linked serverach, ODBC, SSIS i konfiguracji systemowej. +# SQL Server Standalone Migration Runbook +## SQL Server 2016/2019 → SQL Server 2022 -Poniżej jest moja produkcyjna checklista DBA do migracji: +**Document Version:** 1.0 +**Migration Type:** Side-by-Side Migration +**Source Server:** _________________ +**Target Server:** _________________ +**Migration Date:** _________________ +**DBA:** _________________ -SQL Server Standalone → SQL Server 2022 Standalone +--- -1. Discovery / Assessment -Serwer źródłowy -System - Nazwa serwera - Windows Version - Patch Level - CPU - RAM - Dyski - Antivirus - Firewall rules - ODBC DSN - Scheduled Tasks -SQL Server +# 1. Discovery / Assessment + +## 1.1 Source Server Inventory + +### Operating System + +- [ ] Server name documented +- [ ] Windows version documented +- [ ] Windows patch level documented +- [ ] CPU configuration documented +- [ ] Memory configuration documented +- [ ] Disk layout documented +- [ ] Antivirus exclusions documented +- [ ] Firewall rules documented +- [ ] ODBC DSNs documented +- [ ] Windows Scheduled Tasks documented + +### SQL Server Instance + +```sql SELECT @@VERSION; +``` - SQL Version - SQL Edition - CU/SP - Collation - Authentication Mode - Max Server Memory - MaxDOP - Cost Threshold - Trace Flags - TempDB Configuration - Backup Compression - IFI -2. Inwentaryzacja baz +- [ ] SQL Version +- [ ] SQL Edition +- [ ] SQL Build Number +- [ ] SQL CU/SP Level +- [ ] Collation +- [ ] Authentication Mode +- [ ] Max Server Memory +- [ ] MaxDOP +- [ ] Cost Threshold for Parallelism +- [ ] Trace Flags +- [ ] Startup Parameters +- [ ] TempDB Configuration +- [ ] Backup Compression Settings +- [ ] Instant File Initialization Status -Dla każdej bazy: +--- - Nazwa - Rozmiar - Recovery Model - Compatibility Level - Owner - TDE - CDC - Replication - Service Broker - FullText - FileStream - CLR - Query Store -3. Obiekty instancji -Security - SQL Logins - Windows Logins - Server Roles - Credentials - Certificates - Endpoints -SQL Agent - Jobs - Job Steps - Schedules - Operators - Alerts - Proxies -Integracje - Linked Servers - Linked Server Logins - Database Mail - SSIS Packages - Maintenance Plans - PowerShell Scripts - Batch Files -4. Nowy serwer -Windows - Serwer zbudowany - Join do domeny - Patchowanie - AV exclusions - Firewall -Dyski +# 2. Database Inventory -Przykład: +For each database collect: +- [ ] Database Name +- [ ] Size (Data / Log) +- [ ] Recovery Model +- [ ] Compatibility Level +- [ ] Database Owner +- [ ] AutoGrowth Settings +- [ ] TDE Enabled +- [ ] CDC Enabled +- [ ] Replication Enabled +- [ ] Service Broker +- [ ] FullText Search +- [ ] FileTables / FILESTREAM +- [ ] CLR Assemblies +- [ ] Query Store +- [ ] Database Scoped Credentials + +### Database Report + +```sql +SELECT + name, + compatibility_level, + recovery_model_desc, + state_desc +FROM sys.databases; +``` + +--- + +# 3. Instance Objects Inventory + +## Security + +- [ ] SQL Logins +- [ ] Windows Logins +- [ ] Server Roles +- [ ] Credentials +- [ ] Endpoints +- [ ] Certificates +- [ ] Server Permissions + +## SQL Agent + +- [ ] Jobs +- [ ] Job Steps +- [ ] Schedules +- [ ] Operators +- [ ] Alerts +- [ ] Proxies + +## Integrations + +- [ ] Linked Servers +- [ ] Linked Server Login Mappings +- [ ] Database Mail +- [ ] Maintenance Plans +- [ ] SSIS Packages +- [ ] PowerShell Scripts +- [ ] Batch Files +- [ ] External Interfaces + +--- + +# 4. Target Server Preparation + +## Windows Configuration + +- [ ] Server built +- [ ] Joined to domain +- [ ] Latest approved patches installed +- [ ] Antivirus configured +- [ ] Firewall configured +- [ ] Monitoring agent installed +- [ ] Backup agent installed + +## Storage Layout + +Example: + +```text C: OS D: SQL Binaries E: Data -F: Log +F: Logs G: TempDB -H: Backup +H: Backups +``` - Wolumeny utworzone - NTFS 64K - Uprawnienia nadane -5. Instalacja SQL 2022 -Instalacja - SQL Engine - Agent - FullText (jeśli używany) -Konfiguracja - Port TCP - Max Memory - MaxDOP - Cost Threshold - Backup Compression - IFI -6. Migracja obiektów instancji -Logins - Migracja z SID - Role - Permissions -Linked Servers - Linked Servers - Login Mapping - Hasła -Database Mail - Accounts - Profiles - Test mail -Agent - Jobs - Schedules - Operators - Alerts - Proxies -7. Test Restore +### Validation -Dla każdej bazy: +- [ ] Disk letters match design +- [ ] NTFS Allocation Unit Size = 64K +- [ ] Capacity validated +- [ ] Permissions configured -Backup -BACKUP DATABASE db -TO DISK='...' -WITH COMPRESSION,CHECKSUM; +--- -Restore +# 5. SQL Server 2022 Installation + +## Installation + +- [ ] SQL Engine installed +- [ ] SQL Agent installed +- [ ] Full Text Search installed (if required) +- [ ] Latest approved CU installed + +## Initial Configuration + +- [ ] TCP/IP enabled +- [ ] Static TCP Port configured +- [ ] Max Server Memory configured +- [ ] MaxDOP configured +- [ ] Cost Threshold configured +- [ ] IFI enabled +- [ ] TempDB configured +- [ ] Error Log retention configured + +### Validation + +```sql +SELECT @@VERSION; +``` + +--- + +# 6. Migrate Instance Objects + +## Logins + +- [ ] Script logins with SID +- [ ] Migrate server roles +- [ ] Migrate permissions +- [ ] Validate orphaned users + +## Linked Servers + +- [ ] Linked Servers migrated +- [ ] Login mappings configured +- [ ] Passwords restored +- [ ] Connectivity tested + +## Database Mail + +- [ ] Accounts created +- [ ] Profiles created +- [ ] Test email sent + +## SQL Agent + +- [ ] Jobs imported +- [ ] Schedules imported +- [ ] Operators imported +- [ ] Alerts imported +- [ ] Proxies imported + +**Keep all jobs disabled until cutover.** + +--- + +# 7. Migration Testing + +## Restore Test + +### Backup + +```sql +BACKUP DATABASE +TO DISK = '' +WITH CHECKSUM, COMPRESSION; +``` + +### Verify + +```sql RESTORE VERIFYONLY +FROM DISK = ''; +``` - VERIFYONLY - Restore Test - CHECKDB -8. Tydzień przed migracją -Freeze - Brak zmian schematu - Brak nowych jobów - Brak nowych loginów - Brak nowych linked serverów -Test aplikacji - Login - Odczyt - Zapis - Raporty - ETL -9. Cutover -Start - Aplikacje stop - ETL stop - Joby stop -Final Backup -Full -BACKUP DATABASE +### Restore -Log -BACKUP LOG +```sql +RESTORE DATABASE +FROM DISK = ''; +``` -Restore -Full -RESTORE DATABASE -WITH NORECOVERY +### Validation -Logi -RESTORE LOG +- [ ] Restore successful +- [ ] CHECKDB successful +- [ ] Application connectivity successful -Recovery -WITH RECOVERY +--- -Security - Logins - Credentials - Linked Servers - Database Mail -Jobs - Import - Enable -10. Smoke Test -SQL - Wszystkie bazy ONLINE - Logins działają - Agent działa - Backup działa -Aplikacja - Login - Read - Write - Raport -ETL - Job Success - SSIS Success - Import działa -11. Performance Validation +# 8. T-7 Days Activities -Porównanie do starego serwera: +## Change Freeze - CPU - RAM - IOPS - PLE - Wait Stats - Blocking -12. Rollback +- [ ] No schema changes +- [ ] No new jobs +- [ ] No new linked servers +- [ ] No major application releases -Warunki rollback: +## User Acceptance Testing - aplikacja nie startuje - błędy logowania - utrata danych - krytyczne ETL nie działa - brak wydajności -Procedura -Stop nowego środowiska - Disable Jobs - Stop Applications -Powrót - Connection Strings -> stary SQL - Enable Source Jobs - Uruchom aplikacje -Test - Login - Read - Write -13. Najczęściej zapominane rzeczy +- [ ] Login test +- [ ] Read test +- [ ] Write test +- [ ] Reporting test +- [ ] ETL test -To jest moja „killer checklist”: +--- - SQL Agent Schedules - SQL Agent Proxies - Linked Server Passwords - ODBC DSN - Windows Scheduled Tasks - Database Mail - TDE Certificates - Backup Jobs - Maintenance Plans - PowerShell scripts - SSIS packages - CLR Assemblies - Service Broker - Monitoring (Splunk) - Antivirus exclusions - Connection strings - Shared folders - Startup parameters - TempDB configuration - Trace flags - Local service accounts +# 9. Cutover Activities -Jeżeli migracja dotyczy typowego środowiska D&B (np. SQL 2016/2019 → SQL 2022), to ja dodatkowo zawsze dopisuję jeszcze sekcję „Post Migration 30 dni”, czyli kontrolę backupów, jobów, wzrostu baz, indeksów i ewentualne podniesienie compatibility level dopiero po zakończeniu okresu stabilizacji. \ No newline at end of file +## Start Change + +- [ ] Open bridge call +- [ ] Confirm stakeholders available +- [ ] Confirm rollback owner + +--- + +## Disable Source Activity + +### SQL Agent + +- [ ] Disable jobs + +### Applications + +- [ ] Stop application services +- [ ] Stop ETL processes +- [ ] Stop integrations + +--- + +## Final Backup + +### Full Backup + +```sql +BACKUP DATABASE +TO DISK=''; +``` + +### Transaction Log Backup + +```sql +BACKUP LOG +TO DISK=''; +``` + +### Validation + +- [ ] Backup completed +- [ ] VERIFYONLY successful + +--- + +## Restore to SQL 2022 + +### Restore Full + +```sql +RESTORE DATABASE +FROM DISK='' +WITH NORECOVERY; +``` + +### Restore Logs + +```sql +RESTORE LOG +FROM DISK='' +WITH NORECOVERY; +``` + +### Recover Database + +```sql +RESTORE DATABASE +WITH RECOVERY; +``` + +--- + +# 10. Post-Restore Configuration + +## Security + +- [ ] Logins validated +- [ ] Credentials migrated +- [ ] Linked servers validated +- [ ] Database Mail validated + +## SQL Agent + +- [ ] Jobs enabled +- [ ] Schedules enabled +- [ ] Operators enabled +- [ ] Alerts enabled + +--- + +# 11. Smoke Testing + +## SQL Validation + +- [ ] Databases ONLINE +- [ ] SQL Agent running +- [ ] Logins functional +- [ ] Backup path accessible +- [ ] Database Mail functional + +### Validation Query + +```sql +SELECT + name, + state_desc +FROM sys.databases; +``` + +--- + +## Application Validation + +- [ ] Login works +- [ ] Read operations work +- [ ] Write operations work +- [ ] Reports work + +--- + +## ETL Validation + +- [ ] ETL jobs complete successfully +- [ ] SSIS packages execute successfully +- [ ] Data import/export successful + +--- + +# 12. Performance Validation + +Compare against source server baseline. + +## Metrics + +- [ ] CPU +- [ ] Memory +- [ ] Disk Latency +- [ ] Blocking +- [ ] Wait Statistics +- [ ] TempDB Usage +- [ ] Backup Throughput + +### Wait Stats + +```sql +SELECT TOP (20) + wait_type, + wait_time_ms +FROM sys.dm_os_wait_stats +ORDER BY wait_time_ms DESC; +``` + +--- + +# 13. Rollback Plan + +## Rollback Criteria + +Rollback if: + +- [ ] Application unavailable +- [ ] Data inconsistency +- [ ] Critical login failures +- [ ] ETL failures +- [ ] Severe performance degradation + +--- + +## Rollback Steps + +### Stop Target Environment + +- [ ] Disable target jobs +- [ ] Stop application services + +### Redirect Applications + +- [ ] Revert connection strings +- [ ] Revert DNS aliases + +### Enable Source + +- [ ] Enable source jobs +- [ ] Start source applications + +### Validate + +- [ ] Login successful +- [ ] Read successful +- [ ] Write successful + +--- + +# 14. 24-Hour Validation + +- [ ] Review SQL Error Logs +- [ ] Review Windows Event Logs +- [ ] Validate Backup Success +- [ ] Validate Job Success +- [ ] Validate Monitoring Alerts +- [ ] Validate ETL Execution + +--- + +# 15. 30-Day Stabilization + +## Daily Review + +- [ ] Backup Status +- [ ] Failed Jobs +- [ ] Database Growth +- [ ] Disk Consumption +- [ ] Blocking Events +- [ ] Long Running Queries + +--- + +## Post-Stabilization Tasks + +- [ ] Raise compatibility level (if planned) +- [ ] Enable Query Store tuning (if planned) +- [ ] Remove old server references +- [ ] Update CMDB +- [ ] Update documentation +- [ ] Schedule source server decommission + +--- + +# DBA Killer Checklist + +Most frequently forgotten migration items: + +- [ ] SQL Agent Schedules +- [ ] SQL Agent Proxies +- [ ] Linked Server Passwords +- [ ] ODBC DSNs +- [ ] Scheduled Tasks +- [ ] Database Mail +- [ ] TDE Certificates +- [ ] Backup Jobs +- [ ] Maintenance Plans +- [ ] SSIS Packages +- [ ] CLR Assemblies +- [ ] Service Broker +- [ ] Monitoring Agents +- [ ] Antivirus Exclusions +- [ ] Shared Folders +- [ ] Connection Strings +- [ ] TempDB Configuration +- [ ] Trace Flags +- [ ] Startup Parameters +- [ ] Local Service Accounts + +--- + +# Migration Success Criteria + +Migration is successful when: + +- [ ] All databases are ONLINE +- [ ] Applications connected successfully +- [ ] ETL processes completed successfully +- [ ] SQL Agent jobs functioning +- [ ] Backups functioning +- [ ] Monitoring functioning +- [ ] Performance acceptable +- [ ] Business owner sign-off received \ No newline at end of file