Home / Databases / SQL Server

SQL Server

SQL Server and Azure SQL: performance, HA/DR, backups, migrations and transformation. 116 posts.

SQL Server / Troubleshooting

Access violation and dump files when querying sys.dm_exec_requests during database recovery - SQL Server 2026 updates known issue and trace flag 4696

Since the September 2026 SQL Server updates, querying sys.dm_exec_requests while a database is recovering (after a restart or failover) can raise an access violation and write a dump. Monitoring tools trigger it most. Choose between trace flag 4696, pausing those queries during recovery, or removing the update.

3 min readAdvanced

SQL Server / Troubleshooting

Linked server queries fail with error 7416 after the September or October 2026 SQL Server update - MSDASQL provider strings and the stricter connection check

After the September and October 2026 SQL Server updates, linked servers that use MSDASQL with a provider string can fail with Msg 7416 - access denied because no login mapping exists. A stricter connection validation check is the cause. Check the login mappings and provider string, and look for the fix in the later builds.

3 min readIntermediate

SQL Server / Runbook

SQL Server October 2026 security updates (CVE-2026-96956 and 21 more) - which build to install, known issues to read first, and a safe rollout

Microsoft's 13 October 2026 updates for SQL Server 2017-2025 fix an elevation of privilege flaw (CVE-2026-96956) among 22 CVEs in the SQL Server 2025 update. Two known issues carried over from September affect MSDASQL linked servers and sys.dm_exec_requests during recovery. Check them, pick the right package, and patch availability groups in the right order.

3 min readIntermediate

SQL Server / How-to

A Power BI dashboard for SQL Agent job health across all your instances

Build a job health report in Power BI on top of a central Agent history store. Covers the data model, DAX measures for success rate and duration change, the pages worth building, refresh through a gateway and the read-only permissions it needs.

3 min readIntermediate

SQL Server / How-to

Hidden job chains: finding SQL Agent jobs that start other jobs

Jobs that call sp_start_job create dependencies nobody sees in SSMS. Find them by searching step commands, alerts that run jobs and procedures that start jobs, then draw the chain before you disable, move or reschedule anything.

2 min readIntermediate

SQL Server / Runbook

msdb is 40 GB: purging Agent, backup and mail history on a schedule

Find out what is filling msdb, from job history, backup history, Database Mail logs or job step logs, and set up one clean-up job that purges each of them by age in batches. Also covers the indexes that keep purging fast.

3 min readIntermediate

SQL Server / How-to

Optimization: tuning MAXDOP and cost threshold for parallelism on SQL Server

Default parallelism settings let small queries go parallel and big queries take every core, causing CXPACKET/CXCONSUMER waits and unpredictable performance. Set MAXDOP from the NUMA layout, raise cost threshold for parallelism from the default, use database-scoped and query-level overrides where needed, and confirm with wait stats.

2 min readIntermediate

SQL Server / How-to

Pausing a SQL Agent job safely: disable the job, the schedule or a step?

Three ways to stop a SQL Server Agent job from running, and what each one does to manual runs, shared schedules and other jobs. Includes T-SQL for each, a check for jobs left disabled by accident, and a habit that stops them being forgotten.

3 min readBeginner

SQL Server / How-to

Run job B only after job A succeeded today: table-driven SQL Agent job dependencies

Agent has no built-in dependency between jobs, so people chain them with sp_start_job or guess at schedule gaps. Instead, keep dependencies in a table and add a gate step that checks predecessors succeeded for today's batch. Each job can then wait, skip or fail, and the whole chain is visible in one query.

3 min readAdvanced

SQL Server / Runbook

Sev1: nobody has sysadmin on SQL Server. Regaining access with single-user mode

The only sysadmin login was removed, sa is disabled and its password lost, or the DBA group was deleted from AD. A local Windows administrator can start SQL Server in single-user mode, connect as sysadmin and add a proper admin back. Here are the steps, the traps and the clean-up.

3 min readIntermediate

SQL Server / Runbook

Sev1: SQL Server database stuck in RECOVERY_PENDING or SUSPECT

A database shows RECOVERY_PENDING or SUSPECT after a restart or storage problem. Work out which it is and why from the error log. Then bring it online by fixing files and permissions, restoring from backup, or, only as a last resort, using emergency mode repair.

