Thursday, May 21, 2026

MINUTE BY MINUITE PRODUCTION RUNBOOK FOR FULLY AUTOMATED MIGRATION FROM SAP ASE TO SQL Server Azure VM

MINUTE BY MINUITE PRODUCTION RUNBOOK FOR  FULLY AUTOMATED MIGRATION FROM SAP ASE TO SQL Server Azure VM


---


OVERALL STRUCTURE


Breaking execution phase into controlled phases with automation hooks:


1. Pre-Cutover Lockdown

2. Final Sync

3. Validation

4. Cutover

5. Post-Go-Live Stabilization


Each step includes:


* Time

* Script

* What

* Why


---


PHASE 1 — PRE-CUTOVER LOCKDOWN


---


T-10 MIN — PRE-FLIGHT CHECK (AUTOMATED)


---


PowerShell Script


```powershell


Write-Host "Starting Pre-Flight Checks..."


#Check SQL Server connectivity


Invoke-Sqlcmd -ServerInstance "SQLServerVM" -Query "SELECT GETDATE()"


#Check disk space


Get-PSDrive -PSProvider FileSystem


#Check SQL services


Get-Service -Name MSSQLSERVER

```


# WHAT


* Verifies SQL Server is reachable

* Confirms disk space

* Confirms services are running


---


#WHY


If anything fails here, STOP immediately.This avoids starting a migration on an unstable system.


---


T-5 MIN — FORCE DISCONNECT USERS


---


#SQL Script


```sql


ALTER DATABASE BankingDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

```


# WHAT


* Kicks out all users

* Ensures no active transactions


---


# WHY


Open transactions can leads to data inconsistency during final sync.


---


PHASE 2 — FINAL SYNC (CRITICAL DATA CONSISTENCY STEP)


---


#T+0 MIN — FREEZE SOURCE (ASE)


---


# ASE Command


```sql


sp_dboption dbname, 'read only', true

go

```


---


# WHAT


* Stops all writes to ASE


---


# WHY


The above script guarantees no new data changes during final sync.


---


T+2 MIN — RUN FINAL DELTA SYNC (AUTOMATED)


PowerShell + BCP


```powershell


$tables = @("Transactions","Accounts")


foreach ($table in $tables) {

    bcp "SELECT * FROM $table WHERE LastModified > '$LastSyncTime'" queryout "$table.dat" -S ASE_Server -T -c


    bcp "BankingDB.dbo.$table" in "$table.dat" -S SQLServerVM -T -c -b 100000 -h "TABLOCK"

}

```


# WHAT


* Extracts only changed data

* Loads into SQL Server


---


# WHY


* Avoids full reload

* Minimizes downtime


---


PHASE 3 — VALIDATION (NO SHORTCUTS HERE)


---


T+10 MIN — ROW COUNT VALIDATION


---


# SQL Script


```sql


SELECT 

    (SELECT COUNT(*) FROM ASE_DB.dbo.Transactions) AS ASE_Count,

    (SELECT COUNT(*) FROM BankingDB.dbo.Transactions) AS SQL_Count;

```


---


# WHAT


* Compares row counts


---


# WHY


Quick and effective first validation step


---


T+12 MIN — CHECKSUM VALIDATION


---


# SQL Script


```sql


SELECT CHECKSUM_AGG(BINARY_CHECKSUM(*)) 

FROM BankingDB.dbo.Transactions;

```


---


# WHAT


* Validates data integrity


---


# WHY


Row counts can match but data can still differ — this catches that


---


CONDITIONAL LOGIC (AUTOMATED DECISION)


---


# PowerShell Logic


```powershell


if ($ASE_Count -ne $SQL_Count) {

    Write-Host "Mismatch detected. Re-running sync..."

    # trigger re-sync

}

else {

    Write-Host "Validation passed"

}

```


---


# WHY


Automation removes human error in decision-making


---


PHASE 4 — CUTOVER (POINT OF NO RETURN)


---


T+15 MIN — SWITCH DATABASE MODE


---


# SQL Script


```sql


ALTER DATABASE BankingDB SET MULTI_USER;

```


---


# WHAT


* Allows users to connect


---


# WHY


System must be accessible before app connects


---


T+16 MIN — UPDATE CONNECTION STRING


---


#PowerShell (App Config Update)


```powershell


$config = "C:\App\config.xml"

(Get-Content $config) -replace "ASE_Server","SQLServerVM" | Set-Content $config

```


# WHAT


* Redirects application to SQL Server


---


# WHY


This is the **actual cutover moment**


---


# T+18 MIN — START APPLICATION


---


# PowerShell


```powershell


Start-Service -Name "BankingAppService"

```


---


# WHAT


* Brings application online


---


# WHY


Users can now access SQL Server instead of ASE


---


PHASE 5 — POST-GO-LIVE VALIDATION


---


# T+20 MIN — ACTIVE CONNECTION CHECK


---


# SQL Script


```sql


SELECT COUNT(*) FROM sys.dm_exec_sessions WHERE is_user_process = 1;

```


---


# WHAT


* Confirms users are connecting


---


# WHY


Validates real-world usage


---


T+25 MIN — PERFORMANCE CHECK


---


# SQL Script


```sql


SELECT wait_type, wait_time_ms 

FROM sys.dm_os_wait_stats

ORDER BY wait_time_ms DESC;

```


---


# WHAT


* Detects bottlenecks


---


# WHY


Early detection prevents production incidents


---


T+30 MIN — AUTOMATED BACKUP


---


# SQL Script


```sql


BACKUP DATABASE BankingDB

TO DISK = 'D:\Backup\post_cutover.bak'

WITH COMPRESSION;

```


---


# WHAT


* Takes immediate backup


---


# WHY


Creates a safe restore point after migration


---


FULL AUTOMATION MASTER SCRIPT (ORCHESTRATION)


---


## PowerShell MASTER RUNBOOK


```powershell


Write-Host "=== MIGRATION START ==="


# Step 1: Pre-check


Invoke-Sqlcmd -ServerInstance "SQLServerVM" -Query "SELECT GETDATE()"


# Step 2: Set single user


Invoke-Sqlcmd -Query "ALTER DATABASE BankingDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE"


# Step 3: Final sync


.\Run-DeltaSync.ps1


# Step 4: Validation


.\Run-Validation.ps1


# Step 5: Cutover


Invoke-Sqlcmd -Query "ALTER DATABASE BankingDB SET MULTI_USER"


# Step 6: Start app


Start-Service -Name "BankingAppService"


# Step 7: Backup


Invoke-Sqlcmd -Query "BACKUP DATABASE BankingDB TO DISK='D:\Backup\final.bak' WITH COMPRESSION"


Write-Host "=== MIGRATION COMPLETE ==="

```


---


