Oracle Database
Oracle Database explained: how this enterprise relational database stores data, runs SQL and PL/SQL, and feeds tabular data to analytics and machine learning.
Overview
Oracle Database is a commercial relational database management system (RDBMS) used in many large enterprises. It stores data in tables, answers questions written in SQL, and keeps that data safe and consistent even when thousands of users change it at the same time. In many organizations it is the system of record: the place where the official version of customers, accounts, orders and ledgers lives.
For anyone working with tabular data, Oracle Database matters for two reasons. First, a great deal of valuable tabular data sits inside it. Second, it has strong features for moving that data out, such as the redo log, flashback queries and partitioning. Models that learn from raw tables, including TabPFN style tabular foundation models, usually receive their input from a source like this after it has been extracted, cleaned and sampled.
What it is
Oracle Database is a server program that manages a collection of data files and answers requests from client programs. A client connects, sends a SQL statement, and receives rows back. The server takes care of storage layout, caching, locking, recovery and security.
The product is available in several forms. It can run on a physical server, in a virtual machine, in a container, or as a managed cloud service. The core engine is the same idea in each case: a relational engine with a very large feature set.
The main building blocks
- Instance: the set of memory structures and background processes that run on a server.
- Database: the set of files on disk (data files, control files, redo log files).
- Schema: a named collection of objects owned by one user, such as tables, views and indexes.
- Tablespace: a logical storage unit that maps to one or more data files.
- Table: rows and columns, the main unit of data.
- Index: a structure that speeds up lookups on one or more columns.
- View: a stored query that looks like a table.
- Sequence: a counter used to generate unique numbers.
- PL/SQL package: stored program code that runs inside the database.
Why people call it a system of record
A system of record is the authoritative source for a type of data. If the billing database says an invoice is paid, then it is paid. Oracle Database earned this role by offering strict transactional guarantees, mature backup and recovery tools, and long support cycles. Many legacy applications were built directly on top of it, so replacing it is slow and risky.
Where it came from
The relational model was proposed in a 1970 paper by Edgar Codd, which described data as relations (tables) manipulated by a declarative language. Several teams tried to build working systems from this idea. Oracle was one of the first commercial products to do so, and it was released in the late 1970s.
Over the following decades the product grew in many directions.
| Period | General direction |
|---|---|
| 1980s | Portability across operating systems, early SQL support, row-level locking |
| 1990s | Parallel query, partitioning, stored procedures, client/server growth |
| 2000s | Clustering, grid computing, data warehousing features, XML support |
| 2010s | Multitenant architecture, in-memory column store, JSON support, cloud services |
| 2020s | Converged database features, vector data types, wider cloud and automation support |
Exact version numbers and release dates are best checked in the official documentation. What matters here is the pattern: the product kept adding features without breaking old applications. That backward compatibility is one reason it is still found in so many places.
How it works
This section walks through the life of a single change to a row. The everyday analogy is a bank branch with a ledger, a vault and a security log.
Step 1: A client sends a statement
A client program opens a session and sends a SQL statement, for example an UPDATE. The server parses the text, checks that the objects exist and that the user has permission, and then builds an execution plan.
Analogy: a customer walks to the counter and fills in a form. A clerk checks the form is valid and that the customer is allowed to ask for this.
Step 2: The optimizer picks a plan
The cost-based optimizer looks at table statistics, such as row counts and value distributions, and chooses a plan. It might use an index or scan the whole table. It might join tables with a hash join or a nested loop.
Analogy: a delivery driver chooses between the highway and side streets after checking traffic. A bad guess about traffic gives a slow trip.
Step 3: Data is read through the buffer cache
Data lives in blocks on disk. When a block is needed, it is read into the buffer cache in memory. Later requests for the same block are served from memory, which is far faster than disk.
Analogy: books on a desk are quick to reach. Books in the basement archive take longer.
Step 4: Changes are recorded in the redo log first
Before a changed block is written back to the data files, the change is written to the redo log. The redo log is a sequential record of every change. If the server crashes, the database replays the redo log to recover.
This idea is called write-ahead logging. It is the foundation of durability and also the foundation of change data capture, because the log is a complete ordered list of changes.
Analogy: a security camera recording every action in the branch. If something goes wrong, you can replay the tape.
Step 5: Undo data supports consistent reads
When a row changes, the old value is saved in undo data. Other sessions that started reading before the change can still see the old value. This gives each query a consistent snapshot of the data as of one moment, without blocking writers.
This design is called multiversion concurrency control (MVCC). Readers do not block writers and writers do not block readers.
Analogy: a photocopy of the ledger taken at 9:00 stays valid for the person reading it, while the clerk keeps writing in the original.
Step 6: Commit makes the change durable
When the client commits, the database makes sure the redo for that transaction is safely on disk. Only then does it report success. The data blocks may be written later in the background.
Step 7: Background processes do housekeeping
Several background processes run all the time. One writes dirty blocks to disk. One writes the redo buffer. One archives old redo logs for backup and replication. Others collect statistics and clean up after failed sessions.
Step 8: High availability and scaling
Oracle Database offers several ways to keep running when hardware fails or load grows.
- Real Application Clusters (RAC): several servers open the same database at once.
- Data Guard: a standby copy is kept in sync by shipping redo.
- Partitioning: a large table is split into pieces by range, list or hash.
- Parallel execution: one query is run by many workers.
- Multitenant: one container database hosts many pluggable databases.
Key concepts and terms
| Term | Meaning |
|---|---|
| SQL | The standard language for querying and changing relational data |
| PL/SQL | A procedural language that runs inside the database |
| Redo log | Ordered record of all changes, used for recovery and replication |
| Undo | Old versions of changed data, used for rollback and consistent reads |
| SCN | System change number, a logical clock that orders changes |
| Tablespace | Logical storage container mapped to files |
| Schema | Collection of objects owned by a user |
| Index (B-tree) | Sorted structure for fast lookups |
| Bitmap index | Compact index suited to low-cardinality columns in analytics |
| Partition | A slice of a table, managed and pruned separately |
| Optimizer | Component that chooses the execution plan |
| Materialized view | A stored query result that can be refreshed |
| Flashback query | A query that shows data as of an earlier time |
| Pluggable database | A database that can be unplugged and moved between containers |
| Data dictionary | Metadata tables that describe all objects |
| Bind variable | A placeholder in SQL that avoids reparsing and prevents injection |
Data types that matter for tabular work
Oracle has its own naming for column types, and it affects how data looks after extraction.
NUMBERis a flexible decimal type. It can hold integers or fractions with set precision.VARCHAR2holds variable-length text.DATEholds a date and a time down to the second. This surprises people who expect a date only.TIMESTAMPholds fractional seconds, with optional time zone variants.CLOBandBLOBhold large text and binary content.JSONsupport allows document-style columns inside a relational table.
One well-known quirk: Oracle treats an empty string as NULL in VARCHAR2 columns. This is different from many other databases and can cause missing-value confusion when data is moved elsewhere.
A worked example
This example shows a small order table, a query for analysis, and a safe extraction for modeling. All names are placeholders.
Creating and loading the table
CREATE TABLE orders (
order_id NUMBER(12) PRIMARY KEY,
customer_id NUMBER(10) NOT NULL,
order_date DATE NOT NULL,
channel VARCHAR2(20),
amount NUMBER(12,2),
returned NUMBER(1) DEFAULT 0
);
INSERT INTO orders VALUES (1001, 55, DATE '2025-03-01', 'web', 120.50, 0);
INSERT INTO orders VALUES (1002, 56, DATE '2025-03-02', 'store', 35.00, 0);
INSERT INTO orders VALUES (1003, 55, DATE '2025-03-05', NULL, 89.90, 1);
COMMIT;
Asking an analytical question
SELECT channel,
COUNT(*) AS orders,
ROUND(AVG(amount), 2) AS avg_amount,
ROUND(100 * AVG(returned), 1) AS return_rate_pct
FROM orders
WHERE order_date >= DATE '2025-03-01'
GROUP BY channel
ORDER BY orders DESC;
Notice that the row with a missing channel forms its own group with a NULL label. A model that learns from this table will see that missing value too, so it is worth deciding what it means.
Using a window function
SELECT order_id, customer_id, amount,
SUM(amount) OVER (PARTITION BY customer_id
ORDER BY order_date
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
AS running_total
FROM orders;
Window functions give each row some context from other rows without collapsing them. They are a common way to build features such as running totals or previous values.
Reading data as of an earlier time
SELECT * FROM orders
AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '1' HOUR);
This flashback query returns the table as it looked an hour ago, as long as the undo data is still available. It is useful to rebuild a training snapshot without changing anything.
Extracting a sample for modeling in Python
import oracledb
import pandas as pd
conn = oracledb.connect(
user="analyst",
password="placeholder-secret",
dsn="db.example.internal:1521/service_placeholder",
)
query = """
SELECT order_id, customer_id, channel, amount, returned
FROM orders SAMPLE (10)
WHERE order_date >= DATE '2025-01-01'
"""
df = pd.read_sql(query, conn)
print(df.shape)
print(df.dtypes)
print(df.isna().mean())
The SAMPLE (10) clause asks for roughly ten percent of rows. The last line prints the share of missing values per column, a quick quality check before any model sees the data.
Numeric walk-through of redo and recovery
Suppose a transaction changes a balance from 100 to 70 and then the server loses power before the data block is written.
- The redo record for "balance 100 to 70" was written at commit.
- On restart, the database reads the redo log from the last checkpoint.
- It sees the committed change and reapplies it to the data block.
- Any uncommitted changes found are rolled back using undo.
- The balance reads 70, as the client was told.
No data is lost because the log was written before success was reported.
Reading an execution plan
Before a heavy extraction, ask the database how it intends to run the query.
EXPLAIN PLAN FOR
SELECT customer_id, SUM(amount)
FROM orders
WHERE order_date >= DATE '2025-01-01'
GROUP BY customer_id;
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
The output lists steps such as a full table scan, an index range scan, a hash group by and the estimated number of rows at each step. Three things are worth checking.
- Is a full scan used where an index or a partition filter was expected?
- Do the estimated rows look wildly different from reality?
- Is a very large sort or hash step planned?
If the estimates look wrong, gather fresh statistics and look again.
Building features with SQL
A flat training table is often built from several sources. This query joins orders to a customer table and adds a lag feature.
SELECT o.order_id,
o.amount,
c.segment_code,
LAG(o.amount) OVER (PARTITION BY o.customer_id
ORDER BY o.order_date) AS prev_amount,
o.order_date - LAG(o.order_date) OVER (PARTITION BY o.customer_id
ORDER BY o.order_date) AS days_since_prev,
o.returned AS label
FROM orders o
JOIN customers c ON c.customer_id = o.customer_id;
Points to notice:
- The first order of each customer has no previous row, so the lag values are NULL. That is real missingness and should be kept as such.
days_since_previs a number of days, because subtracting two dates in Oracle gives a number.- The label is selected last and should never be used to build any feature.
Checking an extract after loading
checks = {
"rows": len(df),
"duplicate_keys": df["order_id"].duplicated().sum(),
"null_rate_channel": df["channel"].isna().mean(),
"amount_min": df["amount"].min(),
"amount_max": df["amount"].max(),
}
for name, value in checks.items():
print(name, value)
Run the same checks on the source with SQL and compare. Differences point to truncation, type conversion or filtering problems.
Strengths and limitations
Strengths
- Strong consistency: full ACID transactions with proven recovery.
- Mature tooling: backup, recovery, monitoring and tuning tools built up over decades.
- Rich SQL: analytic functions, recursive queries, pivoting, pattern matching and more.
- In-database programming: PL/SQL keeps logic close to the data.
- Scalability options: clustering, partitioning and parallel execution.
- Security features: fine-grained access control, auditing and encryption options.
- Backward compatibility: old applications keep working across upgrades.
- Wide ecosystem: drivers for common languages and connectors for many integration tools.
Limitations
- Licensing complexity: terms can be complicated and are best reviewed with the vendor.
- Operational weight: tuning and administration need real expertise.
- Vendor lock-in: heavy use of PL/SQL and proprietary features makes migration costly.
- Not built for flexible analytics at huge scale: separating storage from compute and elastic scaling are easier in cloud warehouses such as Snowflake.
- Quirks: empty strings as NULL,
DATEwith a time part, and naming rules differ from other systems. - Extraction cost: heavy analytical queries on the production system can slow down business transactions.
How it compares with alternatives
| Feature | Oracle Database | PostgreSQL | SQL Server | Snowflake |
|---|---|---|---|---|
| Main role | Enterprise OLTP and mixed workloads | General-purpose open-source RDBMS | Enterprise RDBMS, strong in its home ecosystem | Cloud data warehouse for analytics |
| Licensing | Commercial | Open source | Commercial | Managed service |
| Procedural language | PL/SQL | PL/pgSQL and others | T-SQL | SQL scripting and others |
| Elastic compute | Limited, depends on deployment | Limited | Limited | Core design feature |
| Log-based CDC | Redo log | Write-ahead log | Transaction log | Consumer of CDC, not a source |
| Typical fit | Systems of record | Apps, web services, analytics | Line-of-business apps | Analytics and data sharing |
A fair summary: choose Oracle Database when you already depend on it or need its specific features. Choose an analytics platform when the workload is mostly large scans, aggregations and machine learning. Many organizations use both, with the first as the source and the second as the destination.
Role in tabular foundation models
A tabular foundation model learns from tables. It sees rows, columns, mixed types, missing values and often no helpful column names. The source of those tables in an enterprise is very often a relational database like Oracle Database. The role here is therefore as a source, a governor and a feeder of tabular data. No specific integration with any model is claimed here. What follows is how the general pieces fit.
Row and column structure
A relational table is the natural shape for tabular models. Each row is an entity or event, each column is an attribute. Primary and foreign keys describe how tables link. A model that takes a single flat table needs the relational structure turned into one: joins, aggregates and window functions in SQL do that work.
Mixed types
Oracle columns include numbers, dates, text and codes. Models need these encoded in a consistent way. Some practical points:
NUMBERcolumns with scale zero are often categorical codes in disguise. Check before treating them as quantities.DATEcolumns should be turned into parts or differences, such as days since the previous order.- Text columns with low variety behave like categories.
- Large objects are usually left out of tabular modeling.
Missing values
Missing values appear as NULL. Because an empty string becomes NULL, a model may see a missing value where the application meant "blank". Also, legacy systems often use sentinel values such as 0, -1 or 9999 for unknown. A foundation model that handles missing values natively still benefits when sentinels are converted to real NULLs. See imputation networks for how missing cells can be filled in.
No column names
Foundation models pre-trained on many tables often cannot rely on meaningful column names, because real names like C_ATTR_07 carry no meaning. Enterprise schemas are full of such names. A model that works from the values and their patterns, not the labels, handles these tables better. It also means that the data dictionary, comments on columns and documentation in the database are valuable context for humans, even if the model does not use them.
Pre-training on synthetic or real tables
Pre-training for tabular foundation models often uses large numbers of generated tables, as in TabPFN, see also synthetic data generation. Real enterprise tables from a database are sensitive and rarely shared. Instead, teams can use a database as a place to test a pre-trained model on their own data, with no training data leaving the building.
In-context learning
In-context learning means a model gets a labeled table as part of its input and predicts for new rows without weight updates. With Oracle Database as the source, the workflow is: select a representative sample of labeled rows, pass it as context, and score new rows. Row count limits mean sampling and stratification are important. The SAMPLE clause and partition pruning help produce these samples cheaply.
Continual learning
Business data changes. To keep a model fresh, you need to know what changed. The redo log, flashback queries and timestamp columns let you take consistent snapshots at different times. These snapshots support checking drift and refreshing context rows. For the log-based approach, see change data capture and data synchronization.
Imputation
A database can hold both the observed values and the imputed ones, but they must be distinguished. A good pattern is to store imputed values in a separate column or table with a flag, so the original is never overwritten. Constraints and transactions help keep this consistent.
Anomaly detection
Systems of record are where fraud, errors and unusual events leave traces. Scoring rows for anomalies, as discussed in anomaly detection, can happen on extracted copies. The results can be written back to a table of flags for investigators. Because the database has audit features, you can also keep a history of who reviewed what.
Sector and semantic classification
Many enterprise databases contain free-text or coded descriptions, such as product names, merchant types or industry codes. Semantic classification assigns each to a sector or category. The database holds the raw field and, later, the predicted label and its confidence. Keeping the model's output in a separate table with a version tag makes audits and rollbacks simple.
Governance and lineage
Moving data out of a system of record raises questions about who may see it. Oracle Database supports access control and auditing, and these controls should be considered before extraction. For tracking where data goes, see data lineage and data catalog.
Practical guidance and best practices
Plan the extraction
- Do not hammer production. Use a replica, a standby, or off-peak windows.
- Prefer incremental loads. Pull only rows that changed since the last run, using a change column or log-based capture.
- Use consistent snapshots. Read as of one SCN or timestamp so related tables line up.
- Sample thoughtfully. Random sampling is quick; stratified sampling preserves rare classes.
- Keep keys. Hold on to primary keys so rows can be traced back.
Control the shape of the data
- Convert
DATEcolumns into a clear date or timestamp type on the other side. - Convert sentinel values to NULL where that is the true meaning.
- Convert
NUMBERcolumns with a documented precision into the right numeric type, not floats by default, when exactness matters. - Check character set differences so accented characters survive.
- Record the column comments from the data dictionary next to the extracted data.
Use the database for what it does well
- Push filters and joins into SQL so less data travels.
- Use window functions for lag features and running totals.
- Use partition pruning by filtering on the partition key.
- Use bind variables, both for speed and for safety.
- Use materialized views for repeated heavy aggregations.
Keep a clean path to analytics platforms
A common pattern is: Oracle Database as the source, a capture tool reading the redo log, a stream such as Apache Kafka, and a landing zone in a lakehouse such as Databricks or a warehouse such as Snowflake. Tools such as Kafka Connect are often used in the middle. Schemas change over time, so plan for schema evolution and use a schema registry where it fits.
Security basics
- Use a read-only account with only the grants needed.
- Never put passwords in code or notebooks. Use a secret store.
- Mask or tokenize personal data before it leaves; see data tokenization.
- Log extraction jobs so access can be audited.
- Encrypt connections.
Monitoring and quality
- Compare row counts and checksums between source and copy.
- Track null rates and value ranges over time to spot schema drift.
- Validate against agreed rules, as in data contract validation.
Common mistakes
- Treating empty strings as present. In Oracle they are NULL, which changes counts and averages.
- Ignoring the time part of DATE. Filters like
order_date = DATE '2025-03-01'miss rows with a time after midnight. - Running heavy extraction on the primary. This slows down business users and may get the job killed.
- Reading tables at different moments. Without a consistent snapshot, joined tables disagree.
- Using floats for money. Convert
NUMBER(12,2)to a decimal type, not binary floating point. - Forgetting character sets. Mismatched encodings corrupt names and addresses.
- Leaking the label. Including a column that is only known after the outcome, such as a refund date, makes a model look better than it is.
- Skipping statistics. Stale optimizer statistics lead to bad plans and slow extracts.
- Hard-coding credentials. Secrets belong in a vault.
- Copying personal data without a plan. Masking and retention should be decided first.
- Overwriting source values with imputed ones. Keep originals and add flagged columns.
- No row-level key in the extract. Predictions then cannot be joined back reliably.
Frequently asked questions
What is Oracle Database used for?
Oracle Database is used to store and manage structured data for business applications such as banking, billing, inventory, telecom and public services. It is common as a system of record, where accuracy and recovery matter most. It also supports reporting and some analytics, although many organizations copy data to a separate analytics platform for heavy workloads.
Is Oracle Database a relational database?
Yes. It stores data in tables with rows and columns, enforces keys and constraints, and is queried with SQL. It also adds object, JSON, spatial and other features on top of the relational core, which is why it is sometimes described as a converged database.
What is the difference between SQL and PL/SQL?
SQL is a declarative language that describes what data you want or what change to make. PL/SQL is a procedural language with variables, loops, conditions and error handling that runs inside the database and can call SQL. Together they let you keep business logic close to the data.
What is the redo log and why does it matter for data pipelines?
The redo log is the ordered record of every change made to the database, written before the data files are updated. It makes crash recovery possible. Because it holds all inserts, updates and deletes in order, it can also be read by capture tools to stream changes to other systems without querying the tables, which is the basis of log-based change data capture.
How do I get data out of Oracle Database for machine learning?
You can run SQL queries through a driver and load the result into a data frame, export files in bulk, or use a capture tool that streams changes to a lake or warehouse. For models, prefer a sampled and cleaned extract taken from a replica or at a consistent snapshot, with keys kept so predictions can be linked back to source rows.
Why do empty strings show up as NULL?
In Oracle's VARCHAR2 type, a zero-length string is stored as NULL. This is a long-standing behavior that differs from many other databases. When you move data elsewhere, you should decide whether such cells mean unknown or intentionally blank, and handle them in one consistent way.
Can Oracle Database handle analytics workloads?
It can. Features such as partitioning, parallel query, columnar in-memory options and analytic SQL functions support analytics. Still, when workloads are very large, bursty or shared across many teams, separate platforms with elastic compute are often easier to scale, and many teams use the database as the source feeding them.
What is a pluggable database?
A pluggable database is a self-contained database that lives inside a container database. It can be created, cloned, unplugged and moved with simple commands. This lets one server host many databases with shared resources while keeping data isolated, which simplifies consolidation and testing.
How is data kept consistent when many users write at once?
The database uses transactions, locks on changed rows, and multiversion concurrency control. Each query sees a consistent snapshot, writers lock only the rows they change, and committed work is made durable through the redo log. Conflicts are resolved by waiting or by raising an error that the application can retry.
How does Oracle Database relate to tabular foundation models?
It is mainly a source of the tables these models read. Good extraction, sampling, type handling and governance in the database determine how well a model can learn from the data in context. See the model research and architecture pages for how such models consume tables.
Glossary
- ACID: atomicity, consistency, isolation, durability; the guarantees of a reliable transaction.
- Bind variable: a parameter placeholder in a SQL statement.
- Buffer cache: memory area that holds recently used data blocks.
- CDC: change data capture, streaming changes from a source.
- Checkpoint: a point after which all earlier changes are on disk.
- Container database: a database that hosts pluggable databases.
- Data dictionary: built-in metadata that describes the database.
- Flashback: features that show or restore earlier states of data.
- Index: a structure that speeds up lookup.
- Instance: memory and processes serving a database.
- MVCC: multiversion concurrency control.
- OLTP: online transaction processing, many small reads and writes.
- Optimizer: component that picks the execution plan.
- Partition: a piece of a large table or index.
- PL/SQL: procedural extension to SQL.
- RAC: Real Application Clusters, several servers sharing one database.
- Redo log: sequential log of changes.
- Schema: a user's collection of objects.
- SCN: system change number, a logical timestamp.
- Tablespace: logical storage unit.
- Undo: stored old values used for rollback and consistent reads.
Summary
Oracle Database is a long-established enterprise relational database that provides reliable transactions, rich SQL, in-database programming and strong recovery. Its redo log, undo data and flashback features make it both safe and a good source for incremental data movement.
For tabular machine learning, its role is to hold the authoritative tables. Careful extraction, awareness of its quirks such as empty strings as NULL and DATE with a time part, sampling, masking and consistent snapshots turn those tables into good input for tabular foundation models. For related reading, see change data capture, data synchronization, model benchmarks and the other pages linked above.
Related
It belongs to Databases and sync in my stack, under Data engineering and lakehouse. Others in the same group: