The Partial SSMS Selection: Recovering 1,842 Settled Black Friday Orders Without Halting Checkout
During peak Black Friday settlement triage, an on-call engineer wrote DELETE dbo.Orders WHERE Status = N'Paid' AND Customer LIKE N'QA_SMOKE_%'; in SSMS to remove three smoke-test rows. When highlighting the query with the mouse, the AND Customer LIKE... line was clipped out of the selection before hitting F5. Instantly, 1,842 paid customer orders vanished while 60+ new orders per minute continued streaming into dbo.Orders.
Taking the 480 GB production database offline for a point-in-time restore would have halted Black Friday checkout for 40+ minutes and wiped out hundreds of newer orders placed seconds after the mistake.
The DBA queried EXEC rb.Deleted @Table = N'dbo.Orders', @Top = 2000;, confirmed all 1,842 rows shared TxId = 9481022 from HostName = 'OPS-JUMPBOX-02', and executed EXEC rb.UndoTransaction @Table = N'dbo.Orders', @TxId = 9481022;. SQL RecycleBin toggled IDENTITY_INSERT dbo.Orders ON, re-inserted all 1,842 rows with their exact original OrderId keys, and left every newer checkout completely untouched.
-- 1. What the engineer highlighted by accident in SSMS: DELETE dbo.Orders WHERE Status = N'Paid'; -- AND Customer LIKE N'QA_SMOKE_%'; <-- left unselected! -- (1842 rows affected) -- 2. Inspect deleted rows & isolate the exact Transaction ID: EXEC rb.Deleted @Table = N'dbo.Orders', @Top = 5; -- Returns ChangeId, ChangedAt, ChangedBy='sa_triage', -- plus typed OrderId, Customer, Amount, Status, CreatedAt SELECT DISTINCT TxId, ChangedBy, HostName, COUNT(*) AS DeletedRows FROM rb.ChangeLog WHERE SchemaName = N'dbo' AND TableName = N'Orders' AND Restored = 0 GROUP BY TxId, ChangedBy, HostName; -- TxId: 9481022 | ChangedBy: sa_triage | HostName: OPS-JUMPBOX-02 | Rows: 1842 -- 3. Surgically undo ONLY TxId 9481022 while live checkouts continue: EXEC rb.UndoTransaction @Table = N'dbo.Orders', @TxId = 9481022; -- rb: restored 1842 deleted row(s), reverted 0 update(s) on [dbo].[Orders].
// Stored in rb.ChangeLog (Page Compressed) { "ChangeId": 41092, "SchemaName": "dbo", "TableName": "Orders", "Operation": "D", "TxId": 9481022, "KeyValues": "{\"OrderId\":10481}", "RowBefore": "{\"OrderId\":10481,\"Customer\":\"Nordic Logistics AB\",\"Amount\":18400.00,\"Status\":\"Paid\",\"CreatedAt\":\"2026-11-27T14:02:11\"}", "RowAfter": null, "ChangedBy": "sa_triage", "AppName": "Microsoft SQL Server Management Studio - Query", "HostName": "OPS-JUMPBOX-02", "ChangedAt": "2026-11-27T14:04:02.118Z", "Restored": 1 }
-- Timeline Comparison: 14:04:02.118 Accidental DELETE removes 1,842 rows (OrderId 8600..10484) 14:04:03.000 Live customers place 14 new orders (OrderId 10485..10498) 14:04:05.910 EXEC rb.UndoTransaction @Table='dbo.Orders', @TxId=9481022 ✓ Original OrderIds 8600..10484 re-inserted via automatic IDENTITY_INSERT ON ✓ Newer OrderIds 10485..10498 preserved without interruption ✓ PK collision guard (WHERE NOT EXISTS) prevented any duplicate key errors