DBA Brain
Monitors MySQL instances as database targets, collecting health metrics, grading them against policies, running scheduled SQL, verifying backups by restore, producing reports/SLA data, and feeding alerts.
Monitors PostgreSQL instances as database targets, collecting health metrics, grading them against policies, running scheduled SQL, verifying backups by restore, producing reports/SLA data, and feeding alerts.
Delivers alerts and reports to Telegram and accepts gated chat commands; optionally lets the AI assistant answer DBA and DevOps questions in Telegram.
This server has a remotely hosted endpoint. Open its connector listing for connection details, authentication requirements, and setup instructions:
DBA Brain
dbabrain.dev · PyPI ·
Downloads · pip install dbabrain ·
MCP: mcpservers.org ·
Glama
An open-source DBA tool for DBAs, SREs and DevOps engineers. It collects health metrics from your SQL Server, Oracle, PostgreSQL and MySQL instances, grades them against policies you write, runs your scheduled SQL, takes backups and proves them by restoring them, checks objectives against real measurement history, and tells you about it — on a schedule, without an agent on any monitored machine.
It sends nothing you did not switch on. No telemetry, no usage reporting, no update check. It connects to the databases and hosts you list; with a dbabrain key, once a day to dbabrain.dev to check that key (the key alone, nothing about your databases); and only if you turn each on, to a chat service and to the AI - through dbabrain.dev, or a model's API on your own key. Nothing else. dbabrain.dev collects none of your data: the key has two jobs only - to authenticate the node and to relay its assistant's AI turns - and dbabrain.dev keeps your email, the key's fingerprint and term, and each AI turn's tokens and cost; never a question, an answer, or anything from your databases.
Better with an AI, complete without one. dbabrain is the harness an AI model works through: get
a free dbabrain key (dbabrain key-request, an email sign-in on dbabrain.dev) and its assistant -
answering through dbabrain.dev, no Anthropic key of yours needed - supports the DBA's and the DevOps engineer's
daily work on databases and servers - it reads what is happening (alerts, backups, jobs, metrics, a
read-only query on the server), explains it, and says the exact command for the next step, in
Telegram or in a terminal; it also guides a new install. It only reads, through the same commands a
person runs. An AI client can also drive it directly over MCP
(dbabrain mcp serve). Leave the AI off, which is the default, and every collection, backup, report
and alert runs exactly the same.
How a model reaches your estate - no public IP, no inbound port, no server of yours on the internet. In every way below the connection is opened FROM your machine, outward; nothing on the internet connects in, and the commands run on your machine with your credentials:
Way | What runs where | What the network needs |
The assistant ( | Your node sends the question to dbabrain.dev, which passes it to the model's API (or, with | Outbound HTTPS to |
An AI app on the same machine (Claude Desktop, Claude Code, any MCP client) | The app starts | Nothing from dbabrain; the app talks to its own model |
claude.ai on the web or a phone |
| Outbound HTTPS/WebSocket to |
Only dbabrain mcp serve --http - serving MCP yourself - needs an address others can reach, and it
is behind a bearer token. What leaves in each case, and what is redacted first:
docs/security.md, docs/07_telegram_app.md,
docs/16_mcp_app.md.
What it does | |
Health metrics | Around ninety metrics across four engines: availability, capacity, performance, recoverability, security, maintenance. Collected and normalised into one shape. |
Graded, not dumped | Every measurement is graded against a policy you wrote. You read a verdict (OK, WARNING, CRITICAL) and pull the evidence only for what came back bad. |
Backups proven by restore | Runs backups, restores them onto a disposable target, verifies the result and records what was proven and when. The restore is the proof. |
Scheduled SQL | Your own SQL, on a schedule or on request, against approved targets, delivered as text or a spreadsheet. The SQL is a reviewable file, never a string in configuration. |
Reports | Fleet inventory, per-server metrics, index usage and SLA pages, with a freshness gate so a stale number is never reported as a current one. |
SLA / SLO | Indicators computed from stored measurement history, objectives evaluated with an error budget, and how much of it is left. |
Alerts and chat commands | Telegram delivery, one message at a time. Commands people send back are gated by the person's clearance and the chat's. |
Configuration as code | Every decision is a JSON file you keep in version control. A threshold change is a diff and a review, not an edit to somebody's script. |
Secrets kept encrypted | PBKDF2-HMAC-SHA256 and Fernet. The passphrase is supplied at run time and never written to disk, a log or the store. A password travels on stdin, never as a command-line word. |
AI assistant (optional) | Day-to-day support for the DBA and the DevOps engineer, on the databases and servers dbabrain watches. Ask in Telegram or at the terminal - why is this alert firing, did last night's backups run, which jobs failed, what is slow on this server, which query regressed - and it finds the answer itself: the metrics, runs, backups and restores in dbabrain's store, the configuration and the logs, a read-only query on the server. It analyses queries - the heaviest by CPU, reads and duration, ad-hoc and single-use plans, plan regressions and plan changes (Query Store) - and indexes (usage, unused, fragmented, invalid). It explains what it found and what to do, and gives the exact command for the next step (a CLI line or a |
Two ways to read what it is, and both are accurate:
A database tool for SRE / DevOps | Nothing is installed on a monitored machine — it reaches instances and hosts the way an operator does, over a connection and a credential you already have. Every decision is a JSON file you keep in version control, so a threshold change is a diff and a review rather than an edit to somebody's script. It schedules itself, or your scheduler drives it. |
A harness for an AI model | Every capability is one command that takes one JSON object and answers with one, with the same seven keys always present. There is no separate agent API: the command a person runs is byte-for-byte the command an agent runs - its own assistant, an MCP client, or a coding agent in a shell. The model reads graded verdicts instead of raw rows, and every action it proposes is one a person can audit. |
The second is not a later ambition. It is why the shape is what it is — and it is the supported path today, because the console that would let a person add an instance in a browser is not finished yet (see Two ways to drive it).
One code path is the point, not a convenience. An agent cannot reach a capability a human
cannot audit, because there is only one of each. Every run is a row in job_runs and a line in a
log with the same shape whoever started it, so "what did the agent do last night" is the same
query as "what did the daemon do last night".
Status
1.0 - in production. The main functions are stable and run in production - on an estate of many SQL Server instances, with a few Oracle and PostgreSQL instances under modest workloads. MySQL and heavier workloads are supported, with less production mileage so far. Reports of how it behaves on other estates are welcome (GitHub issues).
Related MCP server: MCP Database Manager
The goal
To be a tool a DBA, a DevOps engineer or an SRE can rely on — one that works alongside an AI agent and saves a large amount of its tokens, and works just as well with no agent at all.
Three commitments, and they are meant to be held to:
Reliable | Every operation is typed, logged and repeatable. A scheduled run that failed can be replayed by hand from the same JSON request. Backups are not reported as successful — they are restored, and the restore is the proof. |
Cheap for an agent to use | An agent working a database from a shell pays, in context, for every raw result set it reads — on every check, most of them healthy. Here it sends a small request and reads a graded verdict, then pulls the evidence only for what came back bad. |
Not dependent on one | No model is required. The assistant makes setup and day-to-day questions easier; without it, no model is contacted, and the daemon, the schedules, the reports and the alerts all still run. The model is a caller, never a component the estate depends on. |
The shape of that, because it is the whole argument in one picture:
WITHOUT a tool WITH DBA Brain
agent -> raw SQL -> agent agent -> DBA Brain -> database
"check this database" "check this database"
-> SELECT ... dm_os_wait_stats -> one JSON request
<- every row, into the context
-> SELECT ... sys.databases <- one graded envelope:
<- every row, into the context 41 checks, 40 OK,
-> SELECT ... backupset 1 WARNING: appdb
<- every row, into the context log backup 31h old
-> ... once per check, per run
<- all of it, healthy or not -> fetch the evidence for
the ONE that came back bad
The model reads the evidence and
derives the verdict, every time. The verdict was derived in
It pays for the 95% that was fine. reviewed SQL, once, by a person.The saving is not compression — it is not sending what nobody needed to read. Grading a metric is a fixed decision that belongs in SQL somebody reviewed, not a judgement re-made by a model on every cycle from raw rows. The agent's context is then spent on the thing that is actually hard: what to do about the one check that failed.
And the target that is not met yet: a person who has never seen this project should go from
pip install dbabrain to a collecting install by pointing an AI agent at these docs — no estate
bundle from another machine, and no assumption that they already know what a database ought to be
checked for. Today that path expects more DBA knowledge than it should. Closing that gap is the
current priority; see docs/first_run.md for where it stands.
What it is not
It is not an AI that runs your estate on its own — it is the harness a model works through. The scheduler, the grading, the backups and the alerts are code and reviewed SQL; no model decides any of them, and none is needed for them. The optional assistant answers through dbabrain.dev once the node has a dbabrain key (or on your own Anthropic key), reads through read-only tools, and proposes commands for a person to run. Every capability takes one JSON object and answers with one, and that shape is what lets a human, a shell script, a chat command and a model drive the same operation without a translation layer. The distinction is worth keeping: an operation that does not reason is one you can audit, and the judgement about whether to restore production stays with whoever is accountable for it.
It does not replace incident analysis, change approval, or runbooks. It supports them. A restore drill proves a backup is restorable; deciding to restore production is still yours.
It is not a dashboard product. It has a web console for reading reports and editing configuration, but the primary interface is a CLI and its primary output is a record in a database you own.
It installs nothing on your databases. No agent, no extension, no stored procedure. It logs in with a read-only account and asks questions.
Who it is for
A DBA or small team responsible for a handful to a few dozen instances across more than one engine, tired of it living in twelve cron jobs and a folder of scripts. If you have one PostgreSQL cluster and a hosted monitoring product you are happy with, this is more machinery than you need.
Two more, deliberately:
The person who gets paged about a database without being a DBA — the DevOps or SRE owner of a
service, in a company that has no DBA at all. They need the same operations and should not have to
design a monitoring strategy to get them, so the shipped catalogue is meant to be that
expertise: adopting this should be configuring an estate, not deciding what a healthy database
looks like. That is the intent — docs/first_run.md is honest about how far it holds today.
Whoever is building an agent that has to touch a database and does not want to hand it a shell.
The alternative to a typed operation is an agent composing SQL and psql invocations from prose,
where the blast radius is whatever it happened to write. Here what it can do is the set of commands
that exist: each one reviewed when it was written, each one logged the way a human's run is.
How it works
One run, end to end
Whoever starts it — the daemon, a person, a chat command or an AI agent — a run takes the same
path. The app hands one JSON request to transport, which starts the shared operations CLI; that
CLI reaches the database or host and answers with one JSON envelope. Results land in the runtime
store, and reports and alerts are built from there.
Every command answers in the same envelope, whether the work succeeded or not:
{
"success": true,
"operation": "restore-full",
"message": "Restored SALESDB_STG to 2026-08-07 01:40:00.",
"error": null,
"error_kind": null,
"data": { },
"metrics": { "duration_ms": 41230 }
}From a measurement to an alert
1. Collect | 2. Normalise | 3. Grade | 4. Store | 5. Report / alert / SLA |
around ninety metrics, four engines | one shape for every engine | against your policy in | the runtime store | by severity and error budget |
A backup is proven by restoring it
1. Backup | 2. Copy | 3. Restore | 4. Verify | 5. Record | 6. Clean up |
full / diff / log | to a disposable target | latest or a point in time | the result | what was proven, and when | and apply retention |
Capabilities
Ordered to match the reference docs; the ORD number links to each one.
Sixteen components of two kinds. An app (11: jobs - run as dbabrain daemon -, metrics, sql_tasks, reports, telegram, backup_restore, sla, sre, control, webhost, mcp) does one job, has its own cli.py, and never imports another app. A shared layer (5: db, logging_ops, common, lib, transport) is what every app stands on, and never imports an app. The root package dbabrain is neither: it is the dbabrain entry point and only dispatches. The same table, and who may import or run whom, is in docs/rules.md.
ORD | Component | Kind | Package / config | Responsibility |
Runtime store | shared layer |
| The database the toolkit keeps its own data in — job runs, measurements, report state, the delivery queue, restore history. SQLite to start, PostgreSQL when you outgrow it; the backend is one word in one file. | |
Logging engine | shared layer |
| Scoped application logs, runtime logs, shared errors, and daily archives. | |
App command daemon | app |
| The scheduler: runs each app on its own interval inside its allowed hours, skips one that is still running, and forwards the secret passphrase to every child process. | |
Metrics engine | app |
| Around ninety metrics across four engines — availability, capacity, performance, recoverability, security, maintenance — collected and normalised into one shape. | |
SQL task runner | app |
| Your own SQL, on a schedule or on request, against approved targets, delivered as text or a spreadsheet. The SQL is a reviewable file, never a string in configuration. | |
Reports | app |
| Turns measurements into scheduled reports and inventory pages, with a freshness gate so a stale number is never reported as a current one. | |
Chat delivery and commands | app |
| Delivers the outgoing queue one message at a time, and executes the commands people send back — gated by the person's clearance and the chat's. | |
Backup / restore | app |
| Runs backups, restores them onto a disposable target, verifies the result, and records what was proven and when. | |
SLA / SLO compliance | app |
| Computes indicators from stored measurement history, evaluates objectives with an error budget, and reports what is left of it. | |
SRE | app |
| Provisions the disposable lab databases that drills and rehearsals need — single instances or small HA clusters, in Docker or on VMs. | |
Control | app |
| Builds and deploys the toolkit to another node, and watches the toolkit itself — the one app that reports on the others. | |
Web host | app |
| Serves the rendered reports over HTTP and hosts the console. Publishes files; never generates them. | |
Common — shared operations | shared layer |
| Reaching a host, running SQL, moving a file, rotating a password, confirming something dangerous. Every command takes one JSON object. Invoked as a CLI, never imported. | |
Lib — shared rules | shared layer |
| Values and rules that are pure functions of their arguments: time windows, notify routing, severity, formatting. Imports nothing from the rest of the project. Only ever imported, never run as a CLI. | |
MCP server | app |
| dbabrain for Claude Desktop and Claude Code on your own machine: every | |
Transport — the one client | shared layer |
| Starts |
Sixteen components, and the list is closed. Eleven apps and five shared layers, as the Kind column says; anything new is one of them or a seventeenth ORD with its own directory and its own doc.
Every component has a doc, and every doc has a component. One
docs/NN_*.mdper package, both directions, enforced bytests/test_docs_cover_every_component.py. A component is not finished until its doc exists.That is a claim few projects can make, and it was written the hard way: one shared layer reached 46 modules and roughly 6,500 lines with no documentation and a fully green suite, because nothing connected the two directories.
Install
Python 3.12+. Every database driver is an extra, so a DBA who runs only PostgreSQL is not made to install an ODBC driver and an Oracle client to start.
python -m venv .venv
.venv/bin/pip install 'dbabrain[postgres]' # Windows: .venv\Scripts\pipExtra | For |
| PostgreSQL — pure Python, nothing else to install |
| MySQL / MariaDB — pure Python |
| Oracle — no client library needed for 12.1 and newer |
| SQL Server — also needs Microsoft's system ODBC driver |
| OS-level metrics and maintenance on Linux / Windows targets |
| everything |
Full instructions, including the two prerequisites that are not pip-installable and the container
image: docs/installation.md.
Upgrading an installed root: pip install --upgrade dbabrain, then
python -m dbabrain.common.cli upgrade-config '{}' # the plan: what moves, file by file
python -m dbabrain.common.cli upgrade-config '{"dry_run": false}' # apply; each file is copied firstA release that renames or moves a field keeps reading the old shape, so nothing breaks if you skip
this - your files just stay in the old shape. init and import-data say when there is something
to move. A record whose two spellings disagree is reported and its file left alone.
What it produces
Before installing anything, look at the output. examples/showcase/ holds
the four report families a live estate publishes — fleet inventory, per-server metrics, index usage,
SLA — captured whole, with every name that belongs to that estate replaced by a stable fake one.
Real fleets, real fragmentation, real verdicts; nothing invented and nothing traceable.
Four of those pages, as pictures — click one to open it full size:

Fleet inventory: every instance, its health, and a priority list of what to act on first, each with a recommended next step.

Server metrics: one card per health area, showing the worst reading, the rule that graded it and what it means.

SLA / SLO compliance: a verdict per engine, computed from stored history with no database connections.

Index usage: total, unused, cold and droppable indexes per instance, with how long the counters cover.
A repository cannot show you an HTML page — GitHub renders .html as source — so they are published
as a site by .github/workflows/pages.yml, or you can serve the
folder yourself:
cd examples/showcase
python -m http.server 8000 # then open http://localhost:8000/Most of those pages open straight from disk. The fleet metrics page does not: it is one page for the
whole estate and fetches one series file per server as you pick it, and a browser refuses that from
a file:// page. That is the browser's rule, not a defect in the copy.
Five minutes
A throwaway container, a least-privilege login, seven real measurements — and nothing to uninstall afterwards:
examples/postgres-quickstart/ — needs no system packages.
examples/sqlserver-quickstart/ — same shape, and it finds
a real problem with the instance, then clears it once you fix it.
cd examples/postgres-quickstart
docker compose up -d
python -m dbabrain.db.cli --config config.json init
python -m dbabrain.metrics.cli --config config.json collect --dry-run
python -m dbabrain.metrics.cli --config config.json collect
python -m dbabrain.metrics.cli --config config.json reportTwo ways to drive it
After pip install, someone has to describe the estate — which instances exist, which credentials
reach them, where alerts go. There are two ways to do that, and they differ only in who writes the
files.
Who configures it | Status | |
A person, in a browser | A web console: add an instance the way a database client does — host, port, user, password — and it collects | Planned. The console ships and edits configuration; the add-an-instance flow does not |
An agent, writing JSON | Every decision is a file. An agent writes them and runs three commands | This is the supported path today |
The agent path is the supported one on purpose: the configuration surface has to be settled before something generates it, and a console that writes files nobody has agreed the shape of becomes a second source of truth. The console itself ships — it serves the reports and edits configuration — but adding an instance from a host, a port and a password is not in it yet.
Both paths are written out step by step, with what to assert after each one, in
docs/first_run.md. It is written to be followed by a program and to be
readable by a person, because until the console lands they do the same thing.
From nothing to a running estate
Every command below is real and in this release. The long form, with what each step proves and what
bites people, is examples/standing-up-a-node.md.
Two things belong in every shell that runs these:
export DBABRAIN_SECRET_KEY="<your passphrase>" # or --key / --key-base64 per command
export PYTHONIOENCODING=utf-8 # a Windows console is cp1252 and dies on the emoji1. Install, and write the starting files
pip install "dbabrain[postgres,mssql,ssh,winrm]"
mkdir my-estate && cd my-estate
dbabrain guide # writes nothing; says what the next steps are
dbabrain init # config.json, data/*.json, secrets/secret_text.json[winrm] is not optional if you monitor a Windows host outside a domain: without pypsrp the OS
collectors fall back to a local shell that cannot authenticate, and the run looks fine while proving
nothing.
2. The store
python -m dbabrain.db.cli --config config.json init
python -m dbabrain.db.cli --config config.json check # tables, schema_versionSQLite under runtime/ by default — nothing else to install. data/store_config.json is where you
move to PostgreSQL later; db use-store sqlite|postgres switches it.
3. Prove the schedule runs before configuring anything
python -m dbabrain.jobs.cli --config config.json --onceEvery shipped command must reach status=done on a root where nothing is configured, reporting
what is missing rather than failing. The web host is skipped by --once on purpose — it is a
long-running service. If something errors here, stop: it will not get better once there is data.
4. Add a database — one command, not four hand-edits
python -m dbabrain.common.cli instance-add - <<'JSON'
{"server_id": "ACME-192-0-2-9", "db_type": "sqlserver", "ip": "192.0.2.9",
"port": 1433, "service_name": "MSSQLSERVER", "major_version": 16,
"site": "ACME", "environment": "prod", "username": "dba_monitor", "password": "<the password>"}
JSONIt writes the inventory record, the credential and the encrypted secret together; the password
never reaches the disk in the clear. Read it from stdin (-) rather than passing it inline, or the
password is in your shell history and in argv.
Three fields fail in ways that do not name themselves:
service_nameis a label, not a database. Metric collection connects tomasteron SQL Server, always. Naming a database here fails every target withCannot open database (4060).major_versionpicks the query variant. Wrong version, wrong SQL, confusing errors.default_credential_nameis a reference, not a password.
Adding it is all there is: enabled defaults on and the flags cascade
enabled → metrics → reports → alerts, so the instance is collected and appears on the fleet
inventory, its own metrics page, the index report and SLA with no second switch. To keep one
registered but off the reports, say "reports": {"enabled": false} — that keeps it collected.
For an OS-only host (no database), add cmd_access with method: "ssh" or "winrm", a
credential_name, and auth_type stated explicitly — it defaults to key. method: "local"
with a remote host reports the local machine's CPU under that host's name, and is refused.
python -m dbabrain.common.cli list-targets '{}' # what is registered
python -m dbabrain.common.cli check-secret '{}' # can each credential actually authenticate
python -m dbabrain.metrics.cli --config config.json collect --dry-run
python -m dbabrain.metrics.cli --config config.json collect5. Start the daemon
Start-Process -FilePath ".venv\Scripts\dbabrain.exe" `
-ArgumentList "daemon","--config","config.json" `
-WorkingDirectory (Get-Location) -WindowStyle HiddenSet timezone in config.json to your own zone before this. It decides what a time_window's
from_hour/to_hour mean, and the default is UTC — on a +07 estate that puts the heavy nightly
metrics (DATABASE_CHECKDB, MAINTENANCE_INDEX_*, OS_REBOOT_PENDING) in the middle of the
working day.
The reports and the console come up on http://<host>:8080/report_dba/ and /dbabrain/.
6. Telegram — the bot, its groups, and who may command it
# 1. the token, straight into the encrypted store - stdin only, never inline
python -m dbabrain.common.cli secret-set - <<'JSON'
{"ref": "TELEGRAM_BOT_TOKEN", "value": "<token from BotFather>"}
JSON
# 2. who the token belongs to
python -m dbabrain.telegram.cli --config config.json bot-info
# 3. add the bot to your groups as an ADMIN, post one message in each, then discover them
python -m dbabrain.telegram.cli --config config.json save-updates
# 4. give each discovered group a level, and yourself the level that may run commands
python -m dbabrain.telegram.cli --config config.json group-level --group -1001234567890 --level 40
python -m dbabrain.telegram.cli --config config.json user-level --user @you --level 100
# 5. prove the routing before trusting it - `route` takes the level as a positional argument
python -m dbabrain.telegram.cli --config config.json route warning
python -m dbabrain.telegram.cli --config config.json send-message --chat-id -1001234567890 --text "hello"A non-admin bot cannot read group messages unless privacy mode is off — that is the usual reason
save-updates finds nothing. Alerts ship on; nothing can be sent before a token exists and a
group has a level, so storing the token is the switch. The explicit level_chat_map wins over a
group's own notify_level, so change both or neither.
Never type a password into a bot command line. A command line is stored — in Telegram's history
and in this node's tables. Answer secret prompts at the prompt (they are stored masked) or use a
secret_ref.
7. Backups
Backups are declared in data/restore_config.json under backups, each with its jobs and a
cleanup_retention in seconds — the field is required, because a backup directory nobody prunes
fills a disk and "keep forever" should be something somebody wrote down.
python -m dbabrain.backup_restore.cli --config config.json list-backups # what is configured
python -m dbabrain.backup_restore.cli --config config.json backup # run what is due
python -m dbabrain.backup_restore.cli --config config.json prune-backups # apply retentionOne backup from a self-contained spec, without configuring anything:
python -m dbabrain.common.cli backup-database @request.json
python -m dbabrain.common.cli list-backup-files @request.json # full / diff / log, per engine8. Restore, and the drill that proves a backup is real
Restores are declared beside the backups under restores. A restore is how you learn a backup is a
backup rather than a file.
python -m dbabrain.backup_restore.cli --config config.json restore-latest # newest FULL, with recovery
python -m dbabrain.backup_restore.cli --config config.json restore-workflow # copy, restore, then clean up
python -m dbabrain.backup_restore.cli --config config.json restore-workflow --restore-id <id> --point-in-time "2026-09-25 12:00:00 +07:00"A physical restore carries the source's logins with it. After a drill the target answers to the source's password, so the credential you stored for the target goes stale — re-point it or rotate it, and expect that the first collection after a drill fails until you do.
Both halves run on the schedule as APP-BACKUP-RESTORE; an install with nothing configured reports
"nothing configured" and finishes done.
9. Check what you built
python -m dbabrain.common.cli self-status '{}' # this node, and the URLs it serves
python -m dbabrain.reports.cli --config config.json inventory-workflow --days 7 --beauty 1
python -m dbabrain.sla.cli --config config.json validateThe fleet page should list every instance you registered, each row linking to its own metrics page and — for SQL Server targets, once the nightly index metric has run — its index report.
How it is configured
Everything is JSON you own. A new threshold, target, route, schedule or severity belongs in
data/*.json, never as a literal in Python — the design assumes the person affected by a setting
can read it, change it, and be reviewed on the change.
config.json → where runtime output goes, and which declaration files to read
data/*.json → what to run, monitor, report and deliver
secrets/ → the plaintext source of the encrypted secret store (git-ignored)
assets/ → the SQL and scripts that implement itEvery configuration file has a *.example.json beside it, complete enough to copy, rename and
edit, with a notes array explaining what it decides and why.
The tool finds its configuration by a stated order, not by where its code sits on disk:
DBABRAIN_HOME, then the working directory if it holds data/ or config.json, then the package
location. That is what makes an installed copy work, and it is why standing in an example
directory is enough to run against it.
Secrets
Passwords and tokens live encrypted in data/encrypted_secret_text.json — PBKDF2-HMAC-SHA256 over
a per-file salt, sealed with Fernet. The passphrase is supplied at run time and is never written to
disk, a log, or the store. Configuration names a reference; the value is resolved from the
environment first and the encrypted store second, so an organisation with an external secret
manager never has to use the built-in one.
A request carrying a password is passed on stdin, never as a command-line word — argv is world-readable in the process table.
See docs/security.md, which also covers the least-privilege login the
toolkit needs on each engine, the audit trail, and running with no outbound network access.
How it is put together
Sixteen components - eleven apps and five shared layers - and rules about who may call whom, four of them below - with a guard test beside each rule, because a diagram describes what someone intended and a test describes what is true this morning.
commonmay not be imported — it is only ever run as a CLI.libmay not run a CLI — it is only ever imported. No app imports another app. No shared layer imports an app.
See docs/architecture.md.
Documentation
Start here | |
pip and Docker, the engine extras, the ODBC and Oracle prerequisites | |
From | |
Where configuration lives, and what every file decides | |
Secrets, least privilege, the audit trail, air-gapped operation | |
The components, the layers, and the rules that keep them apart | |
Worked configurations you can copy whole | |
The pages a real estate publishes, scrubbed — what the output actually looks like |
Component reference | |
Store backends, schema, migration, troubleshooting | |
Log scopes, files, and archive behaviour | |
Scheduling, time windows, timeouts, key forwarding | |
The metric catalogue per engine, and least-privilege setup | |
SQL task configuration, parameters, and execution | |
Report creation, schedules, and finding delivery | |
Delivery, bot commands, and permissions | |
Backup, restore, verification, and history | |
Objectives, indicators, and error budgets | |
Lab provisioning, HA topologies, and delegated workflows | |
Build, deploy, and watching the toolkit itself | |
Serving reports, the stable | |
The shared operations layer, command by command | |
The pure rules layer, the purity guarantee, and the module index | |
The one client of | |
dbabrain as an MCP server for Claude Desktop and Claude Code | |
Every rule the project keeps, numbered, with the test that guards it |
Project | |
How to contribute, and the rules that exist because something broke | |
Reporting a vulnerability | |
What changed, written for someone deciding whether to upgrade | |
Tests
The suite is offline: no database, no network, no delivery. That is why it runs anywhere and why you can refactor with it.
.venv/bin/python -m pytest tests -q # full suite
.venv/bin/python -m pytest tests/test_<area>.py -q # while developingTests read as prose — a module docstring explaining why the behaviour matters, then test names that are sentences.
Contact: investors, sponsors and developers welcome
DBA Brain is free, open source, and maintained by one person - and open to people who want to build
it further together. Investors and sponsors: talk about investment, partnership or sponsorship.
Developers: engines, metrics, reports, fixes - read CONTRIBUTING.md and open
an issue or a pull request, or write first. Get in touch directly:
Website | |
Phone | +84 888 783 789 (0888 783 789) |
For bugs and feature requests, please use GitHub issues. For a security problem, follow
SECURITY.md rather than email.
License
Apache License 2.0. See NOTICE.
Available Tools
108 toolsadd-sqlADestructiveInspect
dbabrain common.cli add-sql: A single-script SQL task and its target in one call (the older add-sql).
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
db_type (required): sqlserver | oracle.
server_id (required): The machine.
display_name (required): What a person reads.
sql_text: The SQL.
sql_file: Or a file of it.
instance_name: The instance.
service_name: A label.
database_name: One database.
credential_name: Which login in users.json; default: the instance's own.
from_day: Schedule: first day.
to_day: Schedule: last day.
from_hour: Schedule: first hour.
to_hour: Schedule: last hour.
repeat_interval: Schedule: interval.
timeout: Schedule: budget.
inactive: Register switched off.
manual_only: Only when asked for.
output: none | chat | xlsx | csv.
output_chat: Where the result goes.
notify_chat: One level for both notifications.
logging_chat: Progress level.
error_chat: Failure level.
logging_chat_id: Or a chat id.
error_chat_id: Or a chat id.
logging_on_run: false: no progress message.
alert_on_error: false: no failure message.
data_dir: Another data/ folder to read.
Inputs: request. Returns: result
app-command-setADestructiveInspect
dbabrain common.cli app-command-set: An app command's schedule or state, changed field by field.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
app_code (required): Which command.
active: Switched on.
node_role: Which nodes run it.
run_mode: sync | async.
max_parallel: async: at most this many.
time_window: A partial window: named fields change.
sort_order: Where it is listed.
display_name: Its title.
note: Why.
data_dir: Another data/ folder to read.
Inputs: request. Returns: result
askBDestructiveInspect
dbabrain common.cli ask: One question for the controlling terminal, and the answers it takes.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
prompt (required): The question, shown as written.
choices: The accepted answers, lower case; none means any line is the answer.
tries: How often a person is asked again after an answer not in choices.
deadline_seconds: How long to wait for a line; nothing by then is no answer.
answer: A reply the caller already collected, held to choices like a typed one.
Inputs: request. Returns: result
authorizeBDestructiveInspect
dbabrain common.cli authorize: A confirmation asked for on its own, for a caller that does the work itself.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
operation (required): The operation being authorised.
target_id: What it will act on - the id typed back at level 100.
target_label: How that target is shown.
effects: What it will do, shown first.
confirm: The payload declares the operator agreed.
confirm_target: The second answer, when the operation costs two: the target's own id, typed back.
assume_yes: Unattended: take the typed yes as given.
authorized_by: Who approved it, for example {"channel": "telegram"}.
reason: Why, for the evidence.
rules: What the operation costs to confirm: {level, confirmations, challenge, effects} - the node's own emergency_operations.json entry for it. Absent, the ladder the package ships prices it; malformed, it is refused rather ...
Inputs: request. Returns: result
backup-databaseADestructiveInspect
dbabrain common.cli backup-database: One backup run on a host.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
db_type (required): The engine.
host: The host.
label: What to call it.
level: full | diff | log.
script: The engine script.
script_path: Or its path.
env: Values the script reads.
server_metadata: Refused since 0.23.0 - the export resolves its instance from the inventory, and backup-database reads no configuration. Run sqlserver-export-instance after the backup.
timeout: How long it may run.
dry_run: Plan only: change nothing.
Inputs: request. Returns: result
backup-stopADestructiveInspect
dbabrain common.cli backup-stop: One running backup to stop on its host: its process tree first, then its sessions.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
run_tag (required): The run's DBABRAIN_RUN_TAG, <backup_id>_<job_runs id>: its pid file /dbabrain_runs/.pid and its sessions' host_name dbabrain:. A-Z a-z 0-9 _ . -, at most 100.
db_type (required): The run's engine; sqlserver also ends every session the run opened.
host: Where the run is: hostcmd's block {runtime, host, port, access, username, password|key_file}, as backup-database took it. runtime windows runs the PowerShell stop.
env: Resolved values: DOCKER_CONTAINER, MSSQL_SERVER, MSSQL_USER, MSSQL_PASSWORD - the run's own login. Any other key is not sent.
timeout: Seconds the stop may take; default 120.
Inputs: request. Returns: result
build-showcaseBDestructiveInspect
dbabrain common.cli build-showcase: Where the published pages are, and where the showcase goes.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
source: The pages.
output: The showcase folder.
pattern: Which files.
stamp: The day to show.
allow: Terms allowed.
extra_terms: More terms, each with its kind, for example {"SITECODE": "database"}.
force: Replace an existing output.
verify: Scan the output after.
Inputs: request. Returns: result
check-credentialsCRead-onlyInspect
dbabrain common.cli check-credentials: Which data/ folder to check - against the reference, or for logins that resolve.
Request fields (pass them as request):
data_dir: Another data/ folder to read.
format: json (default) | txt.
Inputs: request. Returns: result
check-identifiersBRead-onlyInspect
dbabrain common.cli check-identifiers: A tree to scan for this estate's identifiers.
Request fields (pass them as request):
root: The tree.
paths: Paths within it.
allow: Terms allowed.
extensions: File types.
extra_terms: More terms to find.
from_inventory: Take terms from the inventory.
max_examples: Examples per term.
Inputs: request. Returns: result
check-objectsCRead-onlyInspect
dbabrain common.cli check-objects: Which data/ folder to check - against the reference, or for logins that resolve.
Request fields (pass them as request):
data_dir: Another data/ folder to read.
format: json (default) | txt.
Inputs: request. Returns: result
check-referencesCRead-onlyInspect
dbabrain common.cli check-references: Which data/ folder to check - against the reference, or for logins that resolve.
Request fields (pass them as request):
data_dir: Another data/ folder to read.
format: json (default) | txt.
Inputs: request. Returns: result
check-secretBRead-onlyInspect
dbabrain common.cli check-secret: Which secret refs to prove by using them.
Request fields (pass them as request):
refs: The refs; all when absent.
match: Or a pattern.
allow_name_host: Removed in 0.26.0: a request carrying true is refused. A secret is sent only to a host the configuration names for its ref - never to one read from the ref's name; a ref nothing names answers NO_TARGET.
timeout_seconds: How long to wait.
Inputs: request. Returns: result
check-secret-literalsCRead-onlyInspect
dbabrain common.cli check-secret-literals: A tree to scan for secret values.
Request fields (pass them as request):
root: The tree.
paths: Paths within it.
store: The secret store compared against.
Inputs: request. Returns: result
copy-filesADestructiveInspect
dbabrain common.cli copy-files: Named files copied from one host to another, removing nothing - a repository copy.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
files: The files, each {source, target, file_name, size_bytes, sha256} - all five required (0.37.0): source as the source host (or the share) names it, target an absolute path on the target host (a drive path on a windows ta...
overwrite (required): false: a target name that already holds a file is left exactly as it is (the source is not read, the line fails saying so), and a copy lands only by a rename that refuses an existing name. true: the target name is rep...
source: The SSH host the files are on: {host, port, username, password|key_file}. Or give source_share.
source_share: Instead of source: a Windows share {host, share, username, password, domain?}, read with smbclient (or the UNC path on a Windows node); each file's source is then its path under the share.
target: The SSH host the files go to: {host, port, username, password|key_file, platform}. Nothing there is ever removed but this copy's own partial file. platform windows (0.39.0): a Windows OpenSSH host - each file written ...
timeout_seconds: Seconds the whole command may take; default 21600. A read or write that stalls for 300 s gives up its file, not the command.
stall_seconds: Seconds one read or write may stop moving before its file is given up; default 300.
transfer (required): How the bytes travel over SSH: cat (a plain cat channel with a large window, the source read ahead in a thread) or sftp (paramiko SFTP, read ahead and pipelined). Required - never assumed (0.37.0).
encrypt: Encrypt on the way (0.38.0, 1.330): {recipients: [age1... public keys], key_id, key_expires_at}. Each file lands as .age and its plain bytes never reach the target; they are held to the line's size_bytes and s...
Inputs: request. Returns: result
copy-schemaBDestructiveInspect
dbabrain common.cli copy-schema: A schema to copy from one database into another.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
source: Where the schema is read from: {connection, database_name, schema} - connection is the complete login (db_type, host, port, username, password). The app that calls fills it from its own data/ (dbabrain.lib.data_source...
destination: Where it is written: {connection, database_name, schema} - connection is the complete login. The app that calls fills it from its own data/ (dbabrain.lib.data_sources.request_fill); common.cli reads no configuration (...
mode: plan | apply.
tables: Which tables.
include_tables: Only these.
exclude_tables: Not these.
modules: Which modules.
include_modules: Only these.
exclude_modules: Not these.
with_data: Copy rows too.
batch_size: Rows per batch.
create_schema: Create it.
skip_nonempty_tables: Leave a table with rows alone.
map_filegroups: Filegroup mapping.
partition_boundaries: Copy partition boundaries.
module_passes: Passes over modules.
phases: Which phases.
plan: A plan to apply.
verify: Compare after.
report_unsupported: List what cannot be copied.
assert_dest_instance: The instance it must be.
lock_name: The application lock.
lock_timeout_seconds: Waiting for it.
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].schema: The schema.
database_name: One database.
timeout_seconds: How long to wait.
key: The secret-store passphrase, when not in the environment.
key_base64: The same, base64.
Inputs: request. Returns: result
create-db-dockerADestructiveInspect
dbabrain common.cli create-db-docker: One lab database Docker instance to build.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
name (required): The instance's name: folder, compose project and container.
engine (required): postgres | mysql | mssql | oracle | oracle-xe.
version (required): The image tag, checked against the registry first.
mode: single (default) | ha-lab.
replicas: ha-lab only: standbys. Omitted = the engine's default.
host_port: The host port of the primary. Omitted = the engine's own.
password_ref: The secret REF the connection record names.
password: Its RESOLVED value. A dry run may omit it.
backup_mount: Host folder bind-mounted at the same path; empty = none. Omitted means nothing stated: no mount for an engine that needs none, and refused by name for one that mounts its backup folder (SQL Server) - the node's own is...
network_subnet: The compose network's /24. Omitted = derived from the name.
data_host_dir: PostgreSQL single only (0.37.0): keep the data in this host folder, bound at /var/lib/postgresql, instead of a Docker named volume - e.g. on a share. Absent: the named volume.
run_as: The uid:gid the container runs as (0.37.0) - for a host folder whose files only one uid can own, such as an NFS share that maps every user to one uid. Absent: the image's own user.
timezone: A single instance (0.40.0): the container's TZ - the clock its database reads its own time in. Absent: the image's own, UTC.
containers_dir (required): Where the instance folder is written on its host. Stated by the caller - the node's own is sre.docker_db.containers_dir - because the command reads no configuration and assumes no folder; a request without it is refus...
worker_host: The address recorded for an instance built on this machine.
remote: Build on this Ubuntu host over SSH. An ssh_login object: host, port (22), username, and a RESOLVED password or an absolute key_file path - never a ref;
labelnames it in messages.install_docker: With remote: install Docker and prepare the folders first. Never on a dry run.
sudo_password: With install_docker: sudo's password. Omitted = the SSH one.
health_timeout: How long to wait for health. Omitted = the engine's own ceiling.
force: Rebuild an existing instance - destroys its containers and volumes.
dry_run: Render the plan; connect to nothing, change nothing.
Inputs: request. Returns: result
create-table-from-xlsxADestructiveInspect
dbabrain common.cli create-table-from-xlsx: A spreadsheet or CSV loaded into a new table.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].credential_name: Which login in users.json; default: the instance's own.
sql_access: How to reach the SQL engine, overriding the instance's block.
database_name: One database.
schema: The schema.
table_name: The table; generated when absent.
file_path: The file here.
file_base64: Or its bytes.
delimiter: csv: the delimiter.
if_exists: fail | replace.
load_rows: Insert the rows, not just create the table.
max_rows: At most this many rows.
text_length: The width of every text column.
timeout_seconds: How long to wait.
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
Inputs: request. Returns: result
credential-removeADestructiveInspect
dbabrain common.cli credential-remove: One login of users.json to remove, by its credential_name; a plan unless apply.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
data_dir: The data/ folder the record is removed from.
credential_name (required): The login to remove.
server_id: The server whose login it is, where several servers' groups share the name.
apply: true removes the record; absent or false answers the plan and writes nothing.
Inputs: request. Returns: result
db-activityCRead-onlyInspect
dbabrain common.cli db-activity: One database object or the server's activity read: a table, a definition, what runs now, a plan.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].credential_name: Which login in users.json; default: the instance's own.
sql_access: How to reach the SQL engine - the inventory's (the 8i bridge).
database_name: The database to read in; SQL Server: else master.
object: table-info / object-source: the object,
name,schema.nameor[schema].[name].view: db-activity: requests (default) | blocking | waits | top_queries.
sql_text: query-plan: the one statement to compile - never run.
max_rows: db-activity: rows at most, 1 to 1000 (default 50).
timeout_seconds: How long to wait.
connection: The database login, complete: db_type, host, port, username, password. The app that calls fills it from its own data/ (dbabrain.lib.data_sources.request_fill); common.cli reads no configuration (rules R09).
Inputs: request. Returns: result
db-statusBRead-onlyInspect
dbabrain common.cli db-status: How deep to check an instance.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].depth: instance | database | schema.
database_name: One database.
database_names: Which databases, at depth database.
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
Inputs: request. Returns: result
delete-empty-folderADestructiveInspect
dbabrain common.cli delete-empty-folder: ONE folder deleted only when it holds nothing at all - hidden entries count (0.37.0).
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
host: Where the file is: {runtime (windows | linux | docker | k8s - stated), access (ssh | winrm), host, port, username, password | key_file, container, sudo}; left out, this machine.
path (required): The one folder, in full; never a pattern, never a list.
must_be_under (required): The folder the path must be strictly inside; the fence itself is never deleted.
dry_run: Count its entries, delete nothing.
timeout_seconds: Seconds the host may take - the hash runs at disk speed; default 3600.
Inputs: request. Returns: result
delete-empty-foldersADestructiveInspect
dbabrain common.cli delete-empty-folders: A list of empty folders, each deleted as delete-empty-folder deletes one, in the order given (deepest first); the first not deleted stops the list (0.37.0).
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
host: Where the file is: {runtime (windows | linux | docker | k8s - stated), access (ssh | winrm), host, port, username, password | key_file, container, sudo}; left out, this machine.
folders (required): The folders, at most 20000, deepest first: each {path, must_be_under}. A parent before its child is refused as not empty and stops the list.
dry_run: Check every fact, delete nothing.
timeout_seconds: Seconds each item may take on the host (its hash runs at disk speed); default 3600.
Inputs: request. Returns: result
delete-fileADestructiveInspect
dbabrain common.cli delete-file: ONE stray file to delete by force, inside a named folder (delete-files is refused).
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
host: Where the file is: {runtime (windows | linux | docker | k8s), access (ssh | winrm), host, port, username, password | key_file, container, sudo}; omitted = this machine.
path: The ONE file, by its absolute path - never a pattern, never a folder.
paths: A list of files: REFUSED since 0.38.0, by delete-files whatever else the request carries and by delete-file before the host is reached.
must_be_under (required): The folder the file must be strictly inside; the fence itself is never deleted.
force: delete-file: must be true - this file has no stored facts to be held to. Without it the command refuses and names delete-verified-file.
dry_run: Measure the file and answer what would be deleted; delete nothing.
timeout_seconds: Seconds the host may take: the file is hashed at disk speed.
Inputs: request. Returns: result
delete-verified-fileADestructiveInspect
dbabrain common.cli delete-verified-file: ONE file deleted only when its name, path, bytes and sha256 are all true on the host (0.37.0).
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
host: Where the file is: {runtime (windows | linux | docker | k8s - stated), access (ssh | winrm), host, port, username, password | key_file, container, sudo}; left out, this machine.
path (required): The one file, in full; never a pattern, never a list (
pathsis refused).file_name (required): The file's name - the last part of path.
size_bytes (required): The bytes it must measure on the host now.
sha256 (required): The sha256 it must hash to on the host now - 64 hexadecimal characters.
must_be_under (required): The folder the path must be strictly inside; the fence itself is never deleted.
dry_run: Check every fact, delete nothing.
timeout_seconds: Seconds the host may take - the hash runs at disk speed; default 3600.
Inputs: request. Returns: result
delete-verified-filesADestructiveInspect
dbabrain common.cli delete-verified-files: A list of files, each deleted as delete-verified-file deletes one - its own facts, its own script, over one connection; the first not deleted stops the list (0.37.0).
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
host: Where the file is: {runtime (windows | linux | docker | k8s - stated), access (ssh | winrm), host, port, username, password | key_file, container, sudo}; left out, this machine.
files (required): The files, at most 20000: each {path, file_name, size_bytes, sha256, must_be_under} - every fact required on every item, no other field. One bad or repeated item refuses the whole list before the host is reached.
dry_run: Check every fact, delete nothing.
timeout_seconds: Seconds each item may take on the host (its hash runs at disk speed); default 3600.
Inputs: request. Returns: result
describe-objectCRead-onlyInspect
dbabrain common.cli describe-object: Which object, or which field of it, to describe.
Request fields (pass them as request):
object: The entry; {} lists them all.
field: One field of it.
Inputs: request. Returns: result
disable-jobBDestructiveInspect
dbabrain common.cli disable-job: A break-glass SQL Server action: shrink a log, kill a session, start or disable a job.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].server_id: The instance, when not in target.
sql_access: How to reach the SQL engine, overriding the instance's block.
database_name: One database.
size_mb: shrink-log: the size to shrink to.
spid: kill-spid: the session.
report_rollback: kill-spid: report the rollback's progress.
job_name: start-job / disable-job: the Agent job.
override: Accept a blocking gate.
timeout_seconds: How long to wait.
dry_run: Plan only: change nothing.
confirm: The payload declares the operator agreed.
assume_yes: Unattended: take the typed yes as given.
authorized_by: Who approved it, for example {"channel": "telegram"}.
reason: Why, for the evidence.
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
rules: What the operation costs to confirm: {level, confirmations, challenge, effects} - the node's own emergency_operations.json entry for it. Absent, the ladder the package ships prices it; malformed, it is refused rather ...
Inputs: request. Returns: result
due-checkBRead-onlyInspect
dbabrain common.cli due-check: A schedule and its last run, asked whether it is due.
Request fields (pass them as request):
time_window: The schedule.
row: A store row instead of last_run / last_status.
last_run: The previous run's start.
last_status: done | error | timeout | running.
now: The instant to judge at (UTC).
local_now: The same in local time - checks the hours.
retry_default: The app's retry fallback.
timeout_default: The app's timeout fallback.
default_repeat: The app's interval fallback.
Inputs: request. Returns: result
encrypt-fileADestructiveInspect
dbabrain common.cli encrypt-file: ONE file encrypted with age where it lies on the repository, for a key's public half only (0.37.0).
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
host (required): Where the file is: {runtime (linux | docker | k8s), host, port, username, password | key_file, sudo}.
path (required): The one plain file, in full.
file_name (required): The last part of path - stated, and held to it.
size_bytes (required): The plain file's bytes, as the catalog proved them.
sha256 (required): The plain file's sha256, as the catalog proved it.
must_be_under (required): The repository folder path must be strictly under.
recipients (required): The key's public half (age1...).
key_id (required): The key's number in the runtime store.
key_expires_at (required): When the key stops encrypting (UTC) - refused at and after it.
timeout_seconds: Seconds the host may take; default 3600.
Inputs: request. Returns: result
encrypt-secretADestructiveInspect
dbabrain common.cli encrypt-secret: The plaintext secret source and the encrypted store to write; never the passphrase.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
source: The plaintext file; default secrets/secret_text.json.
dest: The encrypted store; default data/encrypted_secret_text.json.
format: json (the envelope, default) or txt (the lines a person reads).
Inputs: request. Returns: result
entry-removeADestructiveInspect
dbabrain common.cli entry-remove: One record of a data/*.json list to remove, found by its fields; a plan unless apply.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
data_dir: The data/ folder the record is removed from.
file (required): The data/*.json file name.
match (required): The record's fields; exactly one record must match. Its own key (backup_id, restore_id, id, name, ...) is its name; a record told only by a field pointing elsewhere names nothing.
apply: true removes the record; absent or false answers the plan and writes nothing.
Inputs: request. Returns: result
export-dataADestructiveInspect
dbabrain common.cli export-data: Which tool root to carry, into which bundle file, with or without secrets and assets.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
bundle: The bundle file to write. Required.
root: The tool root to export; default the one resolved.
include_secrets: Carry the encrypted secret store; default true.
include_assets: Carry assets/ and data/ssh_keys/; default true.
force: Overwrite an existing bundle file.
format: json (the envelope, default) or txt (the lines a person reads).
Inputs: request. Returns: result
fetch-fileCDestructiveInspect
dbabrain common.cli fetch-file: A file fetched, sent, packed or relayed over the host's own access.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: A label for the answer - the server_id. Nothing is looked up by it: common.cli reads no configuration (rules R09).
server_id: The same label, when not in target.
access: The host login, complete: an inline cmd_access - method (ssh|winrm), host, port, username, auth_type, key_file or password - with the machine's platform and runtime facts. The app that calls fills it from its own data...
remote_path: fetch/send: the file on the host.
local_path: fetch/send: the file here.
overwrite: Replace an existing file.
make_dirs: Create missing folders.
files: pack-files: the files.
folder: pack-files: or a folder.
include: pack-files: patterns within it.
format: pack-files: tar | tar.gz | zip.
archive_path: pack-files: the archive.
checksum_files: pack-files: hash each member.
source: relay-file: {access, target, path} - each side states its own login.
destination: relay-file: {access, target, path}.
Inputs: request. Returns: result
file-checksumARead-onlyInspect
dbabrain common.cli file-checksum: Files hashed on the host that holds them.
Request fields (pass them as request):
paths: The files to hash, full paths as that host sees them - or give folder instead.
algorithm: sha256 - the only one; stated so another is a choice, not a surprise.
host: Where the files are: hostcmd's block {runtime, host, port, access, username, password|key_file, container, pod}. Omit it to hash on this machine.
timeout_seconds: Seconds one batch may take; default 3600 - a large FULL hashes at disk speed.
folder: Instead of paths: every file under this folder, listed on the host (find, or Get-ChildItem -Recurse) and hashed there - a catalog backfill (0.34.0).
include: With folder: file name patterns, case-insensitive ("*.bak"); default every file.
container: With folder: the folder is a path inside this container, translated to the host's through its mounts (docker inspect).
max_files: With folder: at most this many files (default 5000); more is answered as truncated, never cut silently.
Inputs: request. Returns: result
finish-stagingADestructiveInspect
dbabrain common.cli finish-staging: The files that just travelled into a staging, to be given their source's times, and the folder to open for the engine.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target (required): The target host's SSH login: host, port, username and a RESOLVED password or key_file (an absolute path), open_timeout_seconds - never a secret ref: common resolves nothing; platform: linux (also when absent) or windo...
target_dir (required): The staging directory on the target host - on a windows login a drive path (C:/dbabrain_restore/<restore_id>, either separator); a drive path on any other login is refused.
files: The files copy-files landed: {path (relative to target_dir), mtime (the source's, epoch seconds; null leaves the file's time alone)} - prepare-staging's pending.
open_for_engine: chmod -R a+rX on the target after, for the engine's own uid. Default true. On a windows target nothing is changed: SQL Server's service account reads the folder through its ACL, granted once by the operator.
Inputs: request. Returns: result
guideADestructiveInspect
dbabrain common.cli guide: The operating guide, printed or written as AGENTS.md.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
write: Write it as AGENTS.md instead of printing it.
root: Where to write it; default the current directory.
format: json (the envelope, default) or txt (the lines a person reads).
Inputs: request. Returns: result
host-factsCRead-onlyInspect
dbabrain common.cli host-facts: A gated action on a host: facts, a service, a restart.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].access: An inline cmd_access, for a host outside the inventory.
platform: windows | linux, when the inventory does not say.
action: host-service: status | start | stop | restart.
services: host-service: which services.
wait: Wait for the end state.
window: The maintenance window it must fall in.
ignore_window: Run outside that window, deliberately.
overrides: Blocking gates accepted on purpose.
evidence: Where to write the evidence file.
sudo: Run through sudo on Linux.
dry_run: Plan only: change nothing.
confirm: The payload declares the operator agreed.
assume_yes: Unattended: take the typed yes as given.
authorized_by: Who approved it, for example {"channel": "telegram"}.
reason: Why, for the evidence.
policy: The maintenance policy that times this host operation: the node's maintenance_policy.json defaults with this server's own values over them. {} means the built-in defaults. The app that calls fills it from its own data...
rules: What the operation costs to confirm: {level, confirmations, challenge, effects} - the node's own emergency_operations.json entry for it. Absent, the ladder the package ships prices it; malformed, it is refused rather ...
Inputs: request. Returns: result
host-restartBDestructiveInspect
dbabrain common.cli host-restart: A gated action on a host: facts, a service, a restart.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].access: An inline cmd_access, for a host outside the inventory.
platform: windows | linux, when the inventory does not say.
action: host-service: status | start | stop | restart.
services: host-service: which services.
wait: Wait for the end state.
window: The maintenance window it must fall in.
ignore_window: Run outside that window, deliberately.
overrides: Blocking gates accepted on purpose.
evidence: Where to write the evidence file.
sudo: Run through sudo on Linux.
dry_run: Plan only: change nothing.
confirm: The payload declares the operator agreed.
assume_yes: Unattended: take the typed yes as given.
authorized_by: Who approved it, for example {"channel": "telegram"}.
reason: Why, for the evidence.
policy: The maintenance policy that times this host operation: the node's maintenance_policy.json defaults with this server's own values over them. {} means the built-in defaults. The app that calls fills it from its own data...
rules: What the operation costs to confirm: {level, confirmations, challenge, effects} - the node's own emergency_operations.json entry for it. Absent, the ladder the package ships prices it; malformed, it is refused rather ...
Inputs: request. Returns: result
host-serviceBDestructiveInspect
dbabrain common.cli host-service: A gated action on a host: facts, a service, a restart.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].access: An inline cmd_access, for a host outside the inventory.
platform: windows | linux, when the inventory does not say.
action: host-service: status | start | stop | restart.
services: host-service: which services.
wait: Wait for the end state.
window: The maintenance window it must fall in.
ignore_window: Run outside that window, deliberately.
overrides: Blocking gates accepted on purpose.
evidence: Where to write the evidence file.
sudo: Run through sudo on Linux.
dry_run: Plan only: change nothing.
confirm: The payload declares the operator agreed.
assume_yes: Unattended: take the typed yes as given.
authorized_by: Who approved it, for example {"channel": "telegram"}.
reason: Why, for the evidence.
policy: The maintenance policy that times this host operation: the node's maintenance_policy.json defaults with this server's own values over them. {} means the built-in defaults. The app that calls fills it from its own data...
rules: What the operation costs to confirm: {level, confirmations, challenge, effects} - the node's own emergency_operations.json entry for it. Absent, the ladder the package ships prices it; malformed, it is refused rather ...
Inputs: request. Returns: result
import-dataADestructiveInspect
dbabrain common.cli import-data: Which bundle to apply to which tool root, as a plan or for real.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
bundle: The bundle file to read. Required.
root: The tool root to write into; default the one resolved.
plan_only: Report what would be written and change nothing.
force: Replace files that exist with different content.
include_secrets: Write the secret store if the bundle carries one; default true.
include_assets: Write assets/ and data/ssh_keys/; default true.
format: json (the envelope, default) or txt (the lines a person reads).
Inputs: request. Returns: result
initBDestructiveInspect
dbabrain common.cli init: Create a tool root: the directory, the app name, and whether to overwrite.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
root: The directory to initialise; default the current one.
app_name: The app name config.json carries; default dbabrain.
force: Overwrite files that already exist.
format: json (the envelope, default) or txt (the lines a person reads).
Inputs: request. Returns: result
instance-activeADestructiveInspect
dbabrain common.cli instance-active: One instance switched on or off for every app - its active flag.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
server_id (required): The instance, as written in db_instances.json.
active (required): true switches the record on for every app, false off. metrics.enabled is metric-toggle's.
data_dir: Another data/ folder to read.
Inputs: request. Returns: result
instance-addADestructiveInspect
dbabrain common.cli instance-add: An instance to register, with its login.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
server_id (required): Its name everywhere.
db_type (required): The engine.
ip (required): Its address.
site (required): Which site or company the machine belongs to. Required to register; a keep_default request writes no inventory field and carries none.
environment (required): Whether the machine is production, and how a person groups it. Required to register - a restore onto a target whose record states no environment is refused, and only the owner knows it; a keep_default request carries ...
port: Its port.
service_name: A label.
database_name: One database.
username: The login.
password: Its password - encrypted, never written.
password_ref: Or an existing secret.
credential_name: Which login in users.json; default: the instance's own.
role: What the login is for.
replace: Overwrite an existing server_id.
active: Registered switched on (default) or off.
keep_default: Add this login beside a registered server's default, which stays its default: no inventory field is written.
Inputs: request. Returns: result
instance-removeADestructiveInspect
dbabrain common.cli instance-remove: One server's record of db_instances.json to remove; a plan unless apply.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
data_dir: The data/ folder the record is removed from.
server_id (required): The server to remove.
apply: true removes the record; absent or false answers the plan and writes nothing.
Inputs: request. Returns: result
inventory-summaryBDestructiveInspect
dbabrain common.cli inventory-summary: The inventory to summarise.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
inventory: The inventory file.
overlay: An overlay on it.
app_commands: The app commands file.
date: The day to summarise.
output_dir: Where the page goes.
Inputs: request. Returns: result
key-renewADestructiveInspect
dbabrain common.cli key-renew: Get this node a dbabrain key from dbabrain.dev: an email sign-in, the key into the encrypted store.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
node: How the key names this machine - shown on dbabrain.dev and in key-status, never trusted.
server: The service that issues keys.
wait: Wait for the approval with no terminal - when a person reads this command's output (worker-run). Without it and without a terminal the command is refused.
Inputs: request. Returns: result
key-requestADestructiveInspect
dbabrain common.cli key-request: Get this node a dbabrain key from dbabrain.dev: an email sign-in, the key into the encrypted store.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
node: How the key names this machine - shown on dbabrain.dev and in key-status, never trusted.
server: The service that issues keys.
wait: Wait for the approval with no terminal - when a person reads this command's output (worker-run). Without it and without a terminal the command is refused.
Inputs: request. Returns: result
key-statusARead-onlyInspect
dbabrain common.cli key-status: This node's dbabrain key read offline, and dbabrain.dev's answer about it.
Request fields (pass them as request):
online: Ask dbabrain.dev about the key too (GET /key/status); false reads it offline only.
server: The service that issued the key.
Inputs: request. Returns: result
kill-spidADestructiveInspect
dbabrain common.cli kill-spid: A break-glass SQL Server action: shrink a log, kill a session, start or disable a job.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].server_id: The instance, when not in target.
sql_access: How to reach the SQL engine, overriding the instance's block.
database_name: One database.
size_mb: shrink-log: the size to shrink to.
spid: kill-spid: the session.
report_rollback: kill-spid: report the rollback's progress.
job_name: start-job / disable-job: the Agent job.
override: Accept a blocking gate.
timeout_seconds: How long to wait.
dry_run: Plan only: change nothing.
confirm: The payload declares the operator agreed.
assume_yes: Unattended: take the typed yes as given.
authorized_by: Who approved it, for example {"channel": "telegram"}.
reason: Why, for the evidence.
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
rules: What the operation costs to confirm: {level, confirmations, challenge, effects} - the node's own emergency_operations.json entry for it. Absent, the ladder the package ships prices it; malformed, it is refused rather ...
Inputs: request. Returns: result
lift-exampleBDestructiveInspect
dbabrain common.cli lift-example: A config file to copy into an example.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
source (required): The file.
destination: The example.
blank_keys: Keys to empty.
write: Write it (default) or only report.
Inputs: request. Returns: result
list-backup-filesARead-onlyInspect
dbabrain common.cli list-backup-files: Which backup files a directory holds, or which a retention rule would remove.
Request fields (pass them as request):
db_type (required): The engine the files belong to.
host: The host holding them.
target: SQL Server: the instance that lists its own backup folder - {host, port, username, password}.
path (required): The directory.
database_name: One database.
kinds: full | diff | log.
latest: Only the newest per database and kind.
after: Newer than this instant.
before: Older than this instant.
mode: prune: how obsolescence is judged.
cleanup_retention: prune: how long files are kept.
delete: prune: true is REFUSED since 0.38.0 - the command answers the plan and deletes nothing.
timeout_seconds: How long to wait.
wal_segments: PostgreSQL (0.35.0, 1.250): answer every segment name under wal/ on the log row - what a restore's WAL continuity is read from. Off by default: a cluster archives thousands.
Inputs: request. Returns: result
list-databasesBRead-onlyInspect
dbabrain common.cli list-databases: One instance's databases, schemas or jobs listed.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].credential_name: Which login in users.json; default: the instance's own.
sql_access: How to reach the SQL engine, overriding the instance's block.
database_name: One database.
include_system: Include system objects.
enabled_only: list-jobs: only enabled jobs.
timeout_seconds: How long to wait.
key: The secret-store passphrase, when not in the environment.
key_base64: The same, base64.
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
Inputs: request. Returns: result
list-filesARead-onlyInspect
dbabrain common.cli list-files: Every entry under a folder - kind, bytes, time - without hashing (0.37.0).
Request fields (pass them as request):
host: Where the folder is: {runtime (windows | linux | docker | k8s), access (ssh | winrm), host, port, username, password | key_file, container, sudo}; left out, this machine.
folder (required): The absolute folder to list; not there is folder_found false.
max_files: The most entries answered; more is truncated, never cut silently.
timeout_seconds: Seconds the listing may take on the host.
with_folders: True also answers every folder under the folder, as
folders(0.38.0) - what a staging cleanup names an emptied backup set's folders from.
Inputs: request. Returns: result
list-jobsBRead-onlyInspect
dbabrain common.cli list-jobs: One instance's databases, schemas or jobs listed.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].credential_name: Which login in users.json; default: the instance's own.
sql_access: How to reach the SQL engine, overriding the instance's block.
database_name: One database.
include_system: Include system objects.
enabled_only: list-jobs: only enabled jobs.
timeout_seconds: How long to wait.
key: The secret-store passphrase, when not in the environment.
key_base64: The same, base64.
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
Inputs: request. Returns: result
list-schemasBRead-onlyInspect
dbabrain common.cli list-schemas: One instance's databases, schemas or jobs listed.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].credential_name: Which login in users.json; default: the instance's own.
sql_access: How to reach the SQL engine, overriding the instance's block.
database_name: One database.
include_system: Include system objects.
enabled_only: list-jobs: only enabled jobs.
timeout_seconds: How long to wait.
key: The secret-store passphrase, when not in the environment.
key_base64: The same, base64.
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
Inputs: request. Returns: result
list-targetsCRead-onlyInspect
dbabrain common.cli list-targets: A listing that takes nothing but its format.
Request fields (pass them as request):
format: json (default) | txt.
Inputs: request. Returns: result
metric-batchBDestructiveInspect
dbabrain common.cli metric-batch: One target's metric items, run one after another - the metrics app's execution.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target (required): The target's connection facts, resolved: target_id, db_type, host, port, database ("" = the engine's default, master on SQL Server), service_name, sqlserver_driver, sqlserver_tls_verify, username and password; or the ...
secrets: {ref: value} for exactly the secret refs this target's configuration names (a remote login's password_ref, the bridge's secret_ref) - never the whole store.
items (required): One per metric, run in order: {id, kind: sql, sql, timeout_seconds, max_rows, per_database, max_databases} | {id, kind: script, script, shell, access, credential, env, timeout_seconds} | {id, kind: local, path, env, t...
Inputs: request. Returns: result
metric-envADestructiveInspect
dbabrain common.cli metric-env: The inputs a collector script reads from one instance, set or removed.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
server_id (required): The instance, as written in db_instances.json.
env (required): {NAME: value}: written to metrics.collector_env; a value of null removes NAME. A name carrying a secret is refused - metrics.env_secrets maps it to a ref.
metric_code: The variables go to that metric's own block (metric_overrides..collector_env), which wins over the target's.
data_dir: Another data/ folder to read.
Inputs: request. Returns: result
metric-severityADestructiveInspect
dbabrain common.cli metric-severity: How one metric's statuses are remapped for one instance - or a list of such remaps, written together.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
server_id: The instance. Required in the one-remap form; absent beside items.
metric_code: The metric. Required in the one-remap form; absent beside items. "*" is every metric of the server - metrics.severity_map, under each metric's own map, which still wins; it takes no metric_item.
metric_item: One item of it.
severity_map: {STATUS: STATUS}.
note: Why.
items: Several remaps written together, every one or none: each {server_id, metric_code, metric_item, severity_map, note}. With items, the request carries nothing else but data_dir.
data_dir: Another data/ folder to read.
Inputs: request. Returns: result
metric-toggleADestructiveInspect
dbabrain common.cli metric-toggle: A metric, a collector type or all of them switched on or off for one instance.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
server_id (required): The instance.
scope (required): all | a collector type | a METRIC_CODE.
state (required): on | off.
reason: With state off and a METRIC_CODE scope: why the metric is off, written as metric_overrides..disabled_reason. Refused with state on or another scope; switching the metric on clears it.
data_dir: Another data/ folder to read.
Inputs: request. Returns: result
move-db-dockerADestructiveInspect
dbabrain common.cli move-db-docker: One lab database Docker instance to move, data included.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
name (required): The instance: its folder name and compose project.
engine (required): Its engine, for the health probe. The caller reads it from the registry.
source (required): Where it runs now. An ssh_login object: host, port (22), username, and a RESOLVED password or an absolute key_file path - never a ref;
labelnames it in messages.destination (required): Where it goes. An ssh_login object: host, port (22), username, and a RESOLVED password or an absolute key_file path - never a ref;
labelnames it in messages.containers_dir (required): Instance folders on the source: the lab is found under this folder and its name. Stated by the caller - the node's own is sre.docker_db.containers_dir; a request without it is refused by name.
dest_containers_dir: Instance folders on the destination. Omitted = the source's.
stage_dir: Where the bundle is written on both hosts.
include_volumes: Ship the volumes' contents (default true). false = an EMPTY database there.
commit_container: Ship the container's own filesystem too - for an engine writing outside its volumes.
stop_source: Stop the source once the destination is healthy (kept, not removed).
keep_stage: Leave the bundle on both hosts.
force: Replace an instance of the same name on the destination - destroys it.
health_timeout: How long to wait for health. Omitted = the engine's own ceiling.
dry_run: Read the source and say what would move; change nothing.
Inputs: request. Returns: result
object-sourceBRead-onlyInspect
dbabrain common.cli object-source: One database object or the server's activity read: a table, a definition, what runs now, a plan.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].credential_name: Which login in users.json; default: the instance's own.
sql_access: How to reach the SQL engine - the inventory's (the 8i bridge).
database_name: The database to read in; SQL Server: else master.
object: table-info / object-source: the object,
name,schema.nameor[schema].[name].view: db-activity: requests (default) | blocking | waits | top_queries.
sql_text: query-plan: the one statement to compile - never run.
max_rows: db-activity: rows at most, 1 to 1000 (default 50).
timeout_seconds: How long to wait.
connection: The database login, complete: db_type, host, port, username, password. The app that calls fills it from its own data/ (dbabrain.lib.data_sources.request_fill); common.cli reads no configuration (rules R09).
Inputs: request. Returns: result
pack-backupADestructiveInspect
dbabrain common.cli pack-backup: A backup folder packed, or one file pulled or pushed, with checksums.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
host: The host: {host, port, username, password|key_file}.
folder: pack-backup: the folder.
files: pack-backup: or named files.
archive_path: pack-backup: the archive.
format: pack-backup: tar | tar.gz.
remote_path: pull/push: the file there.
local_path: pull/push: the file here.
sha256: The checksum it must match.
timeout_seconds: How long to wait.
Inputs: request. Returns: result
pack-filesCDestructiveInspect
dbabrain common.cli pack-files: A file fetched, sent, packed or relayed over the host's own access.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: A label for the answer - the server_id. Nothing is looked up by it: common.cli reads no configuration (rules R09).
server_id: The same label, when not in target.
access: The host login, complete: an inline cmd_access - method (ssh|winrm), host, port, username, auth_type, key_file or password - with the machine's platform and runtime facts. The app that calls fills it from its own data...
remote_path: fetch/send: the file on the host.
local_path: fetch/send: the file here.
overwrite: Replace an existing file.
make_dirs: Create missing folders.
files: pack-files: the files.
folder: pack-files: or a folder.
include: pack-files: patterns within it.
format: pack-files: tar | tar.gz | zip.
archive_path: pack-files: the archive.
checksum_files: pack-files: hash each member.
source: relay-file: {access, target, path} - each side states its own login.
destination: relay-file: {access, target, path}.
Inputs: request. Returns: result
prepare-stagingADestructiveInspect
dbabrain common.cli prepare-staging: A restore's staging folder to make ready for a backup directory's files, and the question of which still have to travel.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
source: The source host's SSH login: host, port, username and a RESOLVED password or key_file (an absolute path), open_timeout_seconds - never a secret ref: common resolves nothing; platform: linux (also when absent) or windo...
source_dir: The backup directory on the source host.
target: The target host's SSH login: host, port, username and a RESOLVED password or key_file (an absolute path), open_timeout_seconds - never a secret ref: common resolves nothing; platform: linux (also when absent) or windo...
target_dir: The staging directory on the target host - on a windows login a drive path (C:/dbabrain_restore/<restore_id>, either separator); a drive path on any other login is refused.
chain: Read the chain from the source: {db_type (postgresql | oracle | sqlserver), backup_dir (oracle: the path RMAN's catalog names), container (oracle: where RMAN runs), point_in_time (set: the chain that reaches the momen...
include: Path prefixes the restore needs; empty = everything. Stated, it is used as it is; absent,
chainreads it from the source.window_hours: Also copy every file the source wrote in the last N hours, beside the include - copy_selection window. Ignored when include is empty (everything is copied).
make_readable: When something under source_dir is not readable by the login: sudo -n chmod -R a+rX on it first (a live archivelog job writes 0640). Never asks for a password - where sudo needs one it is refused at once and the listi...
space_check: The room the files still to copy must find on the target before the first one moves: free >= bytes x factor. A restore entry's own space_check, handed on by the app; the same object, the same defaults.
staging_marker: The name of the file that marks target_dir as this tool's staging folder: only a marked folder is mirrored, and an unmarked one that shares no file with the source is refused. A restore entry's own staging_marker, han...
replace: Relative paths that travel even when the target holds them at the same size and not older: a copy the caller's checksum gate found different.
plan_only: true: answer only the files the request selects (and the chain, when asked), read from the source; the target is not opened and nothing is prepared.
incoming: Instead of a source (0.39.0): the files the caller already knows, relative to target_dir with their sizes - the target half alone: the folder made, marked and proven writable, the room for the files not there yet at t...
dry_run: With incoming (0.39.0): read only - whether target_dir is there and whose, which files are there already, and whether the rest fit, each a verdict; nothing is made or written. Refused without incoming.
Inputs: request. Returns: result
probe-hostARead-onlyInspect
dbabrain common.cli probe-host: A host to probe for its management ports.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Request fields (pass them as request):
target: A label for the answer - the server_id. Nothing is looked up by it: common.cli reads no configuration (rules R09).
host: The address to probe - required. The app that holds a server_id fills it, with the OS, from its own data/ (dbabrain.lib.data_sources.request_fill).
ports: Which ports.
timeout_seconds: How long to wait.
Inputs: request. Returns: result
prune-backup-filesADestructiveInspect
dbabrain common.cli prune-backup-files: Which backup files a directory holds, or which a retention rule would remove.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
db_type (required): The engine the files belong to.
host: The host holding them.
target: SQL Server: the instance that lists its own backup folder - {host, port, username, password}.
path (required): The directory.
database_name: One database.
kinds: full | diff | log.
latest: Only the newest per database and kind.
after: Newer than this instant.
before: Older than this instant.
mode: prune: how obsolescence is judged.
cleanup_retention: prune: how long files are kept.
delete: prune: true is REFUSED since 0.38.0 - the command answers the plan and deletes nothing.
timeout_seconds: How long to wait.
wal_segments: PostgreSQL (0.35.0, 1.250): answer every segment name under wal/ on the log row - what a restore's WAL continuity is read from. Off by default: a cluster archives thousands.
Inputs: request. Returns: result
pull-fileCDestructiveInspect
dbabrain common.cli pull-file: A backup folder packed, or one file pulled or pushed, with checksums.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
host: The host: {host, port, username, password|key_file}.
folder: pack-backup: the folder.
files: pack-backup: or named files.
archive_path: pack-backup: the archive.
format: pack-backup: tar | tar.gz.
remote_path: pull/push: the file there.
local_path: pull/push: the file here.
sha256: The checksum it must match.
timeout_seconds: How long to wait.
Inputs: request. Returns: result
push-fileBDestructiveInspect
dbabrain common.cli push-file: A backup folder packed, or one file pulled or pushed, with checksums.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
host: The host: {host, port, username, password|key_file}.
folder: pack-backup: the folder.
files: pack-backup: or named files.
archive_path: pack-backup: the archive.
format: pack-backup: tar | tar.gz.
remote_path: pull/push: the file there.
local_path: pull/push: the file here.
sha256: The checksum it must match.
timeout_seconds: How long to wait.
Inputs: request. Returns: result
query-planARead-onlyInspect
dbabrain common.cli query-plan: One database object or the server's activity read: a table, a definition, what runs now, a plan.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].credential_name: Which login in users.json; default: the instance's own.
sql_access: How to reach the SQL engine - the inventory's (the 8i bridge).
database_name: The database to read in; SQL Server: else master.
object: table-info / object-source: the object,
name,schema.nameor[schema].[name].view: db-activity: requests (default) | blocking | waits | top_queries.
sql_text: query-plan: the one statement to compile - never run.
max_rows: db-activity: rows at most, 1 to 1000 (default 50).
timeout_seconds: How long to wait.
connection: The database login, complete: db_type, host, port, username, password. The app that calls fills it from its own data/ (dbabrain.lib.data_sources.request_fill); common.cli reads no configuration (rules R09).
Inputs: request. Returns: result
read-fileARead-onlyInspect
dbabrain common.cli read-file: ONE small file read on its host, its bytes proven by size and sha256 (0.37.0).
Request fields (pass them as request):
host: Where the file is: {runtime (windows | linux | docker | k8s), access, host, port, username, password | key_file, container, sudo}; left out, this machine.
path (required): The one file, in full - never a pattern, a link or a '..' segment.
max_bytes: The largest file read; default 1048576, at most 16777216.
timeout_seconds: Seconds the host may take; default 120.
Inputs: request. Returns: result
relay-fileBDestructiveInspect
dbabrain common.cli relay-file: A file fetched, sent, packed or relayed over the host's own access.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: A label for the answer - the server_id. Nothing is looked up by it: common.cli reads no configuration (rules R09).
server_id: The same label, when not in target.
access: The host login, complete: an inline cmd_access - method (ssh|winrm), host, port, username, auth_type, key_file or password - with the machine's platform and runtime facts. The app that calls fills it from its own data...
remote_path: fetch/send: the file on the host.
local_path: fetch/send: the file here.
overwrite: Replace an existing file.
make_dirs: Create missing folders.
files: pack-files: the files.
folder: pack-files: or a folder.
include: pack-files: patterns within it.
format: pack-files: tar | tar.gz | zip.
archive_path: pack-files: the archive.
checksum_files: pack-files: hash each member.
source: relay-file: {access, target, path} - each side states its own login.
destination: relay-file: {access, target, path}.
Inputs: request. Returns: result
remote-credential-addBDestructiveInspect
dbabrain common.cli remote-credential-add: An OS login to register, and the cmd_access that names it.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
server_id (required): The machine.
host: Its address.
server_description: What it is.
username (required): The OS account.
password: Its password - encrypted, never written.
password_ref: Or an existing secret.
auth_type: password | key.
key_file: The key, for key auth.
credential_name: Which login in users.json; default: the instance's own.
role: A label.
account_owner: Who owns the account.
note: Why it exists.
method: ssh | winrm - write the cmd_access too.
platform: windows | linux.
port: The port.
shell: The shell.
ssl: winrm: TLS.
enabled: The cmd_access block's own switch.
replace: Overwrite an existing one.
Inputs: request. Returns: result
report-server-removeADestructiveInspect
dbabrain common.cli report-server-remove: One server to take off the report's canonical inventory; a plan unless apply.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
data_dir: The data/ folder the record is removed from.
server_id (required): The server to take off.
inventory: The canonical inventory's path.
apply: true removes the record; absent or false answers the plan and writes nothing.
Inputs: request. Returns: result
restore-diffBDestructiveInspect
dbabrain common.cli restore-diff: One restore step on one engine.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
db_type (required): The engine.
target: The instance - an input_remote_target.
sqlcmd: SQL Server: run the step with sqlcmd where the server is instead of a driver from here - the run-sqlcmd request less its sql (instance, sqlcmd_path, username, password, timeouts, via, host). One file per call; the ans...
backup_path: The backup.
backup_paths: Several, in order.
database_name: One database.
move: SQL Server: file moves.
move_files: SQL Server full: {data, log} - where the two files go; the logical names are read on the server (RESTORE FILELISTONLY), and the database goes SINGLE_USER first.
relocate: SQL Server full onto another server: every file RESTORE FILELISTONLY names goes to the target's default data / log folder - or data_dir / log_dir - as _; {} for both defaults; the database goes SI...
replace: SQL Server: WITH REPLACE.
overwrite_existing: Whether the step may replace what the target holds; without true it stops first (0.26.0, G2.10; every engine and any state since 0.39.0). SQL Server full: a database of that name in any state raises before the batch t...
stats: SQL Server: progress every n percent.
with_recovery: Bring it online after.
stopat: A point in time.
host: Oracle / PostgreSQL: the host.
backup_location: Oracle: where the pieces are.
encryption_password: Oracle: the backup's password.
mode: Oracle: the RMAN mode.
oracle_sid: Oracle: the SID.
bin_dir: PostgreSQL: the binaries.
data_dir: PostgreSQL: the data directory.
run_as: PostgreSQL: the OS user.
staging_dir: PostgreSQL: where pieces are staged.
wal_dir: PostgreSQL: the WAL archive.
dry_run: Plan only: change nothing.
timeout_seconds: How long to wait.
recovery_timeout_seconds: PostgreSQL into a container, with wal_dir: how long to wait for recovery to end (default 1800). A container that stops or restarts ends the wait at once.
Inputs: request. Returns: result
restore-fullBDestructiveInspect
dbabrain common.cli restore-full: One restore step on one engine.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
db_type (required): The engine.
target: The instance - an input_remote_target.
sqlcmd: SQL Server: run the step with sqlcmd where the server is instead of a driver from here - the run-sqlcmd request less its sql (instance, sqlcmd_path, username, password, timeouts, via, host). One file per call; the ans...
backup_path: The backup.
backup_paths: Several, in order.
database_name: One database.
move: SQL Server: file moves.
move_files: SQL Server full: {data, log} - where the two files go; the logical names are read on the server (RESTORE FILELISTONLY), and the database goes SINGLE_USER first.
relocate: SQL Server full onto another server: every file RESTORE FILELISTONLY names goes to the target's default data / log folder - or data_dir / log_dir - as _; {} for both defaults; the database goes SI...
replace: SQL Server: WITH REPLACE.
overwrite_existing: Whether the step may replace what the target holds; without true it stops first (0.26.0, G2.10; every engine and any state since 0.39.0). SQL Server full: a database of that name in any state raises before the batch t...
stats: SQL Server: progress every n percent.
with_recovery: Bring it online after.
stopat: A point in time.
host: Oracle / PostgreSQL: the host.
backup_location: Oracle: where the pieces are.
encryption_password: Oracle: the backup's password.
mode: Oracle: the RMAN mode.
oracle_sid: Oracle: the SID.
bin_dir: PostgreSQL: the binaries.
data_dir: PostgreSQL: the data directory.
run_as: PostgreSQL: the OS user.
staging_dir: PostgreSQL: where pieces are staged.
wal_dir: PostgreSQL: the WAL archive.
dry_run: Plan only: change nothing.
timeout_seconds: How long to wait.
recovery_timeout_seconds: PostgreSQL into a container, with wal_dir: how long to wait for recovery to end (default 1800). A container that stops or restarts ends the wait at once.
Inputs: request. Returns: result
restore-keyADestructiveInspect
dbabrain common.cli restore-key: A backup-encryption certificate to import.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: The instance.
sqlcmd: Run it where the SQL Server is: the run-sqlcmd request without its sql - for an instance this machine cannot reach over a driver. Instead of target.
certificate_name: The certificate.
cer_path: The public half.
pvk_path: The private key.
password: The key's password.
dry_run: Plan only: change nothing.
Inputs: request. Returns: result
restore-logBDestructiveInspect
dbabrain common.cli restore-log: One restore step on one engine.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
db_type (required): The engine.
target: The instance - an input_remote_target.
sqlcmd: SQL Server: run the step with sqlcmd where the server is instead of a driver from here - the run-sqlcmd request less its sql (instance, sqlcmd_path, username, password, timeouts, via, host). One file per call; the ans...
backup_path: The backup.
backup_paths: Several, in order.
database_name: One database.
move: SQL Server: file moves.
move_files: SQL Server full: {data, log} - where the two files go; the logical names are read on the server (RESTORE FILELISTONLY), and the database goes SINGLE_USER first.
relocate: SQL Server full onto another server: every file RESTORE FILELISTONLY names goes to the target's default data / log folder - or data_dir / log_dir - as _; {} for both defaults; the database goes SI...
replace: SQL Server: WITH REPLACE.
overwrite_existing: Whether the step may replace what the target holds; without true it stops first (0.26.0, G2.10; every engine and any state since 0.39.0). SQL Server full: a database of that name in any state raises before the batch t...
stats: SQL Server: progress every n percent.
with_recovery: Bring it online after.
stopat: A point in time.
host: Oracle / PostgreSQL: the host.
backup_location: Oracle: where the pieces are.
encryption_password: Oracle: the backup's password.
mode: Oracle: the RMAN mode.
oracle_sid: Oracle: the SID.
bin_dir: PostgreSQL: the binaries.
data_dir: PostgreSQL: the data directory.
run_as: PostgreSQL: the OS user.
staging_dir: PostgreSQL: where pieces are staged.
wal_dir: PostgreSQL: the WAL archive.
dry_run: Plan only: change nothing.
timeout_seconds: How long to wait.
recovery_timeout_seconds: PostgreSQL into a container, with wal_dir: how long to wait for recovery to end (default 1800). A container that stops or restarts ends the wait at once.
Inputs: request. Returns: result
restore-metadataBDestructiveInspect
dbabrain common.cli restore-metadata: Server-level metadata files to replay after a restore.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: The instance.
host: The host.
files: The files.
dry_run: Plan only: change nothing.
Inputs: request. Returns: result
rotate-passwordADestructiveInspect
dbabrain common.cli rotate-password: Which secret refs to rotate, and how.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
refs: The refs.
match: Or a pattern.
allow_name_host: Removed in 0.26.0 (owner decision G3.4): a request carrying true is refused. A password is changed only on the instance db_instances.json names for its ref - never on a host taken from the ref's name.
host_overrides: {ref: host}.
password_length: How long a new password is.
passwords: {ref: new value}, instead of generating.
plaintext_store: Where a plaintext copy goes.
dry_run: Plan only: change nothing.
timeout_seconds: How long to wait.
Inputs: request. Returns: result
run-cmdADestructiveInspect
dbabrain common.cli run-cmd: One shell command on a host.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: A label for the answer - the server_id. Nothing is looked up by it: common.cli reads no configuration (rules R09).
access: The host login, complete: an inline cmd_access - method (ssh|winrm), host, port, username, auth_type, key_file or password - with the machine's platform and runtime facts. The app that calls fills it from its own data...
platform: windows | linux, when access does not say.
profile: What the target is: os, os_major, runtime.
command: The command.
script: Or a script.
sudo: Through sudo.
timeout_seconds: How long to wait.
format: json | txt | raw.
confirm: The payload declares the operator agreed.
assume_yes: Unattended: take the typed yes as given.
authorized_by: Who approved it, for example {"channel": "telegram"}.
reason: Why, for the evidence.
Inputs: request. Returns: result
run-sqlBDestructiveInspect
dbabrain common.cli run-sql: A statement to run on one target, and how.
Runs with the rights of the login this node stores for the server (users.json: the instance's default_credential_name, or credential_name): what that login may do, this may do - DML and DDL included. The statement is checked to be one SELECT and the batch is rolled back, but the check reads text and does not bound what the login can do; a login with read rights only is what keeps it to reading. The SQL is the target engine's: SQL Server T-SQL https://learn.microsoft.com/sql/t-sql/language-reference, PostgreSQL https://www.postgresql.org/docs/current/sql-commands.html, Oracle https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/, MySQL https://dev.mysql.com/doc/refman/8.4/en/sql-statements.html.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: A label for the answer - the server_id. Nothing is looked up by it: common.cli reads no configuration (rules R09).
sql_text: The SQL.
sql_file: Or a file of it.
database_name: One database.
sql_access: How to reach the SQL engine, overriding the connection's own sql_access block (an 8i bridge on this machine).
secrets: {ref: value} for exactly the secret refs the connection's sql_access names (an 8i bridge's signing secret) - never the whole store. The app that calls fills it from its own data/ (dbabrain.lib.data_sources.request_fil...
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
profile: What the target is.
driver: Which driver.
oracle_client_mode: thin | thick.
params: Bound parameters.
define: Oracle substitution variables.
defines: The same, plural.
prelude: SQL text prepended to each batch.
named_params: Values by name, bound where an Oracle or PostgreSQL statement says :name.
autocommit: Commit each statement.
commit: Commit at the end.
capture: Which result sets to keep: first (the default) or all.
max_rows: At most this many rows.
max_result_sets: At most this many result sets.
connect_timeout_seconds: How long connecting may take.
timeout_seconds: How long to wait.
output_path: Write the rows to a file.
format: json (default) | txt.
Inputs: request. Returns: result
run-sqlcmdADestructiveInspect
dbabrain common.cli run-sqlcmd: One sqlcmd batch, and where to run it.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
sql (required): The batch.
instance (required): The -S sqlcmd connects to, as the host running it sees it.
sqlcmd_path: The sqlcmd to run (default sqlcmd).
container: The container the SQL Server runs in: its own sqlcmd runs the batch (docker exec), for a host with no sqlcmd of its own. ssh or local only.
username: A SQL login. With password; give neither for -E.
password: Its RESOLVED value. stdin only.
login_timeout_seconds: sqlcmd -l (default 30).
query_timeout_seconds: sqlcmd -t; 0 = none.
timeout_seconds: The whole run; 0 = none. Past it, the answer says timed_out.
via: local | ssh (a Linux host) | winrm (a Windows host, through a local Invoke-Command).
host: ssh / winrm: host, port, username, a RESOLVED password or key_file, open_timeout_seconds.
Inputs: request. Returns: result
run-sql-writeADestructiveInspect
dbabrain common.cli run-sql (writing): A statement to run on one target, and how.
The SQL is the target engine's: SQL Server T-SQL https://learn.microsoft.com/sql/t-sql/language-reference, PostgreSQL https://www.postgresql.org/docs/current/sql-commands.html, Oracle https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/, MySQL https://dev.mysql.com/doc/refman/8.4/en/sql-statements.html.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: A label for the answer - the server_id. Nothing is looked up by it: common.cli reads no configuration (rules R09).
sql_text: The SQL.
sql_file: Or a file of it.
database_name: One database.
sql_access: How to reach the SQL engine, overriding the connection's own sql_access block (an 8i bridge on this machine).
secrets: {ref: value} for exactly the secret refs the connection's sql_access names (an 8i bridge's signing secret) - never the whole store. The app that calls fills it from its own data/ (dbabrain.lib.data_sources.request_fil...
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
profile: What the target is.
driver: Which driver.
oracle_client_mode: thin | thick.
params: Bound parameters.
define: Oracle substitution variables.
defines: The same, plural.
prelude: SQL text prepended to each batch.
named_params: Values by name, bound where an Oracle or PostgreSQL statement says :name.
autocommit: Commit each statement.
commit: Commit at the end.
capture: Which result sets to keep: first (the default) or all.
max_rows: At most this many rows.
max_result_sets: At most this many result sets.
connect_timeout_seconds: How long connecting may take.
timeout_seconds: How long to wait.
output_path: Write the rows to a file.
format: json (default) | txt. Runs SQL that changes data; what it changed is kept only when the request says
commit(orautocommit) true - otherwise rolled back. The SQL is the target engine's: SQL Server T-SQL https://learn.microsoft.com/sql/t-sql/language-reference, PostgreSQL https://www.postgresql.org/docs/current/sql-commands.html, Oracle https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/, MySQL https://dev.mysql.com/doc/refman/8.4/en/sql-statements.html.
Inputs: request. Returns: result
seal-ssh-keyADestructiveInspect
dbabrain common.cli seal-ssh-key: One SSH private key to seal (or generate and seal) by its full path, and the ref for its passphrase.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
key_file (required): The key's FULL path - this command reads no configuration (rules R09).
passphrase_ref (required): The secret ref its random passphrase is stored under; one already holding another value is refused.
generate: Make a new ed25519 pair at key_file (and its .pub) instead of sealing one; never over a file.
comment: The .pub's comment when generating (default: the file's name).
also_plaintext: Also write the ref into secrets/secret_text.json, which deploy regenerates the store from (a master).
Inputs: request. Returns: result
self-statusARead-onlyInspect
dbabrain common.cli self-status: What this installation is - and, stated by the caller, when each app last ran.
Request fields (pass them as request):
format: json (default) | txt.
last_runs: {app code: {status, started_at}} - the newest run of each app command in the last day. The store is not opened here (rules R09): the caller reads it (/spbot_self_status does). Absent, the column says not stated.
store_error: Why the caller could not read the last runs; shown in their place.
Inputs: request. Returns: result
send-fileCDestructiveInspect
dbabrain common.cli send-file: A file fetched, sent, packed or relayed over the host's own access.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: A label for the answer - the server_id. Nothing is looked up by it: common.cli reads no configuration (rules R09).
server_id: The same label, when not in target.
access: The host login, complete: an inline cmd_access - method (ssh|winrm), host, port, username, auth_type, key_file or password - with the machine's platform and runtime facts. The app that calls fills it from its own data...
remote_path: fetch/send: the file on the host.
local_path: fetch/send: the file here.
overwrite: Replace an existing file.
make_dirs: Create missing folders.
files: pack-files: the files.
folder: pack-files: or a folder.
include: pack-files: patterns within it.
format: pack-files: tar | tar.gz | zip.
archive_path: pack-files: the archive.
checksum_files: pack-files: hash each member.
source: relay-file: {access, target, path} - each side states its own login.
destination: relay-file: {access, target, path}.
Inputs: request. Returns: result
shrink-logBDestructiveInspect
dbabrain common.cli shrink-log: A break-glass SQL Server action: shrink a log, kill a session, start or disable a job.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].server_id: The instance, when not in target.
sql_access: How to reach the SQL engine, overriding the instance's block.
database_name: One database.
size_mb: shrink-log: the size to shrink to.
spid: kill-spid: the session.
report_rollback: kill-spid: report the rollback's progress.
job_name: start-job / disable-job: the Agent job.
override: Accept a blocking gate.
timeout_seconds: How long to wait.
dry_run: Plan only: change nothing.
confirm: The payload declares the operator agreed.
assume_yes: Unattended: take the typed yes as given.
authorized_by: Who approved it, for example {"channel": "telegram"}.
reason: Why, for the evidence.
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
rules: What the operation costs to confirm: {level, confirmations, challenge, effects} - the node's own emergency_operations.json entry for it. Absent, the ladder the package ships prices it; malformed, it is refused rather ...
Inputs: request. Returns: result
smb-credentialBDestructiveInspect
dbabrain common.cli smb-credential: A Windows share and the login to it - what to list, fetch, delete, or store the login for.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
host: The machine sharing it: //host/share. Every command but smb-credential.
share: The share's name on that host.
username: The login. A domain before it (DOMAIN, then a backslash, then the user) is split off, as Windows writes it. The caller resolves it - common.cli reads no configuration.
password: The login's password. Never on a command line: smbclient reads it from a file this command writes 0600 and deletes.
domain: The login's domain, when not part of username.
backend: smbclient | unc. Default: unc on Windows (the share's own path, after cmdkey), smbclient elsewhere.
timeout_seconds: The whole call. Default 600 for a listing or a delete, 3600 for one file.
path: smb-list: the folder under the share to list; empty = the share's root.
recurse: smb-list: into subfolders (default true).
suffixes: smb-list: only file names ending in one of these, case-insensitive (e.g. [".bak", ".trn"]).
remote_path: smb-get: the file under the share, backslash- or slash-separated.
local_path: smb-get: the file to write on this node; its folder is created.
paths: smb-delete: the ONE file to delete, under the share - a list of exactly one path, never a pattern or a folder; two or more are refused.
force: smb-delete: must be true - a share has no host to hash a file on, so this is the forced delete of one stray file.
target: smb-credential: the host whose UNC paths the stored login opens.
Inputs: request. Returns: result
smb-deleteBDestructiveInspect
dbabrain common.cli smb-delete: A Windows share and the login to it - what to list, fetch, delete, or store the login for.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
host: The machine sharing it: //host/share. Every command but smb-credential.
share: The share's name on that host.
username: The login. A domain before it (DOMAIN, then a backslash, then the user) is split off, as Windows writes it. The caller resolves it - common.cli reads no configuration.
password: The login's password. Never on a command line: smbclient reads it from a file this command writes 0600 and deletes.
domain: The login's domain, when not part of username.
backend: smbclient | unc. Default: unc on Windows (the share's own path, after cmdkey), smbclient elsewhere.
timeout_seconds: The whole call. Default 600 for a listing or a delete, 3600 for one file.
path: smb-list: the folder under the share to list; empty = the share's root.
recurse: smb-list: into subfolders (default true).
suffixes: smb-list: only file names ending in one of these, case-insensitive (e.g. [".bak", ".trn"]).
remote_path: smb-get: the file under the share, backslash- or slash-separated.
local_path: smb-get: the file to write on this node; its folder is created.
paths: smb-delete: the ONE file to delete, under the share - a list of exactly one path, never a pattern or a folder; two or more are refused.
force: smb-delete: must be true - a share has no host to hash a file on, so this is the forced delete of one stray file.
target: smb-credential: the host whose UNC paths the stored login opens.
Inputs: request. Returns: result
smb-getADestructiveInspect
dbabrain common.cli smb-get: A Windows share and the login to it - what to list, fetch, delete, or store the login for.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
host: The machine sharing it: //host/share. Every command but smb-credential.
share: The share's name on that host.
username: The login. A domain before it (DOMAIN, then a backslash, then the user) is split off, as Windows writes it. The caller resolves it - common.cli reads no configuration.
password: The login's password. Never on a command line: smbclient reads it from a file this command writes 0600 and deletes.
domain: The login's domain, when not part of username.
backend: smbclient | unc. Default: unc on Windows (the share's own path, after cmdkey), smbclient elsewhere.
timeout_seconds: The whole call. Default 600 for a listing or a delete, 3600 for one file.
path: smb-list: the folder under the share to list; empty = the share's root.
recurse: smb-list: into subfolders (default true).
suffixes: smb-list: only file names ending in one of these, case-insensitive (e.g. [".bak", ".trn"]).
remote_path: smb-get: the file under the share, backslash- or slash-separated.
local_path: smb-get: the file to write on this node; its folder is created.
paths: smb-delete: the ONE file to delete, under the share - a list of exactly one path, never a pattern or a folder; two or more are refused.
force: smb-delete: must be true - a share has no host to hash a file on, so this is the forced delete of one stray file.
target: smb-credential: the host whose UNC paths the stored login opens.
Inputs: request. Returns: result
smb-listARead-onlyInspect
dbabrain common.cli smb-list: A Windows share and the login to it - what to list, fetch, delete, or store the login for.
Request fields (pass them as request):
host: The machine sharing it: //host/share. Every command but smb-credential.
share: The share's name on that host.
username: The login. A domain before it (DOMAIN, then a backslash, then the user) is split off, as Windows writes it. The caller resolves it - common.cli reads no configuration.
password: The login's password. Never on a command line: smbclient reads it from a file this command writes 0600 and deletes.
domain: The login's domain, when not part of username.
backend: smbclient | unc. Default: unc on Windows (the share's own path, after cmdkey), smbclient elsewhere.
timeout_seconds: The whole call. Default 600 for a listing or a delete, 3600 for one file.
path: smb-list: the folder under the share to list; empty = the share's root.
recurse: smb-list: into subfolders (default true).
suffixes: smb-list: only file names ending in one of these, case-insensitive (e.g. [".bak", ".trn"]).
remote_path: smb-get: the file under the share, backslash- or slash-separated.
local_path: smb-get: the file to write on this node; its folder is created.
paths: smb-delete: the ONE file to delete, under the share - a list of exactly one path, never a pattern or a folder; two or more are refused.
force: smb-delete: must be true - a share has no host to hash a file on, so this is the forced delete of one stray file.
target: smb-credential: the host whose UNC paths the stored login opens.
Inputs: request. Returns: result
sql-command-addBDestructiveInspect
dbabrain common.cli sql-command-add: A SQL task's WHAT: its name and its script.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
display_name (required): What a person reads.
db_type (required): sqlserver | oracle | postgresql.
sql_id: The id; the next free one when absent.
sql_code: Its code.
script_type: single | array | folder.
script_path: The script.
script_paths: array: the scripts.
final_script_paths: Run once at the end.
sql_text: Or the SQL itself.
version_from: Oldest product version.
version_to: Newest product version.
parameters: Its parameters.
autocommit: Commit each statement.
progress_per_file: Report each file.
input_type: What input it takes.
input: That input's settings.
active: Switched on.
note: Why it exists.
replace: Overwrite this sql_id.
Inputs: request. Returns: result
sqlserver-apply-cuBDestructiveInspect
dbabrain common.cli sqlserver-apply-cu: A cumulative update checked, applied or verified on one instance.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].credential_name: Which login in users.json; default: the instance's own.
instance_name: The instance on the host.
kb: The update's KB.
installer: The installer's path.
installer_sha256: Its expected checksum.
skip_hash: Do not check it.
expected_build: The build it should end on.
registry_key: Where the instance's build is read.
setup_account: Who runs setup.
window: The maintenance window.
ignore_window: Run outside it.
dry_run: Plan only: change nothing.
confirm: The payload declares the operator agreed.
assume_yes: Unattended: take the typed yes as given.
authorized_by: Who approved it, for example {"channel": "telegram"}.
reason: Why, for the evidence.
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
access: The host login, complete: an inline cmd_access - method (ssh|winrm), host, port, username, auth_type, key_file or password - with the machine's platform and runtime facts. The app that calls fills it from its own data...
policy: The maintenance policy that times this host operation: the node's maintenance_policy.json defaults with this server's own values over them. {} means the built-in defaults. The app that calls fills it from its own data...
rules: What the operation costs to confirm: {level, confirmations, challenge, effects} - the node's own emergency_operations.json entry for it. Absent, the ladder the package ships prices it; malformed, it is refused rather ...
Inputs: request. Returns: result
sqlserver-export-instanceBDestructiveInspect
dbabrain common.cli sqlserver-export-instance: An instance's server-level metadata exported, replayed or verified.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].credential_name: Which login in users.json; default: the instance's own.
output_dir: export: where the bundle goes.
bundle_dir: replay/verify: the bundle.
include: Which artifacts.
phase: pre-database | post-database | all.
overrides: Per-artifact choices.
secret_prefix: The ref prefix for secrets.
on_missing_secret: fail | skip.
on_unsupported: fail | skip.
dry_run: Plan only: change nothing.
confirm: The payload declares the operator agreed.
assume_yes: Unattended: take the typed yes as given.
authorized_by: Who approved it, for example {"channel": "telegram"}.
reason: Why, for the evidence.
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
policy: The content of sqlserver_instance_policy.json - which server settings are portable between instances. Required: an export or a replay with no policy is refused. The app that calls fills it from its own data/ (dbabrain...
secrets: {ref: value} for exactly the secret refs the bundle's manifest lists (secret_refs). A ref missing here is reported and the replay fails closed. The app that calls fills it from its own data/ (dbabrain.lib.data_sources...
rules: What the operation costs to confirm: {level, confirmations, challenge, effects} - the node's own emergency_operations.json entry for it. Absent, the ladder the package ships prices it; malformed, it is refused rather ...
Inputs: request. Returns: result
sqlserver-precheckCRead-onlyInspect
dbabrain common.cli sqlserver-precheck: A cumulative update checked, applied or verified on one instance.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].credential_name: Which login in users.json; default: the instance's own.
instance_name: The instance on the host.
kb: The update's KB.
installer: The installer's path.
installer_sha256: Its expected checksum.
skip_hash: Do not check it.
expected_build: The build it should end on.
registry_key: Where the instance's build is read.
setup_account: Who runs setup.
window: The maintenance window.
ignore_window: Run outside it.
dry_run: Plan only: change nothing.
confirm: The payload declares the operator agreed.
assume_yes: Unattended: take the typed yes as given.
authorized_by: Who approved it, for example {"channel": "telegram"}.
reason: Why, for the evidence.
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
access: The host login, complete: an inline cmd_access - method (ssh|winrm), host, port, username, auth_type, key_file or password - with the machine's platform and runtime facts. The app that calls fills it from its own data...
policy: The maintenance policy that times this host operation: the node's maintenance_policy.json defaults with this server's own values over them. {} means the built-in defaults. The app that calls fills it from its own data...
rules: What the operation costs to confirm: {level, confirmations, challenge, effects} - the node's own emergency_operations.json entry for it. Absent, the ladder the package ships prices it; malformed, it is refused rather ...
Inputs: request. Returns: result
sqlserver-replay-instanceCDestructiveInspect
dbabrain common.cli sqlserver-replay-instance: An instance's server-level metadata exported, replayed or verified.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].credential_name: Which login in users.json; default: the instance's own.
output_dir: export: where the bundle goes.
bundle_dir: replay/verify: the bundle.
include: Which artifacts.
phase: pre-database | post-database | all.
overrides: Per-artifact choices.
secret_prefix: The ref prefix for secrets.
on_missing_secret: fail | skip.
on_unsupported: fail | skip.
dry_run: Plan only: change nothing.
confirm: The payload declares the operator agreed.
assume_yes: Unattended: take the typed yes as given.
authorized_by: Who approved it, for example {"channel": "telegram"}.
reason: Why, for the evidence.
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
policy: The content of sqlserver_instance_policy.json - which server settings are portable between instances. Required: an export or a replay with no policy is refused. The app that calls fills it from its own data/ (dbabrain...
secrets: {ref: value} for exactly the secret refs the bundle's manifest lists (secret_refs). A ref missing here is reported and the replay fails closed. The app that calls fills it from its own data/ (dbabrain.lib.data_sources...
rules: What the operation costs to confirm: {level, confirmations, challenge, effects} - the node's own emergency_operations.json entry for it. Absent, the ladder the package ships prices it; malformed, it is refused rather ...
Inputs: request. Returns: result
sqlserver-verify-buildCRead-onlyInspect
dbabrain common.cli sqlserver-verify-build: A cumulative update checked, applied or verified on one instance.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].credential_name: Which login in users.json; default: the instance's own.
instance_name: The instance on the host.
kb: The update's KB.
installer: The installer's path.
installer_sha256: Its expected checksum.
skip_hash: Do not check it.
expected_build: The build it should end on.
registry_key: Where the instance's build is read.
setup_account: Who runs setup.
window: The maintenance window.
ignore_window: Run outside it.
dry_run: Plan only: change nothing.
confirm: The payload declares the operator agreed.
assume_yes: Unattended: take the typed yes as given.
authorized_by: Who approved it, for example {"channel": "telegram"}.
reason: Why, for the evidence.
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
access: The host login, complete: an inline cmd_access - method (ssh|winrm), host, port, username, auth_type, key_file or password - with the machine's platform and runtime facts. The app that calls fills it from its own data...
policy: The maintenance policy that times this host operation: the node's maintenance_policy.json defaults with this server's own values over them. {} means the built-in defaults. The app that calls fills it from its own data...
rules: What the operation costs to confirm: {level, confirmations, challenge, effects} - the node's own emergency_operations.json entry for it. Absent, the ladder the package ships prices it; malformed, it is refused rather ...
Inputs: request. Returns: result
sqlserver-verify-instanceCRead-onlyInspect
dbabrain common.cli sqlserver-verify-instance: An instance's server-level metadata exported, replayed or verified.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].credential_name: Which login in users.json; default: the instance's own.
output_dir: export: where the bundle goes.
bundle_dir: replay/verify: the bundle.
include: Which artifacts.
phase: pre-database | post-database | all.
overrides: Per-artifact choices.
secret_prefix: The ref prefix for secrets.
on_missing_secret: fail | skip.
on_unsupported: fail | skip.
dry_run: Plan only: change nothing.
confirm: The payload declares the operator agreed.
assume_yes: Unattended: take the typed yes as given.
authorized_by: Who approved it, for example {"channel": "telegram"}.
reason: Why, for the evidence.
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
policy: The content of sqlserver_instance_policy.json - which server settings are portable between instances. Required: an export or a replay with no policy is refused. The app that calls fills it from its own data/ (dbabrain...
secrets: {ref: value} for exactly the secret refs the bundle's manifest lists (secret_refs). A ref missing here is reported and the replay fails closed. The app that calls fills it from its own data/ (dbabrain.lib.data_sources...
rules: What the operation costs to confirm: {level, confirmations, challenge, effects} - the node's own emergency_operations.json entry for it. Absent, the ladder the package ships prices it; malformed, it is refused rather ...
Inputs: request. Returns: result
sql-target-addCDestructiveInspect
dbabrain common.cli sql-target-add: A SQL task's WHERE and WHEN.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
sql_id (required): The task.
server_id (required): The machine.
target_no: The target number.
instance_name: The instance.
service_name: A label.
database_name: One database.
credential_name: Which login in users.json; default: the instance's own.
sql_access: How to reach the SQL engine, overriding the instance's block.
time_window: When it runs.
manual_only: Only when asked for.
notify: Who hears about it.
logging_on_run: The flat form: send a message when each run starts, to logging_chat. A boolean - the parser reads it as one; the whole block goes under notify. Described as an object until 0.27.0, so R49 refused the form the command'...
alert_on_error: The flat form: send a message when a run fails, to error_chat. A boolean - the parser reads it as one; the whole block goes under notify. Described as an object until 0.27.0, so R49 refused the form the command's own ...
logging_chat: Progress chat level.
logging_chat_id: Or a chat id.
error_chat: Failure chat level.
error_chat_id: Or a chat id.
output: What it does with its result set.
output_chat: Where the result goes.
output_chat_id: Or a chat id.
output_max_rows: Rows sent to a chat.
active: Switched on.
note: Why it exists.
replace: Overwrite this target.
Inputs: request. Returns: result
standardize-field-namesCDestructiveInspect
dbabrain common.cli standardize-field-names: Which folder to move to this version's shapes, and whether to write.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
data_dir: Another data/ folder to read.
dry_run: Plan only: change nothing.
file: standardize-field-names: one file.
steps: upgrade-config: some steps.
Inputs: request. Returns: result
start-jobCDestructiveInspect
dbabrain common.cli start-job: A break-glass SQL Server action: shrink a log, kill a session, start or disable a job.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].server_id: The instance, when not in target.
sql_access: How to reach the SQL engine, overriding the instance's block.
database_name: One database.
size_mb: shrink-log: the size to shrink to.
spid: kill-spid: the session.
report_rollback: kill-spid: report the rollback's progress.
job_name: start-job / disable-job: the Agent job.
override: Accept a blocking gate.
timeout_seconds: How long to wait.
dry_run: Plan only: change nothing.
confirm: The payload declares the operator agreed.
assume_yes: Unattended: take the typed yes as given.
authorized_by: Who approved it, for example {"channel": "telegram"}.
reason: Why, for the evidence.
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
rules: What the operation costs to confirm: {level, confirmations, challenge, effects} - the node's own emergency_operations.json entry for it. Absent, the ladder the package ships prices it; malformed, it is refused rather ...
Inputs: request. Returns: result
store_queryARead-onlyInspect
One read-only SELECT on dbabrain's runtime store (sql), always rolled back; max_rows up to the node's cap. Tables: store_schema.
Inputs: sql (required), max_rows. Returns: result
store_schemaARead-onlyInspect
dbabrain's runtime store: every table and its columns, or one table's columns with their types (table).
Inputs: table. Returns: result
table-infoBRead-onlyInspect
dbabrain common.cli table-info: One database object or the server's activity read: a table, a definition, what runs now, a plan.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].credential_name: Which login in users.json; default: the instance's own.
sql_access: How to reach the SQL engine - the inventory's (the 8i bridge).
database_name: The database to read in; SQL Server: else master.
object: table-info / object-source: the object,
name,schema.nameor[schema].[name].view: db-activity: requests (default) | blocking | waits | top_queries.
sql_text: query-plan: the one statement to compile - never run.
max_rows: db-activity: rows at most, 1 to 1000 (default 50).
timeout_seconds: How long to wait.
connection: The database login, complete: db_type, host, port, username, password. The app that calls fills it from its own data/ (dbabrain.lib.data_sources.request_fill); common.cli reads no configuration (rules R09).
Inputs: request. Returns: result
trace-sessionBRead-onlyInspect
dbabrain common.cli trace-session: Which sessions to trace on one instance.
server_id (or target) names the server; its connection or host login is completed from this node's inventory and encrypted secret store, so a request carries no password.
Request fields (pass them as request):
target: The machine or instance: a server_id, or
<db_type> <ip>[:port].session_id: One session.
blocking_only: Only blockers.
min_tran_seconds: Only transactions open this long.
key: The secret-store passphrase, when not in the environment.
key_base64: The same, base64.
connection: The database login, complete: db_type, host, port, username, password - and, where they apply, database, instance_name, service_name, sqlserver_driver, sqlserver_tls_verify and sql_access (the 8i bridge); server_id an...
Inputs: request. Returns: result
upgrade-configBDestructiveInspect
dbabrain common.cli upgrade-config: Which folder to move to this version's shapes, and whether to write.
Changes or removes something. A command on the emergency-operations list takes confirm: "yes" and a reason in its request, as on the command line.
Request fields (pass them as request):
data_dir: Another data/ folder to read.
dry_run: Plan only: change nothing.
file: standardize-field-names: one file.
steps: upgrade-config: some steps.
Inputs: request. Returns: result
verify-restoreBRead-onlyInspect
dbabrain common.cli verify-restore: Which restored databases to ask about, and where.
Request fields (pass them as request):
db_type (required): The engine.
target: The instance.
host: Oracle / PostgreSQL: the host block the check runs on - {host, port, username, password|key_file, runtime}.
port: Its port.
username: Who asks.
database_names: The databases, by the names they were restored under.
database_name: One database.
oracle_sid: Oracle: the SID.
timeout_seconds: How long to wait.
consistency: Also run the engine's own consistency check (0.35.0, 1.251): DBCC CHECKDB on each SQL Server database, pg_amcheck --all on PostgreSQL, RMAN VALIDATE CHECK LOGICAL and v$database_block_corruption on Oracle. restore-by-...
consistency_timeout_seconds: With consistency: how long the check may run - kept on the host for PostgreSQL (timeout), the transport waits 60 s more; RMAN VALIDATE likewise. restore-by-id sets it from the entry's checkdb_timeout_seconds.
consistency_jobs: With consistency on PostgreSQL: pg_amcheck --jobs. restore-by-id sets it from the entry's checkdb_jobs.
Inputs: request. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 108 tools
Large clusters of tools are functionally indistinguishable: smb-list, smb-get, smb-delete and smb-credential carry the exact same description text, as do db-activity, object-source, query-plan and table-info, or key-renew and key-request. Likewise delete-file/delete-files/delete-verified-file/delete-verified-files and host-facts/host-service/host-restart share near-identical descriptions, so an agent cannot reliably pick between them.
Almost all names are kebab-case, which keeps the set readable, but the verb pattern is mixed: verb_noun (create-db-docker, list-jobs) sits beside noun-noun/noun-adjective forms (db-status, host-facts, metric-toggle, sql-command-add) and odd pairs like run-sql vs run-sql-write. Style is uniform in casing but not in the action prefix, and duplicated verbs across near-identical tools (list-backup-files/prune-backup-files) blur the convention further.
108 tools is far beyond what an agent can hold or select from reliably, and much of the count comes from splitting single CLI commands into one tool per verb or per variant (delete-empty-folder vs delete-empty-folders, delete-verified-file vs delete-verified-files). The server would be far stronger as a handful of parameterized tools per domain (SQL, files, host, backup/restore, inventory).
The surface covers the DBA lifecycle unusually thoroughly: inventory, status, backup/restore per engine, file transfer, SMB, host ops, SQL execution, metadata export/replay, and credential/secret management. Gaps are minor (little in the way of explicit index/maintenance-plan or permission management), so agents rarely hit a dead end.
Maintenance
Related MCP Connectors
Database backups and an AI agent safety net: restore points, health, audited changes as you.
Database evidence for AI agents: plans, workload, topology. SQL Server, Postgres, MySQL, Cassandra.
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with PostgreSQL databases through schema intelligence, query execution, and DBA tooling including index analysis and health monitoring. Features configurable access levels and audit logging for secure database operations.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with and manage multiple database types (PostgreSQL, MySQL, SQLite, SQL Server, MongoDB, Redis) through natural language, supporting query analysis, schema management, data analysis, backup/restore, and security analysis.8 npm2MIT
- FlicenseAqualityDmaintenanceExposes any Microsoft SQL Server database to AI agents with multi-database support, keyword lookup, free SELECT queries, and three transport modes (stdio/SSE/Streamable HTTP).4-
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to inspect schemas, analyze performance, check security, and troubleshoot SQL Server 2019+ databases through a safe, controlled interface.-