AI is Coming to the DBA World. Here's What I'm Going to Test.

For most of my career, this job looked about the same. Keep the database up. Keep it fast. Make sure last night's backup really worked. And when something breaks at three in the morning, find out why before the business wakes up.

Then AI moved into town. I've been using it in my daily work for a while, and I wanted a place to test it properly, on real databases, with the mistakes left in. That's what DBA AI Lab is. The video below is the big picture. In this post I'll show you the actual lab test behind it: how I set it up, what I asked, what came back, and where it went wrong.

How I built the lab

Nothing fancy. It all runs on my laptop:

PieceWhat I used
DatabaseOracle AI Database 26ai Free (23.26.3), pluggable database FREEPDB1
Where it runsDocker Desktop on WSL2, image gvenzl/oracle-free:23.26.3, 3 GB memory, 2 CPUs
NetworkPort 1521 on 127.0.0.1 only, so nothing outside my laptop can reach it
The AI's way inSQLcl MCP server 26.3.1
The AIA chat in VS Code, agent mode

The database comes up from a small Docker Compose file. Passwords live in a local .env file, never in the compose file and never in the chat.

services:
  oracle:
    image: gvenzl/oracle-free:23.26.3
    container_name: oracle-free
    restart: unless-stopped
    ports:
      - "127.0.0.1:1521:1521"
    environment:
      ORACLE_PASSWORD: ${ORACLE_PASSWORD}
      APP_USER: lab
      APP_USER_PASSWORD: ${APP_USER_PASSWORD}
    volumes:
      - oracle-data:/opt/oracle/oradata
    mem_limit: 3g
    cpus: 2
volumes:
  oracle-data:
docker compose up -d
docker compose logs -f oracle      # wait for: DATABASE IS READY TO USE!

Then I saved the connection once in SQLcl, so the MCP server can use it by name. VS Code starts the MCP server on its own: it just runs SQLcl with the -mcp argument.

conn -save lab-freepdb1-system -savepwd system/<password>@localhost:1521/FREEPDB1
"sqlcl": {
  "command": "PATH/bin/sql",
  "args": ["-mcp"]
}

(PATH/bin/sql is the full path of your SQLcl install.) If you want the whole build step by step, my SQL Server AI lab setup is already up, and the Oracle one is next.

What I tested

Three things. I asked one plain diagnostic question, I asked it to explain and run a query I already had, and I tried two pieces of SQL that AI models love to write but that don't work on Oracle. I told the AI to stay read-only and let it pick the tools and write the SQL itself. One thing to know up front: I had just restarted the instance. That turned out to matter.

Question 1: "What is this database spending its time on?"

It went to V$SYSTEM_WAIT_CLASS, left out the idle waits and ran this:

select wait_class,
       total_waits,
       round(time_waited / 100) seconds_waited,
       round(100 * ratio_to_report(time_waited) over (), 1) pct
from   v$system_wait_class
where  wait_class <> 'Idle'
order  by time_waited desc;

Good start. TIME_WAITED is in hundredths of a second, and it divided by 100, so the seconds are right. Here's what my lab said:

Wait classWaitsSeconds% of waiting
User I/O26,0559686.5
Application2776.6
Concurrency76154.8
Configuration321.5
Other1,34500.4
Scheduler, Commit, System I/O, Network9400.3

Honestly, the next part is what won me over. It noticed the instance had only just started, said the buffer cache was cold, and told me these were startup numbers, not a normal day. Then it said what it would look at next: V$SYSTEM_EVENT, then the SQL with the most disk reads, and the same check again after an hour of normal load. That's exactly what I would have done. That's the difference between a query tool and an assistant.

The AI's answer: mostly waiting on disk reads, cold cache after a restart

Question 2: "Explain this like I'm new here"

I pasted a tablespace usage query I've had for years and asked it to explain it, then run it.

select df.tablespace_name,
       round(df.mb) size_mb,
       round(df.mb - nvl(fs.mb, 0)) used_mb,
       round(100 * (df.mb - nvl(fs.mb, 0)) / df.mb, 1) pct_used,
       round(df.max_mb) max_mb
from  (select tablespace_name, sum(bytes) / 1048576 mb,
              sum(greatest(bytes, decode(autoextensible, 'YES', maxbytes, 0))) / 1048576 max_mb
       from   dba_data_files group by tablespace_name) df
