How do you tune Oracle performance and keep it highly available? AWR, execution plans, partitioning, RAC and Data Guard.
Finding problems
- AWR (Automatic Workload Repository) snapshots database statistics; an AWR report for a time window shows top SQL by elapsed time, CPU and I/O, and the top wait events (what sessions spent time waiting on). Requires the Diagnostics Pack licence.
- ASH (Active Session History) samples active sessions every second for drilling into short spikes.
- ADDM analyses AWR data and suggests fixes; SQL Tuning Advisor proposes indexes, profiles and rewrites.
DBMS_XPLAN.DISPLAY_CURSORshows the actual plan with row counts (/*+ GATHER_PLAN_STATISTICS */).
Common fixes
Up-to-date optimiser statistics (DBMS_STATS), the right indexes (B-tree, bitmap for low-cardinality columns in warehouses, function-based), bind variables, partitioning (range, list, hash, interval) with partition pruning and local indexes, and SQL Plan Management (baselines) to lock in good plans across upgrades.
High availability
- RAC: several instances on different servers share one database on shared storage; if a node fails, sessions fail over to the others (with Application Continuity or TAF). Scales reads and writes for well-designed applications.
- Data Guard: a standby database kept in sync by shipping redo, in another data centre or region. Modes: Maximum Protection, Maximum Availability (synchronous) and Maximum Performance (asynchronous). Active Data Guard opens the standby read-only for reports. Switchover is planned; failover happens after a disaster.
- RMAN for backups and point-in-time recovery; GoldenGate for logical replication and zero-downtime migrations.
Example
-- Actual execution plan with estimated vs actual rows
SELECT /*+ GATHER_PLAN_STATISTICS */ o.order_id, o.amount
FROM orders o
WHERE o.customer_id = :cust AND o.created_at >= DATE '2026-01-01';
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL, NULL, 'ALLSTATS LAST'));
-- Interval partitioning: a new monthly partition is created automatically
CREATE TABLE events (
event_id NUMBER GENERATED ALWAYS AS IDENTITY,
created_at DATE NOT NULL,
payload CLOB
)
PARTITION BY RANGE (created_at) INTERVAL (NUMTOYMINTERVAL(1, 'MONTH'))
(PARTITION p_start VALUES LESS THAN (DATE '2026-01-01'));
-- Refresh statistics for a table and its indexes
EXEC DBMS_STATS.GATHER_TABLE_STATS(ownname => 'SHOP', tabname => 'ORDERS', cascade => TRUE);Follow-up questions interviewers ask
Try answering each one before you open it.
How would you migrate an Oracle schema to PostgreSQL?
Assess with tools (ora2pg, AWS Schema Conversion Tool, Google Database Migration Service), convert types (NUMBER → numeric/bigint, VARCHAR2 → varchar, DATE includes time → timestamp), rewrite PL/SQL packages as PL/pgSQL functions or move logic to the application, replace sequences, synonyms and hints, then migrate data with CDC to keep downtime short. Note Oracle treats '' as NULL, PostgreSQL does not.