3 min readAdvanced

SQL Server / Cheat sheet

SQL Server Agent questions every DBA gets asked: 20 short answers

Short, practical answers to the SQL Server Agent questions that come up again and again. Where jobs are stored, who they run as, why a job didn't run, time zones, Express edition, Azure options, and more.

3 min readBeginner

SQL Server / How-to

Starting a SQL Agent job from an SSIS package and waiting until it finishes

sp_start_job returns at once, so an SSIS package that calls it carries on before the job has done anything. Build a reusable procedure that starts a job, waits for it with a timeout, and returns its outcome, then call it from an Execute SQL Task. Covers permissions too.

3 min readIntermediate

SQL Server / Troubleshooting

The job was due at 02:00 and never ran: troubleshooting SQL Agent schedules

A step-by-step check for SQL Server Agent jobs that didn't start when expected. Covers enabled flags, next run times, overlapping runs, daylight saving, Agent downtime, schedule end dates and frequency settings that don't mean what people think.

3 min readIntermediate

SQL Server / How-to

Who changed that job? Auditing SQL Agent job changes with SQL Server Audit

SQL Server Agent records that a job changed but not who changed it or what changed. Use a database audit specification on msdb's job procedures to capture who did it, keep script snapshots to capture what changed, and know the limits of triggers on msdb tables.

3 min readAdvanced

SQL Server / Troubleshooting

A SQL Agent job failed overnight: a runbook from alert to root cause

A step-by-step runbook for failed SQL Server Agent jobs. Find every failure and the step that broke, read the full error from history, output files and the Agent log, match it to the common causes (owner, permissions, proxies, timeouts, blocking, disk, Agent itself), fix and rerun safely, and stop it recurring.

5 min readIntermediate

SQL Server / Cheat sheet

A T-SQL toolkit for SQL Server Agent: list, script, change and clean up jobs in bulk

Ready-to-run msdb queries and procedure calls for everyday SQL Server Agent work. Inventory every job with its schedule and last outcome, enable or disable jobs in bulk, change owners and categories, script jobs out for source control, copy them between servers and remove the ones nobody needs.

5 min readIntermediate

SQL Server / How-to

AWS-to-AWS modernisation: SQL Server on EC2 to Amazon RDS for SQL Server

Move self-managed SQL Server on EC2 to Amazon RDS to hand over patching, backups and Multi-AZ HA. Covers the readiness check against RDS limits, sizing from CloudWatch data, migration by native backup or DMS, replacing instance-level features, and decommissioning.

2 min readIntermediate

SQL Server / How-to

Azure SQL Database to Hyperscale: when, how and what changes

Move a growing Azure SQL Database from General Purpose or Business Critical to Hyperscale for up to 128 TB, fast backups and restores, and read scale-out. Covers fit checks, the online conversion, reverse migration window, replicas, and cost.

2 min readIntermediate

SQL Server / How-to

Bring order to 200 Agent jobs with custom job categories

Job categories are a free, built-in way to group SQL Server Agent jobs by team, application or purpose. Create a simple category scheme, assign jobs in bulk, use categories in reports, bulk enable and disable, and notifications, and avoid the built-in categories that other features depend on.

5 min readBeginner

SQL Server / How-to

Cross-cloud transformation: Amazon RDS for SQL Server to Azure SQL Managed Instance

Move databases from Amazon RDS for SQL Server to Azure SQL MI, for example after a consolidation decision or an acquisition. Covers native backups from RDS to S3, copying to Azure Blob Storage with azcopy, restoring with Log Replay Service, TDE and identity considerations, and cutover.

3 min readAdvanced

SQL Server / Runbook

Day-to-day SQL Server Agent job management: the DBA's daily, weekly and monthly routine

A routine for keeping SQL Server Agent healthy. Daily checks for failures, long runs and disabled jobs, a weekly review of owners, notifications and history, and monthly housekeeping and testing. Each check comes with the query or dbatools command, and links to the deep-dive posts in this series.

5 min readBeginner

SQL Server / How-to

Eight ways to run a SQL Server Agent job, and when each one is the right choice