left  join (select tablespace_name, sum(bytes) / 1048576 mb
            from dba_free_space group by tablespace_name) fs
      on fs.tablespace_name = df.tablespace_name
order by pct_used desc;

It split it up nicely. One part adds up the data files (DBA_DATA_FILES), one part adds up the free space (DBA_FREE_SPACE), and the left join puts them side by side, so a tablespace with no free space left still shows up. Then it ran it:

TablespaceSize MBUsed MB% usedMax MBMy take
SYSTEM31831699.333,554,432Looks scary, but it can grow
SYSAUX91486494.633,554,432Same
USERS1,6411,54694.232,768Worth a look
XPT_TS2,3041,40460.94,096Hard 4 GB limit, keep an eye on it
UNDOTBS141123256.633,554,432Fine

That 33,554,432 MB in the max column is 32 TB, so the disk will run out long before those tablespaces do. The AI got that right too: SYSTEM and SYSAUX look full, but they can autoextend.

The tablespace query drawn as two lists and one join, with the real result

Test 3: two classic AI mistakes

These two are SQL I've seen AI write many times. I rebuilt them for the video and ran them on the same lab, so the errors are real.

select sql_id, executions, elapsed_seconds
from   v$sql_performance_history
where  sql_id = '9babjv8yq8ru3';
-- ORA-00942: table or view "SYSTEM"."V$SQL_PERFORMANCE_HISTORY" does not exist

select top 10 owner, table_name, num_rows
from   dba_tables
order  by num_rows desc;
-- ORA-00923: FROM keyword not found where expected

The first one has a perfect name. The view just doesn't exist. The second is fine on SQL Server, but on Oracle you'd write FETCH FIRST 10 ROWS ONLY.

Real ORA-00942 from my lab for a view that doesn't exist

Expected vs. what actually happened

TestWhat I expectedWhat happenedVerdict
Wait-time questionRight view, no idle waits, right unitsV$SYSTEM_WAIT_CLASS, Idle left out, divided by 100Got it right
Making sense of itMaybe a summary of the numbersSpotted the cold cache and said to check again in an hourBetter than I expected
Explaining my queryA correct walk through the two parts and the joinCorrect, even why it's a left joinGot it right
Running itReal numbers, autoextend read correctlyFive rows, SYSTEM and SYSAUX called out as autoextendGot it right
Made-up viewOracle stops itORA-00942Caught
Wrong platformOracle stops itORA-00923Caught

Where it goes wrong, and what I'd do better

Those two errors are the easy ones, because the database stops you. The ones that worry me run without an error. Flushing the shared pool on a busy production system. Killing the blocking session without asking what it's doing. Dropping the index nobody used this week, which turns out to be the one the month-end job needs. The AI doesn't know your business calendar. It doesn't know which batch job pays the salaries. You do.

And I'll be honest about my own test too. I measured right after a restart, so those wait numbers say nothing about a real workload. I asked each question once, and AI answers change from run to run, so this shows it can get it right, not how often. And my lab connects as SYSTEM because it's a throwaway lab. "Read-only" was just something I told the AI, not a privilege the database enforced. Don't copy that part.

So these are the rules I stick to:

RuleWhat it means for me
Read-only firstThe AI connects with a user that can look but not change anything.
No production data in public chatbotsNo passwords, no customer rows, no connection strings.
Read every statement before it runsIf I can't explain it, it doesn't run.
Lab firstA new tool or a new prompt goes to the lab before it goes anywhere near production.

One more thing: the video also shows the AI reading execution plans, AWR reports, SQL Server's Query Store and PostgreSQL logs. Those cards use example numbers, not my lab, and they're marked that way. And if you try the AWR part yourself, check your Diagnostics Pack license first.

Oracle, SQL Server and PostgreSQL side by side with their diagnostic sources

What I'll try next

First, the same wait question after an hour of real load, to see if the picture changes. Then the same tests with a proper least-privilege monitoring user instead of SYSTEM. I also want to ask the same questions a few times and count how often the answer stays right. After that it's SQL Server and PostgreSQL with real data, plus SQLcl MCP in VS Code, AWR analysis, SQL tuning and finding unused indexes.

The database world is changing fast. I'd rather test it than guess. See you in the lab.

Comments