BXUP Track progress & test yourself — free
Database & ERP · Module · ~9 min read
DATABASE & ERP · MODULE

AI in Database Reliability & Security Ops

Put AI inside the on-call loop as a cited investigator — runbooks from real incidents, an incident copilot over read-only MCP, monitoring agents you evaluated before trusting — and keep it firmly outside the loop where it does not belong: failover, DR execution, and anything that changes production state.

Reliability work has a clean dividing line for AI. On one side: investigation, drafting, and evidence assembly — reading logs, correlating changes, writing runbooks and RCAs, clustering grants into narratives. AI is strong there, and the toil it removes is exactly the toil that burns out on-call rotations. On the other side: state-changing decisions under uncertainty — failing over, restoring, revoking, killing. Practitioners consistently refuse AI autonomy there, and this module teaches you to hold that line deliberately with guardrails, not accidentally with luck.

The scenario — the agent that found a story

Imran runs the database estate at a Bengaluru fintech: forty PostgreSQL instances, a two-person DBA team, an on-call rotation that owns everything. He deploys an open-source monitoring agent (Xata Agent-class: watches metrics and logs, runs approved read-only playbooks, posts diagnoses to Slack) against a staging fleet first — because he has learned to evaluate before trusting.

  1. THURSDAY 14:20

    Fault injection day. He drives one staging instance to connection exhaustion with a scripted connection storm — a fault he has seen twice in production.

  2. 14:23

    The agent posts within three minutes: connections at max, top consumers by application name, and a correct suggestion — a leaked pool in one service. Genuinely impressive. It cites the queries it ran.

  3. 14:40

    Second fault: a runaway analytical query pinning CPU. The agent's diagnosis this time is plausible but wrong — it attributes the CPU to autovacuum activity that happens to be running concurrently, and suggests tuning autovacuum cost limits.

  4. 14:55

    Imran checks pg_stat_activity himself: the runaway query is right there, top of the list by CPU time. The agent's playbook had looked at the autovacuum view first and anchored on the first plausible story it found.

  5. THE VERDICT

    One right, one confidently wrong, both fluent. The agent earns a place as a first-pass annotator on staging — its diagnoses labeled as hypotheses, never dispatched as fact — and a re-evaluation gate before it sees production.

That evaluation memo — what it caught, what it missed, what guardrails it runs under — is the artifact that separates engineering from hope. Any AI given standing access to your databases gets one before it gets trust, and gets re-evaluated when its playbooks or model change.

Runbooks and RCAs — the drafting wins

The unglamorous, highest-adoption use of AI in ops is turning what already happened into documents people actually maintain:

  • Runbooks from resolved incidentsfeed the shell history, the timeline, and the resolution into the model; get a structured SOP with steps, decision points, and verification commands. The gate: the on-call engineer replays it in a game day before it enters the wiki. An untested runbook is a liability with formatting — it fails you at 3 a.m., which is the only time it runs.
  • DR drills and backup validationfrom a topology description, AI drafts drill scenarios with an RPO/RTO matrix, failure-injection list, and validation queries; drill results feed back into the doc. The drafting is AI's; proving restores actually restore is forever yours.
  • RCAs with evidence-per-claimthe model drafts the blameless postmortem from timeline and metrics under one hard template rule: every causal claim carries a citation to a log line, metric, or change record. "The deploy at 14:02 increased connection acquisition [deploy log, pool config diff]" survives review; "the incident was caused by increased load" without a citation gets deleted. The engineer owns the causal chain; AI owns the prose.
Pro Tip

The evidence-per-claim rule does double duty — it makes the RCA better, and it makes hallucination visible. A model forced to cite either finds the citation or exposes that it was narrating. Adopt the rule for every AI-drafted factual document, not just RCAs.

The incident copilot — natural language over read-only MCP

The step beyond drafting is interactive: wire monitoring, schema metadata, and recent-change history into an assistant through a read-only MCP server (Postgres MCP Pro-class), so on-call can ask "what changed in the last 6 hours and what's slow right now?" in natural language mid-incident, at 3 a.m., without hand-assembling six dashboard tabs.

INCIDENT · 03:12

orders-db → copilot triage

3 findingsREAD-ONLY SESSION — every answer carries its queryAsked: "what changed and what's slow since midnight?"
  • Migration 2026_08_03_addcol applied 02:41 — schema change log
  • SELECT … FROM order_events … mean time 14s, 210 calls since 02:45 — pg_stat_statements
  • Replica orders-r2 lag 44s and climbing — replication view
  • Copilot proposes killing PID 8841 — refused: session is read-only; human decides

The copilot investigates and cites. The kill command is Imran's to type, or not.

The guardrail configuration is the actual engineering, and it is the same stack you will meet again in Module 5:

  • A dedicated read-only rolethe copilot's own identity, so the audit log attributes cleanly and revocation is one statement.
  • Statement timeout and row limitsa confused assistant mid-incident must not become a second incident by scanning a 200-million-row table.
  • Blocked schemasno reading pg_authid, auth tables, or user PII; incident triage needs metadata and statistics, not customer rows.
  • An audit log of every query"what did the AI run during the incident?" belongs in the postmortem as a query, not a reconstruction.

The copilot proposes; anything state-changing is a human's keyboard.

Where autonomy is refused — and what AI does instead

INVESTIGATE · OPEN

AI works freely

Log correlation, wait-stat narratives, change-history diffs, "what's slow" queries over read-only MCP, draft communications. Risk is a wrong hypothesis — caught by the human reading it, cheap to survive.

RECOMMEND · GATED

AI proposes, human executes

Kill this session, revoke this grant, apply this config change. Every proposal carries its evidence and its blast radius; a human runs the command. The agent's accuracy here is measured (Imran's memo) before its proposals get default credence.

EXECUTE · REFUSED

Humans only

Failover, DR invocation, restore-over, quorum changes, destructive commands. Wrong actions here are irreversible or cascade. AI's role is before the moment: reviewing HA configs (quorum, sync mode, lag thresholds) and drafting drill plans — never pushing the button.

Note what AI still does for the refused tier: an AG/Data Guard/Patroni config reviewed by a model against failover history surfaces misconfigurations — a sync-mode/timeout combination that risks split-brain, lag thresholds that would promote a stale replica — as review input for the human who owns the topology. High-stakes does not mean AI-free; it means AI advises and humans execute.

Security ops accelerated: access, PII, evidence

Compliance toil is the other half of ops, and it is drafting-shaped — which makes it AI-shaped, with verification gates:

TaskAI's passThe gate before action
Access reviewCluster raw grants/roles into an effective-permission narrative; flag orphaned users, PUBLIC grants, role loops, privilege paths nobody intendedEvery flagged revocation verified against actual usage and an owner, then executed by a human through change control
PII discoveryEngine-native classifiers (SQL Server Data Discovery, Oracle Data Safe) plus an LLM pass over column names and sampled values; output a PII map with masking/encryption proposalsHuman confirms classifications — false positives waste masking effort, false negatives are breaches; DPDP/GDPR obligations mapped per column
Audit-evidence packsAssemble change logs, access lists, backup attestations; AI drafts the narratives linking each claim to its raw exportEvery narrative claim must trace to an attached artifact — auditors sample-check, and one broken link poisons the pack
Patch/CVE triageDigest CU/PSU/CVE notes against fleet inventory into a prioritized plan with per-instance regression-risk notesThe priority call and the maintenance-window decision stay with the DBA

The access-review case deserves emphasis because it is the highest-risk of the four: an AI-flagged "orphaned" account that is actually a service account takes an application down when revoked. The verify-before-revoke gate is the miniature of every gate in this track — AI narrows the search space from four hundred grants to nine suspects; a human confirms each suspect before anything changes.

The PII case carries the sharpest regulatory weight for Indian estates. Under the DPDP Act, the customer, employee and vendor data sitting in OLTP tables is personal data with concrete obligations attached — and "we did not know that column held phone numbers" is not a defense. Engine-native classifiers pattern-match names and formats; the LLM pass adds the judgment layer — a column named ref_txt whose sampled values are clearly Aadhaar-shaped gets caught by the model where the regex missed it, and free-text notes fields (the classic PII hiding place) get flagged for review. The output that makes the exercise durable is a per-column map: classification, obligation (DPDP, GDPR where EU subjects appear, sectoral rules for BFSI), and the proposed control — dynamic masking, redaction, encryption, or access narrowing — each routed through the same change gates as any other production modification. Re-run the pass on schema changes: new columns are where unclassified PII enters.

Warning

Sending grant dumps, log excerpts, or sampled column values to an AI assistant is itself a data flow with compliance weight — logs and samples contain PII and secrets. Use approved enterprise endpoints with retention contracts, redact samples where the classification works without raw values, and treat "what did we send the model?" as an audit question you must be able to answer.

Note

Monitoring agents and incident copilots earn wider scope the same way people do — a track record. Keep Imran's evaluation memo current: re-run the fault gauntlet when the agent's playbooks, model, or your topology changes, and let the memo (not the vendor's demo) set what the agent is allowed to see and say.

Try it now

  1. Turn one incident into a runbook. Take the last incident you resolved, feed the timeline and shell history to your assistant, and draft the SOP — then schedule the fifteen-minute game-day replay that validates it.
  2. Draft one RCA under the citation rule. Re-draft a recent postmortem with evidence-per-claim enforced; delete every causal sentence that cannot cite a log, metric, or change record, and see what survives.
  3. Run one access-review pass. Dump grants for a single non-production database, get the effective-permission narrative and anomaly flags, and verify two flagged items by hand — count how many flags were real.

Check yourself: Your monitoring agent posts, at 02:50: "replica lag caused by network saturation; recommend failing over to replica-2." What do you do with each half of that message, and why?

▸Show answeroptional deep dive — click to expand

The diagnosis half is a hypothesis to verify — check the cited evidence (does the agent show interface metrics, or did it anchor on a plausible story like Imran's autovacuum case?) against your own reads of replication and network views. The recommendation half lands in the refused tier: failover is a human-executed decision regardless of the diagnosis's quality, because a wrong failover on a lagging replica can lose committed transactions. So: verify the claim, decide the action yourself, and log the agent's accuracy in the evaluation memo either way — that record is what calibrates future trust.

This module anchors LAB-06 (incident copilot over read-only MCP) — faults injected, natural-language triage, and an agent-evaluation memo with the guardrail config you chose. Do it at work this week → pb-16 (incident-to-runbook), pb-18 (evidence-per-claim RCAs), pb-19 (the incident copilot), pb-20 (evaluating a monitoring agent), and pb-21 (access reviews with verify-before-revoke).

Key Takeaway:

AI belongs in the on-call loop as a cited investigator and out of it as an executor. Runbooks tested in game days, RCAs with evidence per claim, copilots on read-only MCP with audit logs, agents that pass a fault gauntlet before earning standing — and failover buttons that only humans press.

This is the free reading view. Open BXUP to track your progress, run the hands-on labs, and prove it with original, exam-pattern assessments.
© Anvi Innovate · BXUP — Be Exponentially Upskilled · BXUP is an independent learning platform, not affiliated with or endorsed by AWS, Microsoft, Google, NVIDIA, IBM, Salesforce, Databricks, Oracle or Anthropic. All trademarks belong to their respective owners. · bxup.in