Start SQL Agent jobs from SSMS, T-SQL, another job, PowerShell, sqlcmd, schedules, Agent alerts or an application. Includes how to start at a specific step, wait for a job to finish (sp_start_job doesn't wait), and give non-admins permission to run only the jobs they need.

4 min readBeginner

SQL Server / How-to

Least privilege for job steps: SQL Server Agent proxies and credentials explained

CmdExec, PowerShell and SSIS job steps run as the SQL Agent service account unless you give them a proxy. Create a credential and a proxy, grant it to the right subsystems and logins, use it in a step, and troubleshoot the access errors you'll meet. Includes an audit query for every proxy on the server.

4 min readIntermediate

SQL Server / How-to

Lift and shift SQL Server to Amazon EC2: MGN, native backups or an AG replica

Rehost SQL Server on EC2 with full control. Covers instance and EBS design, three move methods (AWS Application Migration Service for whole servers, backup/restore via S3, and an AG replica over Direct Connect), licensing choices, and HA after the move.

2 min readIntermediate

SQL Server / How-to

Minimal-downtime SQL Server migration to AWS with AWS DMS full load + CDC

Use AWS Database Migration Service to copy SQL Server data to RDS or EC2 and keep it in sync with change data capture until cutover. Covers source prerequisites (MS-CDC or replication), schema-first approach, task settings for LOBs, validation, monitoring latency and cutover.

3 min readAdvanced

SQL Server / How-to

Move SSIS packages to Azure: Azure-SSIS Integration Runtime in Data Factory

Lift existing SSIS packages into Azure Data Factory with the Azure-SSIS Integration Runtime. Covers SSISDB on Azure SQL MI or Database, package deployment, connecting to on-premises sources, custom components, scheduling and cost control, plus when to rebuild instead.

3 min readIntermediate

SQL Server / Cheat sheet

SQL Server DBA cheat sheet: the queries and commands you use every week

One page of tested T-SQL and PowerShell for daily SQL Server work. Covers instance and database info, sessions and blocking, waits and top queries, indexes and statistics, space and tempdb, backups and restores, Always On, Agent jobs, security and dbatools one-liners.

5 min readIntermediate

SQL Server / How-to

SQL Server estate discovery and assessment before a cloud migration

Build a complete inventory of SQL Server instances, databases, features and dependencies, then assess compatibility with each target. Covers the tools for Azure and AWS, the T-SQL queries to fill the gaps, and how to turn the results into migration waves.

3 min readIntermediate

SQL Server / Runbook

The job broke when Dave left: getting SQL Agent job ownership and security right

Job ownership decides whether a job can run at all and under which security context its steps execute. Why jobs owned by personal logins fail when people leave, which owner to choose, how ownership affects T-SQL steps versus proxies, and scripts to find and fix risky owners across the estate.

4 min readIntermediate

SQL Server / How-to

What runs when? A readable SQL Agent schedule report decoded from msdb

SQL Agent stores schedules as bitmasks and packed integers. This post decodes freq_type, freq_interval, relative intervals and sub-day settings into plain English, and builds a report of every job, its schedules and next run time. Use it for on-call run books, overlap checks and maintenance-window planning.

5 min readIntermediate

SQL Server / How-to

When RDS isn't enough: moving SQL Server to Amazon RDS Custom for SQL Server

RDS Custom gives a managed SQL Server with OS and sysadmin access for apps that can't run on standard RDS. Covers when to choose it, prerequisites, the shared responsibility model, migrating with native backups, automation pause for customisations, and HA.

3 min readAdvanced

SQL Server / How-to

Why your SQL Agent history only goes back two days, and how to keep 90

SQL Server Agent keeps only 1,000 history rows by default, 100 per job, so busy servers lose history within days. Three ways to keep what you need. Raise the row limits, switch to time-based purging, or archive history to a table, with scripts and msdb sizing advice.

4 min readBeginner

SQL Server / Runbook

SQL Server error 9002: the transaction log is full

Use log_reuse_wait_desc to see why the log can't be truncated, fix the specific cause (missing log backups, long transactions, replication, AG), and shrink only when it's safe.

2 min readIntermediate

SQL Server / Runbook

SQL Server blocking and deadlock triage

Find the head blocker in seconds, pull deadlock graphs from the system_health session, and pick the right long-term fix, from indexes to RCSI.

3 min readIntermediate