DBCLI Agent with Claude Code's Interaction Model

Least Interaction
Optimal Diagnosis

Oracle · MySQL · PostgreSQL — Slash Commands / Native SQL / Natural Language

Quick Install
$ curl -fsSL https://www.opendbcli.org/install.sh | bash
GitHub ★ →
opendb — ORCLCDB@prod-db-01
opendb>

Three Modes. One Agent.

Type however you think — OpenDB understands slash commands, native SQL, and natural language.

Slash Commands

60+ Built-in Skills

Complex operations as one-liners. Like Claude Code, but for databases.

opendb> /health
opendb> /dbtop
opendb> /llm 分析慢查询
Native SQL

Your Habits, Preserved

Run SQL directly. Works like sqlplus, mysql, psql — no learning curve.

opendb>
SELECT event, count, avg_wait
FROM v$system_event
ORDER BY total_waits DESC;
Natural Language

Ask in Plain Words

Describe problems naturally. AI translates intent into diagnosis and action.

opendb> 为什么今天早上 9 点数据库很慢?
⟳ 正在分析历史指标...

From Monitoring to Root Cause

A three-layer diagnosis system — from continuous sensing to AI-powered reasoning.

/health

Full-Spectrum Health Check

20+ checks across 7 dimensions — instance, storage, sessions, memory, logs, backup, and security. Get a complete picture in one command.

7
Dimensions
20+
Check Items
<5s
Full Scan
opendb — ORCLCDB@prod-db-01
opendb> /health
── Health Report ORCLCDB ─────────────
Instance OPEN · 正常运行
Storage 表空间 USERS 已用 94%
Sessions 活跃 142 / 最大 300
Memory SGA 16G · PGA 4.2G
Logs 归档日志量 2× 基线
Backup 最近备份 6h 前
Security 审计已启用
发现 3 个问题 · 运行 /rule 获取修复建议
opendb — ORCLCDB@prod-db-01
opendb> /dbtop
ORCLCDB● 警告刷新 1s · 11:01:47
SGA 16GPGA 4.2Gdb% 88%TPS 2,841QPS 9,120
Wait Events
db file sequential read▇▇▇▇▇▇ 42%
log file sync ▇▇▇▇ 28%
buffer busy waits ▇▇▇ 18%
CPU ▇▇ 12%
Active Sessions (3)
142APPSVCSELECT * FROM orders WHERE sta...db file seq
209BATCH UPDATE inventory SET qty=qty-1 ...log sync
317REPORTSELECT COUNT(*) FROM audit_log ...buffer busy
/dbtop

Real-Time Performance Dashboard

Like Linux top for databases. 1-second refresh showing SGA, PGA, TPS, QPS, wait events, and active sessions live.

1s
Refresh Rate
12+
Live Metrics
/rule

273-Rule Decision Engine

Millisecond-level deterministic diagnosis. Works offline — no LLM, no network, no API cost. Your safety net when AI is unavailable.

273
Rules
2.7s
Diagnosis
0
Dependencies
opendb — ORCLCDB@prod-db-01
opendb> /rule
Category: I/O Performance
根因 全表扫描 → I/O 冲高
严重度 ■■■
置信度 78%
证据链
· orders.status 字段无索引
· 全表扫描 12M 行 × 每秒 340 次
· 物理读 82K blk/s (阈值 20K)
· 等待事件 db file sequential read 42%
建议修复
CREATE INDEX CONCURRENTLY idx_orders_status ON orders(status);
opendb — ORCLCDB@prod-db-01
opendb> /llm 分析慢查询根因
R1 get_wait_events()
db file seq 42% · log sync 28%
R2 get_sql_stats(top=5)
FTS on orders: 12M rows/exec
R3 get_index_info(table='orders')
0 indexes on status col
✓ 分析完成 · 找到 3 个问题
#1全表扫描 — orders.status 无索引
#2归档日志量 2× 基线 — 大批量 DML
#3内存排序溢出 — sort_area_size 偏小
修复 SQL (2 条)
CREATE INDEX CONCURRENTLY idx_orders_status
ON orders(status);
ALTER SYSTEM SET sort_area_size=524288;
/llm

AI-Powered Deep Diagnosis

Multi-round LLM reasoning with function calling. Automatically collects evidence, correlates symptoms, and delivers executable fix SQL — not vague suggestions.

20
Max Rounds
60+
Skills
/sentinel

24/7 Anomaly Detection

Background probe monitoring 48 metrics with adaptive 3-sigma baselines. Detects anomalies before they become outages.

48
Metrics
Detection
24/7
Monitoring
opendb — ORCLCDB@prod-db-01
opendb> /sentinel start
✓ 哨兵已启动 · 监控 48 项指标
09:14:03 采样正常 · 所有指标在基线范围内
09:14:04 采样正常
⚡ 09:14:05 异常检测
指标 physical reads
当前 82,341 blk/s
基线 18,200 ± 3,100 blk/s
阈值 μ + 3σ = 27,500
持续 23 秒
⟳ 触发突发采集 · 收集诊断快照...
✓ 快照已保存 · 运行 /rule 开始诊断