Oracle Retail20 min readBy Priyanshu Pandey

RMS Batch Architecture: Understanding the Oracle Retail Batch Engine

A comprehensive guide to the Oracle RMS batch architecture. Learn how Pro*C batch programs work, the threading model, batch error handling patterns, RESTART_CONTROL table, parallel vs serial execution, the batch scheduling flow, and common batch troubleshooting techniques.

Phase 8 · Integration & Batches

Every night, hundreds of batch programs process millions of rows to keep the retail machine running. Understanding the batch engine is essential for every RMS developer.

20 min read📅May 25, 2026✍️Priyanshu Pandey📚Oracle RMS Series
THE NIGHTLY ENGINE

What is the RMS Batch?

During business hours, RMS processes individual transactions — a buyer creates a purchase order, a price analyst submits a price change, a store receives a shipment. But many critical operations cannot happen in real-time because they affect millions of rows or require complex calculations across the entire dataset.

These operations run as batch programs during the overnight batch window (typically 10 PM – 6 AM):

A typical large retailer has 200-400 batch programs running in sequence and parallel during the nightly window.

PRO*C

Pro*C: The Batch Language

Most RMS batch programs are written in Pro*C — a C programming language with embedded SQL. Oracle's Pro*C precompiler converts the embedded SQL into Oracle Call Interface (OCI) function calls, which are then compiled with a standard C compiler.

Why Pro*C?

  • Performance: C programs execute 2-5x faster than equivalent PL/SQL for heavy data processing
  • Memory Control: C gives direct control over memory allocation, buffer sizes, and data structures
  • OS Integration: C programs can interact with the file system (read/write flat files), environment variables, and OS utilities
  • Array Processing: Pro*C supports array fetch and array insert, processing thousands of rows per database round trip

Pro*C Compilation Flow

┌─────────────┐     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│  Source File │────▶│  Pro*C      │────▶│  C Compiler │────▶│  Executable │
│  (.pc)       │     │  Precompiler│     │  (gcc/cc)   │     │  (binary)   │
│              │     │  (proc)     │     │             │     │             │
│  C code +    │     │  Converts   │     │  Compiles   │     │  Ready to   │
│  embedded    │     │  SQL to     │     │  pure C     │     │  run        │
│  SQL         │     │  OCI calls  │     │  to binary  │     │             │
└─────────────┘     └─────────────┘     └─────────────┘     └─────────────┘

Pro*C vs. PL/SQL Batch

AspectPro*CPL/SQL
PerformanceFaster (compiled C)Slower (interpreted PL/SQL)
File I/ONative file system accessRequires UTL_FILE or directory objects
MemoryManual control (malloc/free)Automatic (PGA management)
DebuggingDifficult (C debugger, log files)Easier (DBMS_OUTPUT, exception handling)
MaintenanceComplex (recompile on DB changes)Simpler (no recompilation needed)
Cloud Compatible❌ Not in SaaS (no OS access)✅ Runs in Autonomous DB
THE FLOW

The Nightly Batch Flow

The nightly batch runs in a defined sequence, with some programs running serially and others in parallel:

10:00 PM ─── FOUNDATION BATCHES ──────────────────────────────
             │
             ├── vdate_job (advance business date)
             ├── currrate_load (load currency rates)
             └── fiscal_date_update (calendar updates)
             
11:00 PM ─── PRICING BATCHES ──────────────────────────────────
             │
             ├── price_change_execute (execute price changes)
             ├── clearance_execute (execute clearance markdowns)
             └── promotion_execute (activate promotions)
             
12:00 AM ─── SALES PROCESSING ──────────────────────────────────
             │
             ├── saposupld (post sales from ReSA to RMS)
             └── stock_ledger_post (update stock ledger)
             
 1:00 AM ─── INVENTORY BATCHES (PARALLEL) ──────────────────────
             │
             ├── Thread 1: wac_calc (recalculate WAC)
             ├── Thread 2: inv_adj_post (post adjustments)
             └── Thread 3: stock_count_post (post count results)
             
 2:00 AM ─── REPLENISHMENT (PARALLEL) ──────────────────────────
             │
             ├── Thread 1-8: replenish (calculate reorder qtys)
             └── auto_po_create (generate automatic POs)
             
 4:00 AM ─── DATA EXTRACTION ──────────────────────────────────
             │
             ├── fdl_item_extract (items for downstream)
             ├── fdl_itemloc_extract (item-loc for downstream)
             └── fdl_inv_extract (inventory for downstream)
             
 6:00 AM ─── BATCH COMPLETE ────────────────────────────────────
PARALLELISM

Threading & Parallel Execution

Many RMS batch programs support multi-threading — splitting the workload across multiple parallel processes:

How Threading Works

  1. The scheduler launches the batch program with a thread count parameter (e.g., replenish -threads 8)
  2. The program reads the RESTART_CONTROL table to determine its assigned data range
  3. Each thread processes a non-overlapping subset of the data (typically partitioned by department, location, or item range)
  4. Threads run independently — if Thread 3 fails, Threads 1, 2, 4-8 continue
  5. After all threads complete, a final "consolidation" step merges results

Thread Assignment Example

For the replenishment batch with 8 threads across 80 departments:

ThreadDepartments Assigned
Thread 1Depts 1000-1009
Thread 2Depts 1010-1019
Thread 3Depts 1020-1029
......
Thread 8Depts 1070-1079
RESTART

RESTART_CONTROL Table

The RESTART_CONTROL table is a critical infrastructure table that manages batch program threading and restart capability:

RESTART_CONTROL Table Structure
ColumnTypeDescription
PROGRAM_NAMEPK
Program ID

The name of the batch program (e.g., 'REPLENISH', 'PRICE_CHANGE_EXECUTE').

THREAD_NOPK
Thread Number

The thread number (0 for single-threaded programs, 1-N for multi-threaded).

NUM_THREADS
Total Threads

Total number of threads configured for this program.

STATUS
Execution Status

Current status: 'S' (Started), 'C' (Completed), 'F' (Failed), 'W' (Waiting).

START_DATETIME
Start Time

When this thread started execution.

END_DATETIME
End Time

When this thread completed (or failed).

RESTART_BOOKMARK
Restart Position

The last successfully processed record identifier. If the program fails and is restarted, it resumes from this bookmark instead of starting over.

Querying Batch Status
SQL
-- Check status of tonight's batch programs
SELECT 
    program_name,
    thread_no,
    status,
    TO_CHAR(start_datetime, 'HH24:MI:SS') AS started,
    TO_CHAR(end_datetime, 'HH24:MI:SS')   AS ended,
    ROUND((end_datetime - start_datetime) * 24 * 60, 1) 
                                           AS duration_min,
    restart_bookmark
FROM 
    restart_control
WHERE 
    start_datetime > TRUNC(SYSDATE)
ORDER BY 
    start_datetime;
ERROR HANDLING

Error Handling & Recovery

When a batch program encounters an error:

  1. The program writes the error to its log file (.log) and optionally to a bad file (.bad)
  2. The program updates RESTART_CONTROL with status = 'F' (Failed) and sets the restart_bookmark
  3. The scheduler detects the failure and holds all dependent downstream programs
  4. Operations team investigates the log file to determine the root cause
  5. After fixing the issue, operations restarts the program — it picks up from the restart_bookmark

Common Error Types

ErrorTypical CauseFix
ORA-00001: unique constraintDuplicate data in sourceIdentify and remove duplicate, then restart
ORA-01555: snapshot too oldLong-running query exhausted undoIncrease UNDO_RETENTION, reduce commit interval
ORA-04031: shared pool exhaustedToo many unique SQL statementsFix literal SQL, enable cursor_sharing
ORA-01652: unable to extend tempLarge sort/hash join exceeded temp spaceIncrease TEMP tablespace or optimize query
Segmentation faultPro*C memory corruptionCheck array sizes, buffer overflows in C code
SCHEDULING

Batch Scheduling (POM & External)

On-Premise: External Schedulers

In on-premise deployments, batch programs are orchestrated by external schedulers:

  • Control-M — the most common enterprise scheduler for Oracle Retail
  • Autosys — popular in financial services
  • cron — used in smaller deployments

Cloud: POM

In Oracle Retail Cloud, POM (Process Orchestration and Monitoring) is the mandatory scheduler. It provides a web-based interface for defining batch flows, dependencies, and monitoring execution.

TROUBLESHOOTING

Monitoring & Troubleshooting

Log File Analysis

Every batch program produces a log file. Key things to search for:

  • "ORA-" — Oracle database errors
  • "ERROR" — Application-level errors
  • "ROWS PROCESSED" — Data volume indicators
  • "ELAPSED TIME" — Performance benchmarks
  • "RESTART" — Restart bookmark information

Batch Duration Trending

Track batch duration over time. A batch program that normally runs in 30 minutes but suddenly takes 2 hours indicates:

  • Stale statistics on the tables it queries
  • Data volume growth (more rows to process)
  • Lock contention from a concurrent process
  • Infrastructure issue (slow I/O, reduced CPU)

Important Gotchas

  • !
    Never kill a running batch program with kill -9. This leaves RESTART_CONTROL in an inconsistent state and can leave database locks orphaned. Use kill -15 (graceful termination) and wait for the program to clean up.
  • !
    If a batch program fails, always check the .bad file (if one exists) before restarting. The bad file contains the specific rows that caused the failure — fixing the data issue before restart prevents the same failure from recurring.
  • !
    Pro*C batch programs must be recompiled whenever the database schema changes (e.g., after an Oracle patch that modifies table structures). Running old binaries against a modified schema causes unpredictable failures.
  • !
    The batch window is finite. If replenishment takes too long and overlaps with store opening, stores may not have today's replenishment orders. Optimize the longest-running batches first.

Key Takeaways

  • RMS batch programs are primarily written in Pro*C (C with embedded SQL) for maximum performance on million-row operations.
  • The nightly batch follows a defined sequence: foundation → pricing → sales → inventory → replenishment → data extraction.
  • Multi-threading splits workload across parallel processes, with each thread processing a non-overlapping data range.
  • RESTART_CONTROL tracks each program's status and restart bookmark, enabling recovery without reprocessing already-completed work.
  • POM replaces external schedulers (Control-M, Autosys) in cloud deployments for batch orchestration and monitoring.
  • Always check log and .bad files before restarting a failed batch program — fix the root cause first to prevent recurring failures.
RetailCoder
All systems operational
v1.0 Live

RC:OMS

Multi-channel order management with double-entry inventory ledger. Amazon, Flipkart, Shopify, WooCommerce — one source of truth.

Launch demo →
v1.0 Live

RC:Storefront

Self-hosted headless e-commerce. Your server, your data, zero transaction fees. Native RC:OMS inventory sync.

Visit Storefront →
Pipeline

RC:Pulse

AI-powered retail analytics and demand forecasting — built natively on top of your RC:OMS and Storefront data.

Request early access →
Built in India 🇮🇳  ·  Architected by Priyanshu PandeyTalk to an engineer →