diff --git a/projects/DBETO-4397/Migration Plan.md b/projects/DBETO-4397/Migration Plan.md index 18e1a7e..ee5fb6e 100644 --- a/projects/DBETO-4397/Migration Plan.md +++ b/projects/DBETO-4397/Migration Plan.md @@ -1,230 +1,720 @@ -Paweł, dla DBA najbardziej ryzykowna jest migracja SQL Server Failover Cluster Instance (FCI), bo oprócz samych baz musisz przenieść również warstwę Windows Cluster, storage, konta serwisowe, zależności aplikacyjne i procedury HA/DR. W waszych ostatnich projektach migracyjnych przewijały się m.in. kwestie konfiguracji dysków, backupów natywnych SQL, kont serwisowych, AG oraz szczegółowego planu testów i rollbacku. citeturn3search17turn3search16turn3search19 +# SQL Server Failover Cluster Instance (FCI) Migration Runbook +## SQL Server 2016/2019 → SQL Server 2022 FCI -Poniżej checklista, którą sam stosowałbym przy migracji produkcyjnej instancji cluster SQL. +**Document Version:** 1.0 +**Migration Type:** Side-by-Side Cluster Migration +**Source Cluster:** _________________ +**Target Cluster:** _________________ +**Migration Date:** _________________ +**DBA Lead:** _________________ +**Windows Lead:** _________________ +**Business Owner:** _________________ -SQL Server Cluster Migration Checklist -Faza 0 - Discovery / Assessment -Inwentaryzacja SQL - Wersja SQL Server - CU/SP Level - Edition - Collation - Max Server Memory - TempDB Configuration - Trace Flags - Startup Parameters - SQL Configuration (sp_configure) - Service Accounts - Instant File Initialization -Inwentaryzacja baz - Lista baz - Rozmiary baz - Growth Settings - Recovery Model - Compatibility Level - TDE - CDC - Replication - Service Broker - CLR - FullText -Inwentaryzacja Security - SQL Logins - Windows Logins - Server Roles - Credentials - Certificates - Endpoints - SQL Audits +--- -Migracja loginów jest jednym z najczęściej pomijanych elementów. +# 1. Discovery Phase -SQL Agent - SQL Agent Jobs - Schedules - Operators - Alerts - Proxies +## 1.1 Existing Windows Cluster -Joby SQL Agent są często ważniejsze od samych baz danych. +### Cluster Inventory -Integracje - Linked Servers - Linked Login Mappings - SSIS Packages - Database Mail - ODBC DSNs - Shared Folders - Powershell scripts - Batch files -Faza 1 - Przygotowanie nowego klastra -Windows Cluster -Węzły - Ten sam patch level Windows - Ta sama strefa czasowa - Ta sama konfiguracja regionalna - Antivirus exclusions -Walidacja - Cluster Validation Report - Storage Validation - Network Validation -Storage -Dyski - Data - Log - TempDB - Backup - Quorum +- [ ] Cluster Name +- [ ] Cluster Nodes +- [ ] Cluster Networks +- [ ] Cluster Quorum Type +- [ ] Witness Configuration +- [ ] Cluster Functional Level +- [ ] Patching Level -Podczas waszych migracji pojawiał się temat osobnych dysków danych, logów, backupów i swap. +### Cluster Validation -Performance - IOPS Validation - Latency Validation - Throughput Validation -SQL Installation -Instalacja - Install FCI Node1 - Add Node2 - Install same CU - Enable TCP/IP -Konfiguracja - Max Memory - MaxDOP - Cost Threshold - Backup Compression - IFI -Faza 2 - Test Migration -Backup Test - Full Backup - Restore Test - DBCC CHECKDB +```powershell +Get-Cluster +Get-ClusterNode +Get-ClusterNetwork +Get-ClusterQuorum +``` -W waszych planach migracyjnych DBCC CHECKDB i test restore są obowiązkowe przed produkcją. +- [ ] Validation report collected +- [ ] No unresolved cluster issues +- [ ] Failover history reviewed -Aplikacje - Test Login - Test Reads - Test Writes - ETL Tests - Reporting Tests -Failover Tests - Manual Failover - Automatic Failover - Node Reboot Test - Cluster Service Restart -Faza 3 - Change Preparation -Dokumentacja - Implementation Plan - Test Plan - Rollback Plan -Cutover Readiness -Potwierdzenie - CAB Approved - Business Approved - Application Teams Ready - Monitoring Team Ready - Backup Team Ready -Faza 4 - Cutover -Start Change - Powiadomienie interesariuszy - Change bridge uruchomiony - Monitoring aktywny -Zamrożenie aktywności -Jobs - Disable Source Jobs -Aplikacje - Stop Writes - Disconnect Users +--- -Takie kroki występują w realnych planach migracji w D&B. +# 2. SQL Server Inventory -Backup Finalny - Full Backup - Tail Log Backup - VERIFYONLY -Restore - Restore Full - Restore Diff - Restore Logs - Recover -Security - Logins - Credentials - Linked Servers - Database Mail -Jobs - Import Jobs - Import Operators - Import Alerts -Integracje - Shared Folders - ETL - SSIS -Faza 5 - Validation -SQL - Database ONLINE - CHECKDB - Error Log Clean - Agent Running -Application - Login Success - Core Transactions - Reports - Interfaces -Performance - CPU - Memory - Wait Stats - Blocking - Latency -Faza 6 - Rollback Criteria +## SQL Instance -Rollback musi być zdefiniowany przed migracją. +```sql +SELECT @@VERSION; +``` -Uruchamiamy rollback gdy: +- [ ] SQL Version +- [ ] SQL Edition +- [ ] SQL CU/SP Level +- [ ] Instance Name +- [ ] Cluster Name +- [ ] Collation +- [ ] Authentication Mode +- [ ] Max Server Memory +- [ ] MaxDOP +- [ ] Cost Threshold +- [ ] TempDB Configuration +- [ ] Startup Parameters +- [ ] Trace Flags - Aplikacja nie działa - Utrata danych - Krytyczne błędy logowania - Niedziałające integracje - Niedziałający failover +--- -W waszych projektach rollback polegał na: +# 3. Database Inventory -przełączeniu aplikacji z powrotem na stary serwer, -wyłączeniu nowych jobów, -ponownym uruchomieniu jobów źródłowych, -walidacji działania aplikacji. -Najczęściej zapominane elementy +For each database: -To jest moja "DBA killer checklist": +- [ ] Name +- [ ] Data Size +- [ ] Log Size +- [ ] Recovery Model +- [ ] Compatibility Level +- [ ] Owner +- [ ] TDE Enabled +- [ ] CDC Enabled +- [ ] Replication +- [ ] Service Broker +- [ ] FullText +- [ ] CLR +- [ ] FILESTREAM +- [ ] Query Store - SQL Logins (SID mismatch) - Linked Servers - Linked Server Passwords - Credentials - SQL Agent Proxies - Service Accounts - SPN - Kerberos Delegation - SSIS Packages - Database Mail - SQL Audit - TDE Certificates - Backup Jobs - Monitoring Agents (Splunk) - Antivirus Exclusions - ODBC DSN - Windows Scheduled Tasks - DFS Shares - DNS Alias - Connection Strings - AG Listener - Maintenance Plans - CLR Assemblies - CDC - Replication - TempDB configuration +--- -Jeżeli migrujesz konkretnie FCI SQL 2016/2019/2022 → nowy FCI SQL 2022, mogę przygotować jeszcze bardziej szczegółowy runbook produkcyjny w formacie Markdown/Org-mode z dokładnym harmonogramem T-30, T-7, T-1, T0, T+1 oraz gotowymi skryptami SQL i PowerShell do każdego kroku. \ No newline at end of file +# 4. Instance Objects Inventory + +## Security + +- [ ] SQL Logins +- [ ] Windows Logins +- [ ] Server Roles +- [ ] Server Permissions +- [ ] Credentials +- [ ] Certificates +- [ ] Endpoints + +--- + +## SQL Agent + +- [ ] Jobs +- [ ] Schedules +- [ ] Operators +- [ ] Alerts +- [ ] Proxies + +--- + +## Integrations + +- [ ] Linked Servers +- [ ] Linked Server Login Mappings +- [ ] Database Mail +- [ ] SSIS Packages +- [ ] Maintenance Plans +- [ ] PowerShell Scripts +- [ ] Scheduled Tasks +- [ ] ODBC DSN + +--- + +# 5. New Cluster Build + +## Windows Server + +### Node 1 + +- [ ] Installed +- [ ] Patched +- [ ] Added to domain + +### Node 2 + +- [ ] Installed +- [ ] Patched +- [ ] Added to domain + +### Common Configuration + +- [ ] Same patch level +- [ ] Same time zone +- [ ] Antivirus exclusions +- [ ] Firewall rules +- [ ] Monitoring agent installed + +--- + +# 6. Storage Preparation + +## Shared Storage + +### Data + +- [ ] Presented to all nodes + +### Logs + +- [ ] Presented to all nodes + +### TempDB + +- [ ] Presented to all nodes + +### Backups + +- [ ] Presented to all nodes + +### Quorum + +- [ ] Configured + +--- + +## Storage Validation + +- [ ] MPIO configured +- [ ] Latency tested +- [ ] Throughput tested +- [ ] NTFS 64K Allocation Unit + +--- + +# 7. Build Windows Cluster + +## Install Features + +```powershell +Install-WindowsFeature Failover-Clustering -IncludeManagementTools +``` + +- [ ] Installed on Node1 +- [ ] Installed on Node2 + +--- + +## Cluster Validation + +```powershell +Test-Cluster +``` + +- [ ] Network validation passed +- [ ] Storage validation passed +- [ ] System validation passed + +--- + +## Create Cluster + +```powershell +New-Cluster +``` + +- [ ] Cluster created +- [ ] Cluster name online +- [ ] Cluster IP online +- [ ] Witness configured + +--- + +# 8. Install SQL Server 2022 FCI + +## Node 1 + +### Installation + +```text +New SQL Server Failover Cluster Installation +``` + +- [ ] SQL Engine installed +- [ ] SQL Agent installed +- [ ] FullText installed +- [ ] Instance name configured +- [ ] Virtual SQL Name configured +- [ ] SQL IP configured + +--- + +## Node 2 + +### Add Node + +```text +Add Node to Existing SQL Server Failover Cluster +``` + +- [ ] Node added successfully +- [ ] SQL Services online + +--- + +## Patch SQL + +- [ ] Latest approved CU installed +- [ ] Identical build on both nodes + +--- + +# 9. Cluster Validation + +## SQL Resource + +```powershell +Get-ClusterGroup +``` + +- [ ] SQL Group Online + +### Failover Test + +Node1 → Node2 + +```powershell +Move-ClusterGroup +``` + +- [ ] Successful + +Node2 → Node1 + +- [ ] Successful + +### SQL Validation + +```sql +SELECT +SERVERPROPERTY('ComputerNamePhysicalNetBIOS'); +``` + +- [ ] Correct owner node reported + +--- + +# 10. Migrate Instance Objects + +## Logins + +- [ ] SQL Logins +- [ ] SID preserved +- [ ] Roles preserved +- [ ] Permissions preserved + +--- + +## Linked Servers + +- [ ] Linked Servers migrated +- [ ] Passwords restored +- [ ] Connectivity tested + +--- + +## SQL Agent + +- [ ] Jobs imported +- [ ] Schedules imported +- [ ] Operators imported +- [ ] Alerts imported +- [ ] Proxies imported + +**Do not enable jobs yet.** + +--- + +## Database Mail + +- [ ] Accounts migrated +- [ ] Profiles migrated +- [ ] Test mail successful + +--- + +# 11. Restore Testing + +## Backup + +```sql +BACKUP DATABASE +``` + +- [ ] Completed + +--- + +## Verify + +```sql +RESTORE VERIFYONLY +``` + +- [ ] Successful + +--- + +## Restore + +```sql +RESTORE DATABASE +``` + +- [ ] Successful + +--- + +## CHECKDB + +```sql +DBCC CHECKDB +``` + +- [ ] Successful + +--- + +# 12. Cutover Readiness + +## Frozen Changes + +- [ ] No schema changes +- [ ] No new jobs +- [ ] No new logins +- [ ] No application releases + +--- + +## Stakeholders + +- [ ] Business Owner ready +- [ ] Application Owner ready +- [ ] DBA ready +- [ ] Windows Team ready + +--- + +## Rollback Prepared + +- [ ] Rollback approved +- [ ] Source cluster untouched +- [ ] Backups validated + +--- + +# 13. Production Cutover + +## Start Change + +- [ ] Open bridge call +- [ ] Notify stakeholders + +--- + +## Source System + +### Disable Jobs + +- [ ] Disable SQL Agent jobs + +### Stop Applications + +- [ ] Stop application services + +### Stop ETL + +- [ ] Stop ETL jobs + +--- + +## Final Backup + +### Full + +```sql +BACKUP DATABASE +``` + +### Log + +```sql +BACKUP LOG +``` + +### Verify + +```sql +RESTORE VERIFYONLY +``` + +--- + +# 14. Restore Production Databases + +### Full Backup + +```sql +RESTORE DATABASE +WITH NORECOVERY +``` + +### Log Backups + +```sql +RESTORE LOG +WITH NORECOVERY +``` + +### Recovery + +```sql +RESTORE DATABASE +WITH RECOVERY +``` + +--- + +# 15. Post-Restore Configuration + +## Security + +- [ ] Logins verified +- [ ] Credentials verified +- [ ] Certificates installed + +--- + +## Agent + +- [ ] Jobs enabled +- [ ] Operators enabled +- [ ] Alerts enabled + +--- + +## Integrations + +- [ ] Linked Servers tested +- [ ] Database Mail tested +- [ ] SSIS tested + +--- + +# 16. Application Cutover + +## Connection Strings + +- [ ] Updated + +OR + +## DNS Alias + +- [ ] Updated + +OR + +## SQL Alias + +- [ ] Updated + +--- + +## Validation + +- [ ] Login works +- [ ] Read operations work +- [ ] Write operations work + +--- + +# 17. Smoke Testing + +## Database Checks + +```sql +SELECT +name, +state_desc +FROM sys.databases +``` + +- [ ] All databases ONLINE + +--- + +## SQL Agent + +- [ ] Agent running + +--- + +## Backups + +- [ ] Backup path reachable + +--- + +## Database Mail + +- [ ] Test email successful + +--- + +# 18. Failover Validation + +## Manual Failover + +Node1 → Node2 + +```powershell +Move-ClusterGroup +``` + +- [ ] Successful + +### Validate + +- [ ] Applications reconnect +- [ ] SQL accessible +- [ ] Jobs operational + +--- + +## Manual Failback + +Node2 → Node1 + +- [ ] Successful + +### Validate + +- [ ] Applications reconnect +- [ ] SQL accessible +- [ ] Jobs operational + +--- + +# 19. Rollback + +## Rollback Criteria + +- [ ] Critical application failure +- [ ] Data inconsistency +- [ ] Login failures +- [ ] Cluster instability +- [ ] Critical ETL failure +- [ ] Unacceptable performance + +--- + +## Rollback Actions + +### Stop Target + +- [ ] Stop Applications +- [ ] Disable Jobs + +### Revert Connections + +- [ ] Restore source connection strings +- [ ] Restore source DNS + +### Reactivate Source + +- [ ] Enable source jobs +- [ ] Enable source applications + +### Validation + +- [ ] Login works +- [ ] Read works +- [ ] Write works + +--- + +# 20. Post Migration Validation + +## First 24 Hours + +- [ ] SQL Error Logs +- [ ] Windows Event Logs +- [ ] Cluster Logs +- [ ] Backup Jobs +- [ ] Application Logs +- [ ] Monitoring Alerts + +--- + +## First 7 Days + +- [ ] Database Growth +- [ ] CPU Usage +- [ ] Memory Usage +- [ ] Wait Statistics +- [ ] Blocking Events +- [ ] Backup Success + +--- + +## Decommission Source Cluster + +Only after sign-off. + +- [ ] Business Approval +- [ ] Application Approval +- [ ] DBA Approval +- [ ] Backup Validation +- [ ] Monitoring Validation + +### Final Tasks + +- [ ] Update CMDB +- [ ] Update Documentation +- [ ] Archive Backup +- [ ] Disable Source SQL +- [ ] Remove Source Cluster + +--- + +# FCI DBA Killer Checklist + +Najczęściej zapominane elementy: + +- [ ] SQL Agent Schedules +- [ ] SQL Agent Proxies +- [ ] Linked Server Passwords +- [ ] TDE Certificates +- [ ] Service Accounts +- [ ] SPN Registration +- [ ] Kerberos Delegation +- [ ] ODBC DSN +- [ ] Shared Folders +- [ ] Scheduled Tasks +- [ ] SSIS Packages +- [ ] Database Mail +- [ ] Antivirus Exclusions +- [ ] Backup Jobs +- [ ] Monitoring Configuration +- [ ] TempDB Layout +- [ ] Trace Flags +- [ ] DNS Aliases +- [ ] Cluster Quorum +- [ ] Failover Testing + +--- + +# Migration Success Criteria + +- [ ] Databases ONLINE +- [ ] Applications functional +- [ ] SQL Agent functional +- [ ] Backups functional +- [ ] Monitoring functional +- [ ] Failover tested +- [ ] Failback tested +- [ ] Performance acceptable +- [ ] Business sign-off received \ No newline at end of file