Oracle 23ai Real-Time Dynamic SQL Firewall Policy Training Runbook

Production guide for enterprise DBAs and engineers.

⚡ BLUF (Bottom Line Up Front) Summary

⚠️ Advisory Scope & Terms

Root cause: Unsanitized SQL injection (SQLi) vulnerabilities in legacy ERP custom scripts and compromised database accounts bypass traditional perimeter firewalls. Resolution: Implement native Oracle Database 23ai SQL Firewall (`DBMS_SQL_FIREWALL`), capture workload training baselines in `LEARNING` mode, generate strict allow-list execution policies, and enforce real-time blocking with Unified Audit alerting.

Environment & Prerequisites

ComponentVersion / Specification
Database TargetOracle Database 23ai (Enterprise Edition & EE Free)
Security FrameworkNative DBMS_SQL_FIREWALL & Unified Auditing
Target SchemasPeopleSoft (SYSADM) / Banner (BANINST1) / Custom ERP Apps
Required PrivilegesSYSDBA / AUDIT_ADMIN / SYSFIREWALL_ADMIN

Oracle 23ai Real-Time Dynamic SQL Firewall Policy Training Runbook

1. Overview & Executive Summary

Oracle Database 23ai introduces a native, kernel-level SQL Firewall (DBMS_SQL_FIREWALL) designed to prevent SQL injection (SQLi) attacks and unauthorized database access. Unlike external web application firewalls (WAF) or network sniffers, SQL Firewall executes inside the database kernel, inspecting incoming SQL statements, bind variables, and execution contexts before query parsing occurs.

Deploying SQL Firewall in enterprise ERP environments requires a systematic Training & Enforce lifecycle. Blocking unapproved SQL immediately without prior baseline training will disrupt valid application workflows.

This runbook details how to enable SQL Firewall, capture workload baselines in LEARNING mode, review and approve SQL allow-list policies, enforce real-time block/allow rules, and integrate SQL Firewall alerts with Oracle Unified Auditing.

Process Flow

01
Enable Firewall
02
Training Phase
03
Policy Generation
04
Enforce Mode
05
Audit Integration

2. Diagnostic Checklist

Run these diagnostic queries as SYSDBA or SYSFIREWALL_ADMIN to verify SQL Firewall status and active training policies.

2.1 SQL Firewall Global Status

-- Check global status of DBMS_SQL_FIREWALL
SELECT status, learning_mode, log_level 
FROM v$sql_firewall_status;

Expected output: STATUS = 'ENABLED', indicating that the kernel-level SQL Firewall engine is active.

2.2 Active Capture & Training Profiles

-- List users currently in LEARNING or PROTECTING mode
SELECT username, status, top_level_only, job_name
FROM dba_sql_firewall_users;

Expected output: Shows targeted application schemas (e.g., SYSADM, BANINST1) and their current enforcement state.

2.3 Inspect Violations & Blocked Statements

-- Query SQL Firewall violation logs in Unified Audit
SELECT event_timestamp, dbusername, client_program_name, userhost, sql_text, firewall_action
FROM unified_audit_trail
WHERE audit_type = 'SQL FIREWALL'
ORDER BY event_timestamp DESC;

3. Step-by-Step Resolution Runbook

Step 0: Safety Checks

⚠️ CRITICAL: Always run new application schemas in LEARNING mode for at least 7–14 days (covering full business & payroll cycles) before switching to ENFORCE mode.

  1. Verify Unified Auditing is enabled:
SELECT value FROM v$option WHERE parameter = 'Unified Auditing';
  1. Grant SQL Firewall Administration Role:
GRANT SYSFIREWALL_ADMIN TO sec_admin;

Step 1: Enable SQL Firewall Globally

Enable the SQL Firewall engine in the PDB container.

-- Connect to target PDB as SYSDBA
sqlplus sys/Password123@pdb_erp as sysdba

-- Enable global SQL Firewall engine
BEGIN
  DBMS_SQL_FIREWALL.ENABLE;
END;
/

-- Verify status
SELECT status FROM v$sql_firewall_status;

Step 2: Start Training (Learning Mode) for Application Schemas

Begin capturing baseline SQL traffic for your target enterprise application user (SYSADM for PeopleSoft or BANINST1 for Banner).

BEGIN
  -- Create training profile for application user
  DBMS_SQL_FIREWALL.ADD_USER(
    username       => 'SYSADM',
    top_level_only => TRUE
  );

  -- Start learning mode to log all incoming SQL statements
  DBMS_SQL_FIREWALL.START_TRAINING(
    username => 'SYSADM'
  );
