Oracle Database interview questions and answers for developers and DBAs
Oracle Database interview questions test how well you know the engine behind the SQL: the difference between an instance and a database, memory areas and background processes, undo and redo, read consistency, how the cost-based optimizer picks a plan, indexing and partitioning, and how backup, recovery and standby databases work. Developers also get Oracle-specific SQL traps, such as an empty string being NULL and ROWNUM applied before ORDER BY.
By Evin JohnPublished 8 min read
Who gets Oracle Database questions
Oracle runs core systems at banks, insurers, telecoms, governments and large retailers, along with packaged applications such as ERP suites. Three kinds of candidates face these questions. Application developers are asked about SQL behavior, locking and reading plans. Database administrators go deep on architecture, backup and recovery, and performance diagnosis. Data engineers moving data out of Oracle are asked about change capture, partitions and how not to hurt a production system with extraction queries. Know which of the three the job is, and weight your preparation accordingly.
If the role writes stored procedures, packages and triggers, prepare the code side with PL/SQL interview questions. This page covers the database engine around that code.
Architecture fundamentals
| Question | What it tests | What a strong answer shows |
|---|---|---|
| What is the difference between an instance and a database? | Core model | The instance is memory plus background processes. The database is the set of files on disk: datafiles, control files and online redo logs. An instance mounts and opens a database; in RAC several instances open one database. |
| What is in the SGA, and how is the PGA different? | Memory | The SGA is shared: buffer cache, shared pool with the library cache and data dictionary cache, redo log buffer, and pools such as large and Java. The PGA is private to each server process, used for sorts, hash joins and session data. |
| Name the key background processes. | Processes | DBWn writes dirty buffers to datafiles, LGWR writes redo to the online logs, CKPT records checkpoints, SMON does instance recovery, PMON cleans up failed processes, and ARCn copies filled redo logs to archive. |
| What does the control file hold? | Files | The database name, the locations of datafiles and redo logs, checkpoint information and backup metadata. Losing every copy is serious, which is why it is multiplexed. |
| Tablespace, segment, extent, block? | Storage | A tablespace groups datafiles. Each table or index is a segment stored in extents, which are runs of contiguous blocks, the smallest unit of I/O. |
| User versus schema? | Security model | A schema is the set of objects owned by a user, so in Oracle the two names usually match. Access to another schema comes through grants, often with synonyms for convenience. |
| What are a CDB and a PDB? | Multitenant | A container database holds the shared metadata and one or more pluggable databases, each looking like a separate database to applications. PDBs can be cloned, unplugged and plugged in elsewhere. |
| What does a commit actually wait for? | Durability | LGWR writing the transaction's redo to the online redo log. Changed data blocks are written later by DBWn, which is why redo, not the datafiles, protects a committed change after a crash. |
Oracle SQL behavior that catches people
SELECT CASE WHEN '' IS NULL THEN 'empty string is NULL' ELSE 'not null' END AS result
FROM dual;-- Wrong: filters any ten rows, then sorts them
SELECT order_id, amount FROM orders WHERE ROWNUM <= 10 ORDER BY amount DESC;
-- Right, older style: sort in a subquery, then take ten
SELECT * FROM (
SELECT order_id, amount FROM orders ORDER BY amount DESC
) WHERE ROWNUM <= 10;
-- Right, 12c and later
SELECT order_id, amount
FROM orders
ORDER BY amount DESC
FETCH FIRST 10 ROWS ONLY;- What is DUAL? A one-row, one-column table used to select an expression when no table is involved, such as the current date or a sequence value.
- NVL, NVL2 and COALESCE? NVL returns a fallback for one NULL value and evaluates both arguments. NVL2 picks between two values based on whether the first is NULL. COALESCE takes any number of arguments, stops at the first non-NULL, and is standard SQL.
- DECODE versus CASE? DECODE is Oracle's older compact conditional, and it treats two NULLs as equal. CASE is standard, more readable and supports ranges and complex conditions.
- What does a DATE column store? A date and a time to the second. Comparing with a date literal and forgetting the time part is a classic bug; use a range or TRUNC carefully, since TRUNC on the column can block an index.
- Sequence or identity column? Both generate keys. Identity columns, available from 12c, attach the sequence to the column. Neither guarantees gapless numbers, because cached values are lost on restart and rolled-back inserts still use values.
- What happens to an open transaction when you run DDL? DDL issues an implicit commit before and after, so a CREATE or ALTER in the middle of a script commits earlier changes.
- VARCHAR2 versus CHAR? VARCHAR2 stores variable length. CHAR pads with spaces to the declared length, which causes surprising comparisons. VARCHAR2 is the usual choice.
- CONNECT BY or recursive WITH for hierarchies? CONNECT BY is Oracle's concise syntax with LEVEL and SYS_CONNECT_BY_PATH. Recursive subquery factoring is standard SQL and more portable. Know one well and recognize the other.
Intermediate: transactions, plans and indexes
| Question | What it tests | What a strong answer shows |
|---|---|---|
| Undo versus redo? | Recovery model | Redo records changes so they can be replayed after a crash or restored from backup. Undo stores the before image, used for rollback and for giving queries a consistent view of the past. |
| How does Oracle give a query a consistent result without read locks? | Read consistency | Each query sees data as of its start. If a block changed later, Oracle rebuilds the older version from undo. Readers do not block writers, and writers do not block readers. |
| What causes ORA-01555 snapshot too old? | Undo sizing | A long query needed undo that was already overwritten. Fixes: enough undo space and retention, shorter queries, and not committing inside a loop that is reading the same table. |
| What is the default isolation level? | Concurrency | Read committed at statement level. Serializable is available. There are no dirty reads in Oracle. |
| What does SELECT ... FOR UPDATE SKIP LOCKED do? | Row locking | Locks the rows it returns and skips rows other sessions already hold, which lets several workers pull from a queue table without waiting on each other. |
| Why use bind variables? | Parsing | A literal in every statement forces a hard parse and fills the shared pool with near-identical cursors. Binds allow soft parses and cursor reuse, and prevent SQL injection. |
| How do you see the plan Oracle really used? | Plans | EXPLAIN PLAN shows a predicted plan. DBMS_XPLAN.DISPLAY_CURSOR shows the one in the cursor cache, and with row source statistics it shows estimated versus actual rows per step. |
| When is a bitmap index a bad idea? | Index types | On tables with concurrent DML, because one bitmap entry covers many rows and updates lock large ranges. Bitmaps suit low-cardinality columns in read-mostly warehouses. |
| What is a function-based index? | Index types | An index on an expression such as UPPER(email), so a query using the same expression can use the index instead of a full scan. |
| Index-organized table: when? | Storage choice | When rows are almost always read by primary key or key range, storing the table inside its primary key B-tree saves a lookup and space. |
SELECT /*+ gather_plan_statistics */ c.name, SUM(o.amount) AS total
FROM customers c
JOIN orders o ON o.customer_id = c.customer_id
WHERE o.order_date >= DATE '2026-01-01'
GROUP BY c.name;
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL, NULL, 'ALLSTATS LAST'));When estimates and actuals differ by orders of magnitude, the optimizer worked from wrong numbers. Say what you would check next: stale or missing statistics, skewed data that needs a histogram, correlated columns that need extended statistics, or a bind value very different from the one the plan was built for.
Partitioning and large tables
CREATE TABLE events (
event_id NUMBER GENERATED ALWAYS AS IDENTITY,
created_at DATE NOT NULL,
payload VARCHAR2(4000)
)
PARTITION BY RANGE (created_at)
INTERVAL (NUMTOYMINTERVAL(1, 'MONTH'))
(PARTITION p_start VALUES LESS THAN (DATE '2026-01-01'));- Range, list, hash or composite partitioning? Range by date for time-series data and retention, list for discrete values such as region, hash to spread rows evenly when there is no natural range, and composite to combine two, for example range then hash.
- What is partition pruning? The optimizer skips partitions that cannot hold matching rows, so a query on one month reads one partition. Functions on the partition key can stop pruning.
- Local versus global indexes? A local index is partitioned like the table, so dropping a partition is quick and clean. A global index spans all partitions and must be maintained or rebuilt when partitions change, but can serve queries that do not filter on the partition key.
- How do you purge old data quickly? Drop or truncate old partitions instead of deleting millions of rows, which would generate huge undo and redo. Partitioning is a separately licensed option on Enterprise Edition, so confirm it is available.
- When would you use a materialized view? To store a costly join or aggregate and refresh it on a schedule or on commit. With materialized view logs it can refresh incrementally, and query rewrite can redirect matching queries to it.
Senior DBA and scenario questions
| Question | What it tests | What a strong answer shows |
|---|---|---|
| The database was slow from 2 to 3 pm. How do you investigate? | Diagnosis | Compare AWR reports for that window with a normal one, look at top wait events and top SQL, and use ASH to see which sessions and statements were waiting on what. Note that AWR and ASH need the Diagnostics Pack license. |
| What do these waits suggest: db file sequential read, log file sync, enq: TX row lock contention? | Wait events | Single-block reads, usually index access; sessions waiting for commits to be written to redo; and sessions blocked by another transaction holding the rows. |
| A query is fast for one customer and slow for another. Why? | Bind peeking | The plan was built for the first bind value. Skewed data makes that plan poor for others. Adaptive cursor sharing, histograms, or SQL plan baselines can help; explain the trade-off of each. |
| Someone deleted rows an hour ago. What are your options? | Flashback | Flashback query to read the rows as of a timestamp and reinsert them, flashback table if row movement is enabled, or point-in-time recovery if undo no longer covers it. |
| Why must a production database run in ARCHIVELOG mode? | Backup | Without archived redo you can only restore to the last cold backup. With it, RMAN can take online backups and recover to any point in time. |
| How do you design RMAN backups? | Recovery strategy | Level 0 incremental as a base, level 1 incrementals, archived log backups, a recovery catalog or control file records, and regular restore tests. A backup never restored is a guess. |
| Switchover versus failover in Data Guard? | Availability | Switchover is a planned role change with no data loss. Failover happens when the primary is lost; whether data is lost depends on the protection mode and transport settings. |
| What does RAC give you, and what does it not? | Clustering | Several instances on separate servers open one database, sharing blocks through cache fusion, which helps availability and some scaling. It does not protect against storage or site loss; Data Guard covers that. |
| How do you add an index to a busy table without blocking writes? | Online operations | CREATE INDEX with the ONLINE clause, during a quieter window, with enough temp space. For larger restructuring, DBMS_REDEFINITION copies the table online. |
SELECT account_id, balance
FROM accounts AS OF TIMESTAMP SYSTIMESTAMP - INTERVAL '15' MINUTE
WHERE account_id = 42;Fictional example
- Interviewer
- Tell me about an Oracle performance issue you diagnosed.
- Candidate
- Month-end billing started running past its window. The AWR comparison showed one statement doing far more reads than the month before. DISPLAY_CURSOR with actual rows showed the optimizer expected a few hundred rows from the invoices table and got millions, so it chose nested loops. Statistics had been gathered right after a purge, before the new month's data loaded, and the status column was heavily skewed. I gathered stats after the load with a histogram on status, checked the new plan used a hash join, and moved the stats job to run after the monthly load. The job finished well inside its window, and I added a check that compares estimated and actual rows for that statement each month.
How to prepare for an Oracle Database interview
- Draw the architecture from memoryInstance, SGA parts, PGA, background processes and the three kinds of files. Then explain what happens on a commit and on a crash.
- Collect Oracle SQL quirksEmpty string as NULL, ROWNUM ordering, DATE with time, NVL versus COALESCE, implicit commit on DDL. Write each in a free practice environment if you have one.
- Read real plansTake five queries, get their plans with DISPLAY_CURSOR, and explain every step and each gap between estimated and actual rows.
- Rehearse recovery storiesPractice answers for a dropped table, a lost datafile and a failed primary, naming the tool and its preconditions for each.
- Match the roleDevelopers spend more time on SQL behavior and plans; DBAs on RMAN, Data Guard and AWR; data engineers on partitions and change capture.
Generic SQL questions on joins, NULLs and window functions are in SQL interview questions. Microsoft's engine, with its own locking and indexing rules, is covered in SQL Server interview questions. For the DBA role overall, see database administrator interview questions.
Natively, an AI interview assistant on Mac and Windows, is handy for mock Oracle interviews: it transcribes the session, so you can reread whether your undo and redo explanation got the two the right way round. In practice it can read a query plan or a SQL task from a screenshot and suggest what to look at, and with Pro or the free trial it considers your résumé and the job description. Transcripts and notes remain available afterward.
Questions people ask
What Oracle Database questions are asked in interviews?
Instance versus database, SGA and PGA, background processes, tablespaces, undo and redo, read consistency, Oracle SQL quirks such as ROWNUM and empty strings, execution plans, indexes, partitioning, AWR, flashback, RMAN and Data Guard.
What is the difference between an Oracle instance and a database?
The instance is the memory structures and background processes. The database is the files on disk: datafiles, control files and redo logs. An instance opens a database, and in RAC several instances share one.
What is the difference between undo and redo in Oracle?
Redo records changes so they can be replayed during recovery. Undo keeps the before image of changed data, used to roll back transactions and to give queries a read-consistent view.
What Oracle questions do senior DBAs get?
Diagnosing a slow period with AWR and ASH, wait events, bind peeking and plan stability, backup and point-in-time recovery with RMAN, Data Guard switchover and failover, RAC and online changes on busy tables.
Where to go next
Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.
Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.