FAILURE HANDLING (BUILT INTO RUNBOOK)


---


CASE 1 — DATA MISMATCH


# WHAT


* Stop process

* Re-run delta sync


# WHY


Ensures no corrupted data goes live


---


CASE 2 — APPLICATION FAILS


---


# Rollback Script


```powershell


Stop-Service "BankingAppService"


# Switch back config


(Get-Content $config) -replace "SQLServerVM","ASE_Server" | Set-Content $config


Start-Service "BankingAppService"

```


---


# WHY


Fast recovery = minimal business impact


---


CASE 3 — PERFORMANCE ISSUE


---


# WHAT


* Identify slow queries

* Scale Azure VM


---


# WHY


Cloud allows instant scaling


---


FINAL PRODUCTION CHECKLIST


---


Before declaring success:


* Data validated 

* Application working 

* Users connected 

* Backup completed 

* Performance stable 


---


FINAL INSIGHT (IMPORTANT)


This runbook works because:


* It removes guesswork

* It uses automation over manual steps

* It includes decision logic

* It assumes things can fail

Common Challenges in The Post Phase of Migrating Onprem SAP ASE Databases to SQL Server On Azure VM WITH VLDBS

 Common Challenges in The Post Phase of Migrating Onprem SAP ASE Databases to SQL Server On Azure VM WITH VLDBS


Migrating very large databases (VLDBs) from an on-premises SAP Adaptive Server Enterprise (ASE) environment to SQL Server on an Azure Virtual Machine is a massive achievement. However, because this is a heterogeneous migration (shifting database engines), the real engineering battle often begins *after* the cutover.


While tools like the SQL Server Migration Assistant (SSMA) handle basic object conversions well, they struggle to address the operational and behavioral differences under heavy, multi-terabyte enterprise workloads.


The following sections highlight critical post-migration challenges encountered with VLDB targets in this specific architecture, grouped by infrastructure, optimizer mechanics, and operational overhead.


---


1. Storage I/O Performance Degradation & Throttling


In an on-premises environment, storage arrays often deliver burstable, low-latency I/O without artificial caps. Moving to Azure VMs introduces **hard IOPS and throughput limits** at both the VM level and the disk level.


* The Challenge: A 20TB+ database executing large parallel queries or heavy batch processing can easily hit Azure Premium SSD v1/v2 or Ultra Disk throttling limits. If your workload exhausts its IOPS quota, Azure enforces steep latency penalties, stalling the entire application.


* Mitigation: Monitor Azure metrics for VM Cached IOPS Consumed Percentage and VM Uncached IOPS Consumed Percentage. Leverage Premium SSD v2 or Ultra Disks to independentally scale IOPS and throughput without needing to provision oversized disks just for performance capacity.


2. Shared-Everything Memory Architecture Shock


SAP ASE and SQL Server manage data cache structures fundamentally differently.


* The Challenge: SAP ASE allows you to explicitly partition data caches and bind specific high-traffic VLDB tables or indexes to dedicated named caches. This guarantees that critical transactional tables are never flushed out of memory by massive ad-hoc queries. SQL Server uses a single, global Buffer Pool managed by an LRU (Least Recently Used) algorithm. After cutover, a single large reporting query scan on a multi-terabyte table can clear the cache, forcing highly critical transactional data out of memory and introducing heavy disk-read latencies.


* Mitigation: Implement SQL Server **Resource Governor** to cap memory and CPU usage for heavy reporting workloads, or isolate massive analytical tasks via readable secondary replicas using Always On Availability Groups.


3. Storage Engine and Lock Escalation Issues


The concurrency models between the two engines differ significantly under VLDB scale.


* The Challenge: SAP ASE relies heavily on Allpages, Datapages, or Datarows locking schemes, which are explicitly declared at the table level. SQL Server automatically manages locking granularity dynamically. On multi-million row tables, SQL Server’s engine will routinely escalate row or page locks to a single exclusive Table Lock (LCK_M_X) once an operation crosses the 5,000-lock threshold on a single index level. This completely halts concurrent transactional access across massive tables.


* Mitigation: Alter critical tables to alter lock escalation behavior using ALTER TABLE ... SET (LOCK_ESCALATION = DISABLE) or evaluate the use of Optimistic Concurrency Mapping via Read Committed Snapshot Isolation (RCSI) to prevent readers from blocking writers.


4. Tempdb Bottlenecks (The Global Tempdb Shock)


Large-scale batch processes migrated from ASE often make extensive use of temporary tables.


* The Challenge: In SAP ASE, you can create separate, dedicated temporary databases and bind specific logins or applications to them to distribute I/O. In SQL Server, every single user, application, and background task shares a single, global tempdb. A massive VLDB data sorting operation or large-scale data staging process can cause severe allocation contention on Page Free Space (PFS) and Shared Global Allocation Map (SGAM) pages, leading to high PAGELATCH_ wait types.


* Mitigation: Configure multiple tempdb data files of equal size (typically matching the VM's vCPU count up to 8, then scaling by 4 if contention persists), enable **Optimized Metadata Tempdb** (ALTER SERVER CONFIGURATION SET MEMORY_OPTIMIZED TEMPDB_METADATA = ON), and place tempdb on the Azure VM's local ephemeral NVMe SSD (typically drive D:).


5. T-SQL Procedural Divergence & Variable Evaluation


While both engines use Dialects of Transact-SQL, subtle runtime programmatic variances manifest uniquely under massive processing loads.


* The Challenge: SSMA converts most procedural code, but it frequently introduces emulated wrapper functions for differences it cannot natively resolve. For example, in an UPDATE statement that alters both a table column and a variable, SAP ASE updates the column value before assigning it to the variable. SQL Server evaluates variables first. Under high-throughput VLDB batch updates, this can lead to silent logical data corruption or mismatched calculations that are difficult to trace.


* Mitigation: Audit code converted via SSMA for variable assignments within data modification statements (DML). Manually rewrite these processes to isolate calculations into explicit, multi-step queries.


6. Escalated Transaction Log Wear (syslogs vs. LDF)


Write-ahead logging architectures differ, which drastically changes the storage throughput requirements on Azure.


* The Challenge: In SAP ASE, the transaction log (syslogs) can operate with specific optimizations like minimal logging during bulk copy operations (bcp). In SQL Server, unless the database is explicitly switched to the BULK_LOGGED recovery model, massive VLDB batch operations will write heavily to the .ldf file. On an Azure VM, the write path to the transaction log must be highly optimized because SQL Server requires an acknowledgment from disk for every single commit. This can result in severe WRITELOG bottlenecks.


* Mitigation: Isolate the SQL Server transaction log onto a dedicated disk array with **Write Accelerator** enabled (available on M-series VMs) or use Azure Ultra Disks to maintain sub-millisecond write response times.


7. Outdated Statistics and Suboptimal Execution Plans


With multi-terabyte data distributions, standard automatic statistic updates can leave execution plans wildly inaccurate.


* The Challenge: SQL Server automatically triggers statistic updates based on a dynamic threshold of row changes. In a VLDB environment, a table with 100 million rows requires millions of modifications before an automatic update triggers. Consequently, the query optimizer may generate highly inefficient execution plans, using nested loops instead of hash joins, or choosing catastrophic table scans.


* Mitigation: Replace standard automatic statistics with custom, scheduled maintenance jobs utilizing UPDATE STATISTICS ... WITH FULLSCAN or a substantial SAMPLE rate for massive tables. Implement Query Store immediately post-migration to track, force, and remediate plan regressions in real time.


8. Missing Identity Column Optimization (syb_identity vs. IDENTITY)


* The Challenge: In SAP ASE, tables without an explicit primary key often rely on the implicit syb_identity pseudo-column for row targeting. When SSMA translates this schema, it converts it to a standard SQL Server IDENTITY column. For VLDBs, this can result in massive heap tables or tables with non-clustered indexes lacking an optimal clustered indexing layout. Without a physical clustered index, data inserts can cause heavy page fragmentation and slow down point-lookups across terabytes of data.


* Mitigation: Post-migration, evaluate the physical layout of converted heap tables. Build explicitly defined, narrow, non-updating **Clustered Indexes** on these tables to optimize how data is structurally organized on disk.


9. Breakdown of High-Availability and Disaster Recovery (HA/DR) SlAs


On-premises deployments typically feature highly customized, near-zero-latency local hardware replication or Sybase Replication Server loops.


* The Challenge: Moving a VLDB to Azure VM changes the network topology. If you implement **SQL Server Always On Availability Groups** across different Azure Availability Zones (or Regions) for HA/DR, the network latency of synchronous replication will directly throttle the primary database's commit times. For a high-throughput enterprise workload, this can cause transaction response times to spike significantly compared to on-premises performance.


* Mitigation: Measure network round-trip time (RTT) between Azure nodes. Enable Accelerated Networking on all VM network interfaces. If network latency is prohibitive, consider running the Availability Group in Asynchronous Commit mode for the DR site, ensuring the primary node is uninhibited by cloud-network transit times.


10. Operational Backup and VLDB Maintenance Window Collapse


On-premises storage fabrics frequently utilize storage-level snapshots to complete instantaneous, zero-impact backups of multi-terabyte environments.


* The Challenge: Once shifted to an Azure VM running native SQL Server, standard maintenance schedules can collapse. Running standard DBCC CHECKDB integrity checks or rebuilding fragmented indexes on a 30TB database using traditional native scripts can take hours, exhausting maintenance windows, inflating storage costs, and impacting production performance.


* Mitigation: Modernize your infrastructure maintenance stack. Utilize Azure VM Backup (which leverages volume shadow copy service, or VSS snapshots, at the Azure storage layer) to achieve application-consistent backups without exhausting VM computing resources. For index optimization, transition to smart, threshold-driven scripts (e.g., adaptive index defragmentation scripts) that only rebuild or reorganize indexes when explicit fragmentation limits are breached.


---


Key Architectural Check


When managing VLDBs on Azure VMs, always configure your storage layout to separate Data files (.mdf/.ndf), Log files (.ldf), and Tempdb onto physically isolated Azure disk resources to avoid storage queue depth exhaustion at the individual drive level.

Common Challenges in The Execution Phase of Migrating Onprem SAP ASE Databases to SQL Server On Azure VM WITH VLDBS

 Common Challenges in The Execution Phase of Migrating Onprem SAP ASE Databases to SQL Server On Azure VM WITH VLDBS


Migrating Very Large Databases (VLDBs) from an on-premises SAP ASE (Sybase) environment to SQL Server on an Azure Virtual Machine is a massive technical undertaking. While planning, schema remediation, and post-migration validation are critical, the Execution Phase—where data actually moves across networks and system cutovers occur—presents the highest operational risk.


Because both systems share a historical lineage (Transact-SQL), the schemas look deceptively similar, but their modern execution engines, storage architectures, and scale factors diverge sharply at the multi-terabyte level.


Here are the common execution phase challenges** you will face during a VLDB migration to Azure VMs, along with the technical realities behind them.


---


1. The BCP / Data Pump Throughput Bottleneck


For VLDBs, utilizing standard migration tools like the SQL Server Migration Assistant (SSMA) for raw data movement often hits a performance wall. Standard SSMA or single-threaded bulk copy program (bcp) routines will result in a migration window that stretches into days or weeks.


* The Challenge: SAP ASE layouts do not inherently map out parallel bulk extracts smoothly if a table lacks a well-indexed clustered key or native partitioning. Extracting multi-terabyte tables sequentially will choke your migration window.


* The Reality: You must design custom, multi-threaded parallel execution frameworks (e.g., chunking large tables by a primary key range or partition ID) using manual bcp or Azure Data Factory self-hosted integration runtimes to saturate available bandwidth.


2. Log Truncation & Replication Queue Saturation (CDC / Near-Real-Time)


If you cannot afford days of offline migration, you will use near-real-time data movement (such as Sybase Replication Server to SQL Server, or AWS/third-party CDC tools).


* The Challenge: During the execution phase, the source SAP ASE production database continues to handle high transaction volumes. If the target ingestion or network replication stream lags, the secondary truncation point in the SAP ASE transaction log will not advance.


* The Reality: Your on-premises syslogs can fill up rapidly, freezing production. Managing log-truncation overrides while maintaining transactional consistency for a VLDB is a razor-thin balancing act.


3. Storage IOPS and Throughput Throttling on Azure VMs


A standard on-premises SAN often masks high-volume concurrent write inefficiencies. Moving to an Azure VM requires adapting to strict cloud storage limits.


* The Challenge: During bulk data load execution, you will concurrently flood the Azure target VM with data. If your Azure Managed Disks (Premium SSD v1/v2 or Ultra Disk) are not pre-warmed, correctly striped (via Storage Spaces), or scoped for high bursts, you will trigger host-level or disk-level IOPS/throughput throttling.


* The Reality: The migration stalls out not because of network issues, but because the Azure VM storage subsystem is flattening out against its provisioning ceiling.


4. Massive Transaction Log Growth on the Target SQL Server


Even when target tables are set to BULK_LOGGED or SIMPLE recovery models to enable minimal logging during execution, certain factors can break this optimization.


* The Challenge: VLDB tables with non-clustered indexes or tables being loaded via concurrent, overlapping streams will still generate massive amounts of transaction log data. If the target SQL Server ldf disk runs out of space, the bulk load crashes, forcing an expensive, time-consuming roll-back of a multi-terabyte operation.


* The Reality: Indexes must be completely dropped or deferred on the target Azure VM prior to data execution, and the target transaction log disk must be oversized solely to survive the execution phase.


5. Network Latency and Packet Drops Over Hybrid Pipes


Moving a VLDB requires pushing tens of terabytes over a WAN or private connection (Azure ExpressRoute / VPN).


* The Challenge: Transient network drops or latency spikes can instantly kill a long-running TCP connection used by bulk copy or database replication tools. If your migration tool does not natively support checkpointing or auto-resume at the block level, a drop at 90% of a 5TB table upload requires restarting from zero.


* The Reality: You must optimize the MTU (Maximum Transmission Unit) sizes, configure explicit TCP window settings on your migration endpoints, and utilize tools that support chunked, stateless resume capabilities.


6. Implicit Data Type Conversion Failures and Truncation Errors


While SSMA handles standard mappings well during the planning phase, *execution* behaves differently when processing billions of rows of actual production data.


* The Challenge: Legacy SAP ASE databases often contain unique data anomalies—such as datetime fields containing dates prior to SQL Server’s legacy 1753-01-01 minimum (which requires mapping to datetime2), or custom character sets (unichar) that handle nulls or trailing whitespaces differently.


* The Reality: The data load will execute smoothly for hours until it hits a rogue row with an unmappable character or date, causing a hard thread failure that can scrap the batch.


7. Compaction and Decompression Overhead (APL vs. DOL Storage)


SAP ASE supports All-Pages Locked (APL) and Data-Only Locked (DOL) tables, often with custom row-compression configurations.


* The Challenge: When extracting data from SAP ASE, the source engine must spend immense CPU cycles decompressing or translating these pages into a text/binary stream for transit. Simultaneously, if you attempt to use SQL Server Page/Row compression *on-the-fly* during target insertion to save Azure disk footprint, the target VM's CPU can pin at 100%.


* The Reality: The execution phase bottlenecks at the CPU layer on either the source or target host, severely degrading the expected data transfer rate.


8. Tempdb Contention During Bulk Insertion and Index Rebuilds


Once data lands on the target Azure VM, or during intermediate loading stages, tempdb becomes heavily stressed.


* The Challenge: If you choose to rebuild clustered and non-clustered indexes post-load using the SORT_IN_TEMPDB = ON option to optimize performance, your tempdb storage on the Azure VM will experience intense write activity. If tempdb is not placed on the local ephemeral NVMe drive (the D: drive on most Azure VM series), the contention will drag out execution times exponentially.


* The Reality: Improper layout of tempdb files on the Azure VM during a VLDB execution phase will directly cripple both data ingestion and post-load index initialization.


9. Broken Identity Column Sync and Sequence Gaps


SAP ASE utilizes a distinct engine mechanism for IDENTITY columns, including unique cache behaviors controlled by sp_chgattribute 'identity_gap'.


* The Challenge: During bulk data execution, identity tracking must be overridden (SET IDENTITY_INSERT ON). If your parallel execution streams load rows out of natural order, or if execution errors cause a partial roll-back of an identity seed, the internal counters can get out of sync.


* The Reality: When the cutover occurs and applications attempt to write new data, the engine will throw duplicate key errors or leave massive identity gaps, breaking application logic.


10. Cutover Window Validation Lag (Row Count vs. Checksums)


At the end of the execution phase, before shifting traffic to Azure, you must prove the target VLDB matches the source exactly.


* The Challenge: For a 50TB database, running a full binary checksum validation across billions of rows to verify data integrity can easily take longer than the entire allowable cutover window.


* The Reality: Relying solely on basic row counts is risky because it misses data corruption or truncation. Teams often hit a wall here: they must either extend the downtime window to finish validation or risk cutting over to Azure with unverified data integrity. Advanced strategies—like pre-calculating hash sets on immutable historical partitions weeks prior—are mandatory.

Common Challenges in The Foundation Phase of Migrating Onprem SAP ASE Databases to SQL Server On Azure VM WITH VLDBS

 Common Challenges in The Foundation Phase of Migrating Onprem SAP ASE Databases to SQL Server On Azure VM WITH VLDBS


Migrating a Very Large Database (VLDB) ecosystem from on-premises SAP ASE (Sybase) to SQL Server on Azure Virtual Machines is a massive structural shift. Because of their shared ancestry, T-SQL syntax and basic architecture align closely, which simplifies things compared to moving to an entirely different engine like Oracle or PostgreSQL.


However, when you are dealing with **VLDB scales**, the initial design phase dictates whether your migration succeeds or hits a wall. Standard migration tools like SSMA (SQL Server Migration Assistant) work well for schema conversion, but they fall short under the sheer weight of multi-terabyte datasets if the foundation isn't built for scale.


Here are the most common structural and strategic challenges you will face during the Foundation (Discovery and Design) Phase of this specific migration pipeline.


---


1. Storage Layout Misalignment (Device Stripping vs. Azure Managed Disks)


SAP ASE relies heavily on logical "database devices" mapped to physical storage. DBAs often strip across raw devices to optimize I/O.


* The Challenge: Directly mapping this philosophy to Azure can lead to major performance bottlenecks or runaway costs. In Azure VMs, you must design for IOPS and throughput limits at both the individual disk level and the overall VM level.


* The Foundation Fix: The design must move away from old device thinking and focus on **Azure Premium SSD v2 or Ultra Disks**. You must pre-calculate aggregate throughput requirements and design a storage pool using Windows Storage Spaces to stripe across multiple Azure disks to hit the required IOPS ceiling before the VM itself throttles you.


2. Tempdb Scoping and Contention Translation


ASE uses tempdb heavily for sorting, workspace, and intermediate results in heavy transactional or reporting workloads.


* The Challenge: SQL Server handles tempdb differently, and under heavy VLDB workloads, it is highly prone to allocation page contention (PFS/GAM/SGAM pages). If you under-provision or misconfigure tempdb during the foundation phase, the target environment will experience immediate bottlenecks.


* The Foundation Fix: Architect the Azure VM to utilize the local ephemeral drive (the NVMe-based temporary storage included with memory-optimized VM sizes like the Edsv5-series) exclusively for tempdb. Plan the target deployment to use multiple tempdb data files of equal size (typically matching the logical core count up to 8 files) and enable metadata optimization features inline.


3. Designing for the Network Throughput Pipe


Moving tens or hundreds of terabytes from an on-premises data center to the cloud requires an enormous amount of bandwidth.


* The Challenge: Teams often fail to calculate the physical limitations of the network pipe during the discovery phase. If you have a 1 Gbps ExpressRoute connection, migrating a 100 TB database purely over the wire will take over 10 days of continuous, uninterrupted maximum saturation just for the initial data movement—making a low-downtime cutover impossible.


* The Foundation Fix: Establish the data transport strategy early. If the available ExpressRoute bandwidth cannot support the required sync windows, the foundation plan must incorporate physical appliance seeding (Azure Data Box) for the initial baseline copy, or provision a temporary high-bandwidth ExpressRoute circuit specifically for the migration window.


4. Source Optimization and Incremental Change Tracking


With VLDBs, you rarely get a maintenance window large enough to perform a single offline backup, copy, and restore. You must rely on online initial loading combined with ongoing delta syncs.


* The Challenge: SAP ASE does not have a native, low-overhead equivalent to SQL Server’s Change Data Capture (CDC) built directly into the engine without secondary licensing or tools (like SAP Replication Server). Capturing changes on a highly active VLDB without introducing locking or performance degradation on the source production environment is a major challenge.


* The Foundation Fix: Evaluate and select a replication or Change Data Capture tool (such as SAP Replication Server or third-party log-based CDC solutions like SymmetricDS or Qlik Replicate) during the design phase. The architecture must account for the transactional log throughput on the source to ensure the log reader doesn't fall behind.


5. T-SQL Dialect and Engine Nuances at Scale


While both engines use T-SQL, they diverged significantly after their split in the 1990s.


* The Challenge: Syntax differences in index hints, query optimization behaviors, isolation levels, and lock escalation can cause massive performance regressions when scaled up to VLDB data volumes. For instance, ASE handles transaction isolation and row/page locking thresholds differently than SQL Server’s default Read Committed behavior.


* The Foundation Fix: Utilize SSMA to generate comprehensive assessment reports early, but do not rely on it blindly. The foundation phase must budget time for a manual code review of the top 10% most critical, high-execution stored procedures and queries, specifically looking out for locking patterns and query hints that don't translate cleanly.


6. Sizing Target Azure VMs for Memory-to-Data Ratios


In SAP ASE, performance is heavily tied to the configuration of named data caches.


* The Challenge: Oversizing or undersizing the target Azure VM compute tier can lead to either massive wasted spend or severe memory pressure. SQL Server’s buffer pool management handles memory differently, and a VLDB requires a high memory-to-vCPU ratio to minimize physical disk reads.


* The Foundation Fix: Target Memory-Optimized VM families (such as the E-series or M-series Azure VMs). Ensure the initial architecture targets a size that allows the working set of the data to fit comfortably in memory, paying close attention to the max throughput limits of the specific VM size to avoid bottlenecking storage traffic.


7. Data Type Mappings and Storage Footprint Expansion


* The Challenge: Data types do not always map 1:1 in size or behavior. For example, ASE’s IMAGE and TEXT types map to SQL Server's VARBINARY(MAX) and VARCHAR(MAX). If type conversions are handled poorly, it can cause index fragmentation, implicit conversion overhead during queries, or an expanded storage footprint on the target disk.


* The Foundation Fix: Review default SSMA data type mappings during the design phase. Plan to implement native SQL Server features like **Data Compression** (ROW or PAGE compression) or columnstore indexes for historical tables on the target side to actively combat storage expansion and optimize I/O.


8. High Availability (HA) and Disaster Recovery (DR) Integration


* The Challenge: A VLDB environment is almost certainly mission-critical, meaning the migration target must immediately match or exceed the on-premises HA/DR SLAs. Designing an architectural topology that supports both rapid local failover and geographic resilience for a massive database requires deep network and clustering synchronization design.


* The Foundation Fix: Build SQL Server Always On Availability Groups into the foundational Azure architecture. This requires pre-configuring Azure Load Balancers (or Distributed Network Names), setting up a Windows Server Failover Cluster (WSFC) across Azure Availability Zones, and ensuring the replication mode (synchronous vs. asynchronous) balances data safety against write-latency overhead.


9. Defining the Validation Framework (Row-by-Row vs. Checksum)


* The Challenge: Once terabytes of data are moved, proving that the target database is a 100% accurate, uncorrupted replica of the source is incredibly difficult. Running naive COUNT(*) queries across massive tables takes too long and doesn't validate data integrity, while full row-by-row binary comparisons can cripple performance on both sides.


* The Foundation Fix: Architect an automated validation strategy during the design phase. This typically involves a tiered approach: using fast row-count checks for active transactional tables, combined with chunk-based cryptographic checksum comparisons (e.g., hash values generated across primary key ranges) executed during low-traffic windows to validate data blocks without locking entire tables.


10. Fallback and Rollback Planning for Extreme Scale


* The Challenge: If a critical issue is discovered 12 hours after cutover, you cannot simply restore an on-premises backup and lose half a day of enterprise transactions. Similarly, setting up a reverse replication pipeline from a SQL Server Azure VM back to an on-premises SAP ASE database to keep the source up-to-date as a fallback option is incredibly complex and rarely supported natively.


* The Foundation Fix: The architectural design must establish a clear "point of no return" timeline. If dual-running or reverse replication is required for business sign-off, a dedicated data-sync pipeline must be engineered and tested in the foundation phase using a middleware data integration platform capable of translating SQL Server changes back into an ASE-compatible format.


---


Deepening the Strategy


If you are planning the architectural blue-printing for this type of enterprise shift, look closely at how the initial data seeding strategy dictates your cutover options. This video offers an excellent deep dive into navigating the specific complexities of handling minimal downtime requirements when migrating multi-gigabyte or terabyte-scale environments over to cloud-based SQL targets.

Realistic, Production-Grade War-Room Script During a High-risk Database Migration SAP ASE to SQL Server on Azure VM for a US bank

 Realistic, Production-Grade War-Room Script During a High-risk Database Migration SAP ASE to SQL Server on Azure VM for a US Bank


War-Room Script combines:


* Who says what (roles & communication)

* Minute-by-minute execution timeline

* Decision points & fallback triggers


This is written so you can literally run a live migration call using this script.


---


# WAR ROOM SETUP (BEFORE CLOCK STARTS)


Roles in the Call


* Migration Lead Senior SQL DBA who runs the call

* Application Lead

* Infrastructure Lead

* Business Owner

* Observer / Auditor (optional for bank)


---


Opening Statement (T-15 minutes)


Migration Lead:


“We are starting the production migration of ASE to SQL Server on Azure VM. All teams confirm readiness. This is a controlled execution.Any issue will be raised immediately. No silent failures.”


---


Each Team member Responds:


* Application: “Application team ready. No active user sessions expected.”


* Infrastructure: “Infrastructure stable. Network and storage confirmed.”


* Business: “Business approval confirmed. Proceed.”


---


MINUTE-BY-MINUTE EXECUTION TIMELINE


---


T-0: GO-LIVE START


---


T+00 min — STOP APPLICATION TRAFFIC


Application Lead: “Stopping all application services now.”


*(Wait for confirmation)


---


Application Lead: “All application connections terminated. No active sessions.”


---


DBA VERIFY:


```sql


SELECT * FROM sys.dm_exec_sessions WHERE is_user_process = 1;

```


“Confirmed. No active sessions. Proceeding to database freeze.”


---


T+02 min — FREEZE SOURCE DATABASE (ASE)


---


DBA: “Switching ASE database to read-only mode.”


Command (ASE):


```sql


sp_dboption dbname, 'read only', true

go

```


“Source database is now read-only. No further changes allowed.”


---


T+05 min — FINAL INCREMENTAL DATA SYNC


---


DBA: “Starting final delta sync.”


---


Run Incremental Load on ASE


```sql


-- Example logic


SELECT * FROM Transactions

WHERE LastModified > @LastSyncTime

```


DBA say every few minutes: “Delta sync in progress… monitoring throughput.”


---


T+15 min — SYNC COMPLETION


---


DBA: “Final sync completed. Starting validation.”


---


T+16 min — DATA VALIDATION


---


Step 1 — Row Count on SQL Server


```sql


SELECT COUNT(*) FROM Transactions;

```


---


Step 2 — Checksum on SQL Server


```sql


SELECT CHECKSUM_AGG(BINARY_CHECKSUM(*)) FROM Transactions;

```


---


DBA say: “Row count and checksum match between ASE and SQL Server.”


---


If mismatch:


DBA say: “Data mismatch detected. Pausing cutover. Re-running sync.”


---


T+20 min — BUSINESS VALIDATION CHECK


---


Business Owner: “Critical tables verified. Data looks correct.”


---


DBA say: “Proceeding to application cutover.”


---


T+22 min — SWITCH CONNECTION STRING


---


Application Lead: “Updating connection string to SQL Server.”


---


Example:


```

Old: ASE_Server


New: SQLServerVM.database.windows.net

```


---


T+25 min — START APPLICATION


---


Application Lead: “Starting application services.”


---


T+27 min — INITIAL CONNECTION TEST


---


Application Lead: “Application connected successfully.”


---


**DBA:**


```sql


SELECT COUNT(*) FROM sys.dm_exec_sessions;

```


---


DBA say: “User sessions are connecting. Monitoring performance.”


---


T+30 min — LIVE TRANSACTION TEST


---


Business Owner: “Executing test transactions.”


---


Examples:


* Login

* Fund transfer

* Report generation


---


Business Owner: “Transactions successful.”


---


T+35 min — PERFORMANCE MONITORING


---


DBA:


```sql


SELECT wait_type, wait_time_ms 

FROM sys.dm_os_wait_stats;

```


---


DBA say: “Monitoring CPU, IO, and query performance. No critical issues.”


---


FAILURE DECISION POINT (VERY IMPORTANT)


---


If ANY of these happen:


* Application cannot connect

* Data mismatch

* Severe performance issue


---


DBA say: “We are initiating rollback procedure. Returning to ASE system.”


---


ROLLBACK STEPS (IF NEEDED)


---


Immediate


* Stop application

* Re-enable ASE write mode


```sql


sp_dboption dbname, 'read only', false

```


---


Application Lead: “Switching back to ASE connection.”


---


DBA say: “Rollback completed. System restored to original state.”


---


T+45 min — STABILIZATION


---


If everything is OK:


---


DBA say: “System stable. Entering monitoring phase.”


---


T+60 min — ENABLE FULL OPERATIONS


---


Application Lead: “Opening system to users.”


---


Business Owner: “Users can now access system.”


---


T+75 min — HADR VALIDATION


---


DBA:


```sql


SELECT * FROM sys.dm_hadr_availability_replica_states;

```


---


DBA say: “Availability Group healthy. Replication working.”


---


T+90 min — BACKUP VALIDATION


---


```sql


BACKUP DATABASE BankingDB

TO DISK = 'D:\Backup\post_migration.bak';

```


---


DBA say: “Post-migration backup completed successfully.”


---


T+120 min — CLOSE WAR ROOM


---


Final Statements


---


DBA: “Migration completed successfully. System stable, validated, and backed up.”


---


Application Lead: “Application stable. No issues reported.”


---


Business Owner: “Business operations normal. Migration accepted.”


---


FINAL WAR ROOM CHECKLIST


---


Before closing:


* Application running 

* Data validated 

* Users connected 

* No blocking 

* Backup completed 

* HADR healthy 


---


PRO TIPS (FROM REAL MIGRATIONS)


---


1. Silence leads Danger


If someone is quiet, ask: “Please confirm status.”


---


2. Always Speak in Status Updates


Every 3–5 minutes say: “Current status: stable / syncing / validating”


---


3. Never Rush Validation


Most failures happen because teams skip validation.


---


4. Always Have Rollback Ready


Even if you don’t use it.

POST PHASE: Migrating from On-Premises SAP ASE (Sybase ASE to SQL Server running on Azure VM

POST PHASE: Migrating from On-Premises SAP ASE (Sybase ASE to SQL Server running on Azure VM


PART 3 — POST PHASE (AFTER GO-LIVE): STABILIZE, SECURE, AND OPTIMIZE


This phase decides whether your system runs smoothly for years or slowly turns into a problem.


---


1. WHAT “POST PHASE” REALLY MEANS


After go-live, your job is to:


* Make sure the system is stable

* Make sure performance is better or equal

* Protect data with backup + HADR

* Secure the system (especially for banking)

* Monitor everything

* Optimize cost in Azure


---


2. FIRST 24–72 HOURS (CRITICAL STABILIZATION WINDOW)


This is your highest risk period.


---


What You Must Watch Continuously ?


* CPU usage

* Disk latency

* Blocking / deadlocks

* Failed queries

* Application errors


---


Quick Health Check Script


```sql


SELECT 

    GETDATE() AS CurrentTime,

    cpu_count,

    physical_memory_kb/1024 AS MemoryMB

FROM sys.dm_os_sys_info;

```


---


Check Active Queries


```sql


SELECT 

    session_id, status, blocking_session_id, wait_type, wait_time

FROM sys.dm_exec_requests;

```


If you see:


* Long waits

* Blocking chains→ You must act immediately


---


3. PERFORMANCE TUNING (MOST IMPORTANT SKILL)


Migration success is performance success


---


3.1 Identify Slow Queries


```sql


SELECT TOP 10

    total_elapsed_time / execution_count AS avg_time,

    execution_count,

    query_hash

FROM sys.dm_exec_query_stats

ORDER BY avg_time DESC;

```


---


3.2 Enable Query Store (MUST DO)


```sql


ALTER DATABASE BankingDB 

SET QUERY_STORE = ON;

```


---


Why Query Store?


* Tracks query performance

* Helps detect regressions

* Allows plan forcing


---


3.3 Fix Missing Indexes


```sql


SELECT * 

FROM sys.dm_db_missing_index_details;

```


---


3.4 Rebuild Fragmented Indexes


```sql


ALTER INDEX ALL ON tablename REBUILD;

```


---


3.5 Update Statistics


```sql


UPDATE STATISTICS tablename;

```


---


4. MEMORY AND CPU OPTIMIZATION


---


Set Max Memory Properly


```sql


EXEC sp_configure 'max server memory (MB)', 60000;

RECONFIGURE;

```


---


Check Wait Stats


```sql


SELECT * FROM sys.dm_os_wait_stats

ORDER BY wait_time_ms DESC;

```


---


Common Wait Types


* PAGEIOLATCH → disk slow

* CXPACKET → parallelism issue


---


5. BACKUP STRATEGY (PRODUCTION READY)


You must have a reliable backup plan immediately after go-live.


---


5.1 Full Backup (Daily)


```sql


BACKUP DATABASE BankingDB

TO DISK = 'D:\Backup\BankingDB_full.bak'

WITH COMPRESSION;

```


---


5.2 Differential Backup


```sql


BACKUP DATABASE BankingDB

TO DISK = 'D:\Backup\BankingDB_diff.bak'

WITH DIFFERENTIAL;

```


---


5.3 Transaction Log Backup (Every 5–15 min)


```sql


BACKUP LOG BankingDB

TO DISK = 'D:\Backup\BankingDB_log.trn';

```


---


5.4 Automate Using SQL Agent


Create jobs for:


* Full backup

* Log backup

* Cleanup


---


6. HADR (HIGH AVAILABILITY + DISASTER RECOVERY)


---


6.1 Validate Availability Group


```sql


SELECT * FROM sys.dm_hadr_availability_replica_states;

```


---


6.2 Failover Test (VERY IMPORTANT)


```sql


ALTER AVAILABILITY GROUP AG_Banking FAILOVER;

```


---


6.3 Backup on Secondary (Best Practice)


```sql


BACKUP DATABASE BankingDB

TO DISK = 'D:\Backup\BankingDB_secondary.bak';

```


---


7. SECURITY (BANKING LEVEL REQUIREMENTS)


For a US bank, security is NOT optional.


---


7.1 Enable Transparent Data Encryption (TDE)


```sql


CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'StrongPassword123';


CREATE CERTIFICATE TDECert

WITH SUBJECT = 'TDE Certificate';


CREATE DATABASE ENCRYPTION KEY

WITH ALGORITHM = AES_256

ENCRYPTION BY SERVER CERTIFICATE TDECert;


ALTER DATABASE BankingDB SET ENCRYPTION ON;

```


---


7.2 Create Logins and Roles


```sql


CREATE LOGIN app_user WITH PASSWORD = 'StrongPass!';


CREATE USER app_user FOR LOGIN app_user;


ALTER ROLE db_owner ADD MEMBER app_user;

```


---


7.3 Enable Auditing


```sql


CREATE SERVER AUDIT Audit_Banking

TO FILE (FILEPATH = 'D:\Audit\');


ALTER SERVER AUDIT Audit_Banking WITH (STATE = ON);

```


---


8. MONITORING AND ALERTING


---


8.1 Built-in Monitoring


* SQL Server Agent Alerts

* Performance Monitor


---


8.2 Key Metrics to Track


* CPU %

* Disk latency

* Deadlocks

* Failed logins


---


8.3 Simple Alert Example


```sql


EXEC msdb.dbo.sp_add_alert 

@name = 'High CPU',

@message_id = 0,

@severity = 0,

@enabled = 1;

```


---


9. AZURE COST OPTIMIZATION


---


Key Rules


* Don’t over-provision VM size

* Use reserved instances

* Monitor disk usage


---


Resize VM if needed


* Scale up for performance

* Scale down for cost


---


10. DATA VALIDATION (POST MIGRATION)


---


Final Row Count Check


```sql


SELECT COUNT(*) FROM tablename;

```


---


Business Validation


* Reports match?

* Transactions correct?

* No missing data?


---


11. POST PHASE CHECKLIST


Follow this strictly:


* Monitor system 24–72 hours

* Enable Query Store

* Tune slow queries

* Rebuild indexes

* Update statistics

* Configure backups

* Test restore

* Validate HADR

* Enable security (TDE, audit)

* Set alerts

* Optimize cost

* Validate data with business users


---


12. FAILURE SCENARIOS + RECOVERY


---


Scenario 1 — Database Corruption


Restore:


```sql


RESTORE DATABASE BankingDB

FROM DISK = 'D:\Backup\BankingDB_full.bak'

WITH REPLACE;

```


---


#Scenario 2 — Server Crash


* Failover to secondary

* Redirect application


---


Scenario 3 — Slow Performance


* Identify slow queries

* Add indexes

* scale VM


---


13. REAL-WORLD DBA ROUTINE (DAILY TASKS)


---


Every Day


* Check alerts

* Check backups

* Monitor performance


---


Every Week


* Rebuild indexes

* Review slow queries


---


## Every Month


* Test restore

* Review capacity


---


14. SIMPLE “WAR ROOM” SCRIPT (GO-LIVE SUPPORT)


During production issues, communication matters.


---


Roles


* DBA (you)

* App team

* Network team


---


What to Say


* “Database is online and accessible”

* “Monitoring performance baseline”

* “No blocking detected”

* “Backup completed successfully”

EXECUTION PHASE: Migrating from On-Premises SAP ASE (Sybase ASE to SQL Server running on Azure VM

 EXECUTION PHASE: Migrating from On-Premises SAP ASE (Sybase ASE to SQL Server running on Azure VM


PART 2 —EXECUTION PHASE: REAL MIGRATION STEPS YOU WILL FOLLOW


Now we move from planning to doing the migration.


This is where things can go wrong fast — so we’ll go step-by-step, simple, and safe, especially for very large (10TB–100TB) mission-critical databases.


---


1. OVERALL EXECUTION STRATEGY (VERY IMPORTANT)


You should NOT try to migrate everything at once.


Instead, follow this proven sequence:


This phase Flow


1. Prepare target SQL Server

2. Migrate schema

3. Perform initial bulk data load

4. Start incremental sync

5. Validate data

6. Cutover (final switch)


---


2. PREPARE TARGET SQL SERVER (FINAL CHECK)


Before moving data, confirm:


* SQL Server is installed and patched

* Storage is mounted correctly

* Enough space (at least 1.5x database size)

* TempDB optimized

* Network bandwidth tested


---


Quick Validation Script


```sql


SELECT name, size*8/1024 AS SizeMB 

FROM sys.master_files

```


3. CREATE DATABASE STRUCTURE (ON SQL SERVER)


You already converted schema in Part 1 — now apply it.


---


Example: Create Database


```sql


CREATE DATABASE BankingDB

ON 

(

    NAME = BankingDB_Data,

    FILENAME = 'D:\Data\BankingDB.mdf',

    SIZE = 500GB,

    FILEGROWTH = 10GB

)

LOG ON

(

    NAME = BankingDB_Log,

    FILENAME = 'E:\Logs\BankingDB.ldf',

    SIZE = 100GB,

    FILEGROWTH = 5GB

);

```


Important Best Practice


* Pre-size database (VERY IMPORTANT for large DBs)


* Avoid auto-growth during migration


---


4. INITIAL BULK DATA LOAD (MAIN STEP)


This is where 90% of the data moves.


---


4.1 Method 1 — BCP (BEST FOR LARGE DATA)


*BCP (Bulk Copy Program) is simple and powerful.


---


Step 1 — Export from ASE


```bash


bcp dbname.dbo.tablename out table.dat -c -U username -P password -S ASE_Server

```


---


Step 2 — Import into SQL Server


```bash


bcp BankingDB.dbo.tablename in table.dat -c -U username -P password -S SQLServerVM

```


---


For Very Large Tables (IMPORTANT)


Use:


```bash


bcp BankingDB.dbo.tablename in table.dat -b 100000 -a 32768 -h "TABLOCK"

```


---


Why This Works


* `-b` = batch size (reduces log pressure)

* `TABLOCK` = faster load

* Minimizes logging


---


4.2 Method 2 — BULK INSERT (Inside SQL Server)


---


```sql


BULK INSERT BankingDB.dbo.tablename

FROM 'D:\Data\table.dat'

WITH

(

    FIELDTERMINATOR = ',',

    ROWTERMINATOR = '\n',

    TABLOCK

);

```


---


4.3 Method 3 — SSIS (Optional but powerful)


Use if:


* Data transformation needed

* Complex mapping


---


5. PARALLEL DATA LOAD (CRITICAL FOR 10TB+)


If you load one table at a time, it will take days or weeks.


---


#Strategy


* Split large tables into chunks

* Load in parallel


---


# Example


Instead of:


```sql


SELECT * FROM Transactions

```


Do:


```sql


SELECT * FROM Transactions WHERE ID BETWEEN 1 AND 1000000

SELECT * FROM Transactions WHERE ID BETWEEN 1000001 AND 2000000

```


Run multiple BCP jobs simultaneously.


---


6. DISABLE INDEXES BEFORE LOAD (VERY IMPORTANT)


---


Why?


Indexes slow down bulk insert.


---


Disable Index


```sql


ALTER INDEX ALL ON tablename DISABLE;

```


---


Rebuild After Load


```sql


ALTER INDEX ALL ON tablename REBUILD;

```


---


7. HANDLE VERY LARGE DATABASES (10TB–100TB)


---


Key Techniques


7.1 Use Multiple Data Files


```sql


ALTER DATABASE BankingDB 

ADD FILE (NAME = Data2, FILENAME = 'D:\Data2.ndf', SIZE = 500GB);

```


---


7.2 Use SIMPLE Recovery Mode (TEMPORARILY)


```sql


ALTER DATABASE BankingDB SET RECOVERY SIMPLE;

```


---


Why?


* Reduces log growth

* Faster inserts


---


After migration, switch back:


```sql


ALTER DATABASE BankingDB SET RECOVERY FULL;

```


---


8. INCREMENTAL DATA SYNC (LOW DOWNTIME)


After bulk load, system is still live on ASE.


You must sync changes.


---


Options


Option 1 — Timestamp-based Sync


---


```sql


SELECT * FROM Transactions

WHERE LastModified > 'last_sync_time'

```


---


Option 2 — Change Tracking (Manual)


* Add tracking column

* Capture inserts/updates


---


Option 3 — Custom Scripts (Common in ASE migrations)


---


9. AUTOMATION USING POWERSHELL


---


Example Script to Run Multiple BCP Jobs


```powershell


$tables = @("Customers", "Accounts", "Transactions")


foreach ($table in $tables) {

    Start-Process -NoNewWindow -FilePath "bcp.exe" `

    -ArgumentList "BankingDB.dbo.$table in $table.dat -S SQLServerVM -T -c"

}

```


---


10. DATA VALIDATION (CRITICAL STEP)


---


10.1 Row Count Check


```sql


SELECT COUNT(*) FROM tablename;

```


Compare ASE vs SQL Server.


---


10.2 Checksum Validation


```sql


SELECT CHECKSUM_AGG(BINARY_CHECKSUM(*)) FROM tablename;

```


---


10.3 Spot Check


* Random records

* Critical tables


---


11. FINAL CUTOVER (GO-LIVE STEP)


---


Steps


1. Stop application

2. Stop ASE writes

3. Run final incremental sync

4. Validate data

5. Point application to SQL Server


---


12. CONNECTION STRING UPDATE


---


Old:


```text


ASE_Server

```


New:


```text


SQLServerVM.database.windows.net

```


---


13. ENABLE HADR (HIGH AVAILABILITY)


---


Use Always On Availability Groups


---


Step 1 — Enable Feature


```sql


EXEC sp_configure 'contained database authentication', 1;

RECONFIGURE;

```


---


Step 2 — Create Availability Group


```sql


CREATE AVAILABILITY GROUP AG_Banking

FOR DATABASE BankingDB

REPLICA ON 

'PrimaryServer' WITH (ENDPOINT_URL = 'TCP://Primary:5022'),

'SecondaryServer' WITH (ENDPOINT_URL = 'TCP://Secondary:5022');

```


---


14. BACKUP CONFIGURATION


---


Full Backup


```sql


BACKUP DATABASE BankingDB

TO DISK = 'D:\Backup\BankingDB.bak'

WITH COMPRESSION;

```


---


Log Backup


```sql


BACKUP LOG BankingDB

TO DISK = 'D:\Backup\BankingDB_log.trn';

```


---


15. COMMON FAILURES (AND FIXES)


---

Problem 1: Slow Migration


Fix:


* Use parallel BCP

* Increase batch size


---


Problem 2: Log File Full


Fix:


```sql


BACKUP LOG BankingDB;

```


---


Problemb3: Data Mismatch


Fix:


* Re-run incremental sync

* Validate again

MINUTE BY MINUITE PRODUCTION RUNBOOK FOR FULLY AUTOMATED MIGRATION FROM SAP ASE TO SQL Server Azure VM

MINUTE BY MINUITE PRODUCTION RUNBOOK FOR  FULLY AUTOMATED MIGRATION FROM SAP ASE TO SQL Server Azure VM --- OVERALL STRUCTURE Breaking execu...