END;
/

Verify that training mode is active:

SELECT username, status FROM dba_sql_firewall_users WHERE username = 'SYSADM';

Expected output: STATUS = 'LEARNING'.


Step 3: Stop Training & Generate Allow-List Policy

After the training period (e.g., 7 days of production traffic including batch jobs), stop training and build the baseline policy allow-list.

BEGIN
  -- 1. Stop training capture
  DBMS_SQL_FIREWALL.STOP_TRAINING(
    username => 'SYSADM'
  );

  -- 2. Generate allow-list policy rules from captured training data
  DBMS_SQL_FIREWALL.GENERATE_ALLOW_LIST(
    username => 'SYSADM'
  );
END;
/

Inspect the generated SQL allow-list rules:

-- Review allowed SQL commands
SELECT username, sql_command, count_executed, first_executed_time
FROM dba_sql_firewall_allowed_sql
WHERE username = 'SYSADM'
ORDER BY count_executed DESC;

-- Review allowed client IP addresses and OS hosts
SELECT username, client_ip, ip_type, os_user
FROM dba_sql_firewall_allowed_ip
WHERE username = 'SYSADM';

Step 4: Enable Real-Time Enforcement & Violation Blocking

Switch SQL Firewall from LEARNING to ENFORCE mode to automatically block unapproved SQL queries or unauthorized connection origins.

BEGIN
  -- Enable enforcement with blocking and auditing
  DBMS_SQL_FIREWALL.ENABLE_ALLOW_LIST(
    username       => 'SYSADM',
    enforce        => DBMS_SQL_FIREWALL.ENFORCE_ALL, -- Enforce IP, OS user, and SQL text
    block          => TRUE                           -- Block non-compliant queries
  );
END;
/

Verify enforcement mode:

SELECT username, status, enforce, block
FROM dba_sql_firewall_users
WHERE username = 'SYSADM';

Expected output: STATUS = 'PROTECTING', ENFORCE = 'ENFORCE_ALL', BLOCK = 'TRUE'.


Step 5: Configure Unified Audit Alerting for Firewall Violations

Create a Unified Audit policy to record all SQL Firewall violations and trigger security alerts.

-- Create Unified Audit policy for SQL Firewall
CREATE AUDIT POLICY audit_sql_firewall_violations
  ACTIONS COMPONENT = SQL_FIREWALL ALL;

-- Enable the audit policy
AUDIT POLICY audit_sql_firewall_violations;

-- Query recent blocked SQL Firewall violations
SELECT event_timestamp, dbusername, client_program_name, userhost, sql_text
FROM unified_audit_trail
WHERE audit_type = 'SQL FIREWALL'
  AND firewall_action = 'BLOCKED'
ORDER BY event_timestamp DESC;

📚 Official Documentation & Technical References

Oracle Documentation

My Oracle Support

For official My Oracle Support SQL Firewall deployment guidelines, search the MOS Knowledge Base directly:

  • Oracle 23ai SQL Firewall Policy Generation & Troubleshooting
  • Unified Audit Trail Integration for DBMS_SQL_FIREWALL

Need Expert Security Help?

Implementing native 23ai SQL Firewall across complex enterprise ERP schemas (PeopleSoft, Banner, EBS) requires precise baseline training to avoid application disruption. DBPros.Net’s certified Oracle security engineers can help you:

  • Design & Conduct zero-downtime SQL Firewall training cycles across staging and production
  • Audit & Refine generated SQL allow-lists and IP/OS user rules
  • Configure & Integrate Unified Audit alerting with your enterprise SIEM (Splunk, Datadog, QRadar)
  • Harden Oracle 23ai databases with Vault, TDE, and SQL Firewall 24/7/365

Contact DBPros.Net Security Team | Explore Enterprise Security Services

⚠️INFORMATIONAL & TECHNICAL ADVISORY DISCLAIMER

The diagnostic methodologies, commands, and runbooks provided on DBPros.Net are published for informational and educational purposes only. They do not constitute customized professional consulting advice. Operating engineers and DBAs are solely responsible for securing pre-flight backups (RMAN, VM snapshots, LVM clones), validating changes in non-production staging environments, and adhering to organizational change-control policies. All content, scripts, and runbooks are provided "AS IS" without warranty of any kind, and DBPros.Net assumes no liability for system downtime, database corruption, data loss, or operational disruption. For complete advisory limitations and legal terms, view our full Terms of Service & Advisory Disclaimer.