Database administrator interview questions and answers
Database administrator interview questions focus on keeping data safe, available and fast: backup and restore, high availability, query and index tuning, locking, security and routine maintenance. Most interviews mix knowledge questions about your main engine (SQL Server, PostgreSQL, Oracle or MySQL) with outage scenarios where you talk through what you would check first. The candidates who stand out explain how they have proven a restore works, not only how they take backups.
By Evin JohnPublished 8 min read
What a DBA is hired to do
A database administrator owns the health of the data layer. In practice that means backups that can actually be restored, a failover plan that has been rehearsed, queries that do not lock up the application at peak hours, access that follows least privilege, and upgrades that happen without surprises. Some teams split the job: an operational DBA handles servers, patching and recovery, while a development DBA reviews schemas, queries and migrations alongside engineers. Read the posting to see which side carries more weight.
Interviewers usually probe one engine in depth and expect general transfer to others. If the posting says SQL Server, prepare for questions on recovery models, the transaction log, SQL Server Agent and Always On availability groups. If it says PostgreSQL, expect MVCC, VACUUM, WAL and streaming replication. Oracle roles add RMAN, Data Guard and tablespace management. Cloud-heavy teams ask how a managed service such as Amazon RDS or Azure SQL changes the job, since the provider takes over patching and hardware while you keep design, tuning and recovery planning.
How the interview process tends to run
- Recruiter or HR screenWhich engines and versions you have run, database sizes, on-call experience and whether you worked on-premises, in the cloud or both.
- Technical screenRapid knowledge questions on backups, indexes, isolation levels and replication, sometimes with a short SQL task.
- Scenario roundA senior DBA or engineering lead describes an incident, such as a full log or a slow checkout query, and asks what you would do step by step.
- Team and manager roundChange management, working with developers, documentation habits and how you handle pressure during an outage.
Backup, restore and recovery questions
| Question | What it tests | What a strong answer shows |
|---|---|---|
| What is the difference between full, differential and transaction log backups? | Backup fundamentals | What each captures, how they chain together, and how the mix affects restore time |
| How would you restore a database to 10:42 this morning? | Point-in-time recovery | Last full, latest differential, then log backups up to the exact time with STOPAT or the engine's equivalent |
| What are RPO and RTO, and who decides them? | Business alignment | Data loss tolerance and downtime tolerance are business decisions; the DBA designs backups and HA to meet them |
| How do you know your backups are good? | Verification habit | Scheduled test restores to another server, integrity checks, and alerts when a backup job fails or is skipped |
| The transaction log is full. What happened and what do you do? | Log management | Check what blocks log reuse (a missed log backup, a long open transaction, a lagging replica), fix that cause, and avoid shrinking as a habit |
| Where should backups be stored? | Resilience | Off the database server, with a copy in another location, encrypted, and protected from deletion by the same accounts that run production |
| How does recovery model or archive mode affect you? | Engine settings | SQL Server simple versus full recovery, or PostgreSQL WAL archiving, and what each allows you to restore |
Performance tuning questions
- A query that took one second now takes forty. Where do you start? Compare the current execution plan to a known good one, check whether statistics are stale, look for a changed parameter value or a missing index, and confirm it is not simply waiting on a lock.
- Clustered versus nonclustered index? The clustered index defines the physical order of rows in the table; nonclustered indexes are separate structures pointing back to the rows. Mention that a table has at most one clustered index.
- What makes an index covering, and when is that worth it? It contains every column the query needs, so the engine never visits the base table. Worth it for hot queries, at the cost of extra writes and storage.
- Why would the optimizer ignore an index you created? Low selectivity, a function wrapped around the column, implicit type conversion, or outdated statistics that misjudge row counts.
- What is parameter sniffing? A plan compiled for one parameter value gets reused for values with very different row counts. Discuss options such as recompile hints, plan guides or rewriting the query, and their costs.
- How do you find the most expensive queries on a server? Query Store or dynamic management views in SQL Server, pg_stat_statements in PostgreSQL, AWR reports in Oracle, the slow query log in MySQL.
- What are wait statistics telling you? Where sessions spend their time: disk I/O, locks, memory grants, CPU or network. They point at the bottleneck before you guess.
- Rebuild or reorganize an index? Explain fragmentation, why heavy rebuilds on large tables need a maintenance window or an online option, and why fragmentation matters less on SSD storage than it once did.
Interviewers often ask you to write or read a diagnostic query. Being able to type one from memory signals hands-on time. Two common examples:
-- SQL Server: who is blocked, and by whom
SELECT session_id, blocking_session_id, wait_type, wait_time, status
FROM sys.dm_exec_requests
WHERE blocking_session_id <> 0;
-- PostgreSQL: active queries, longest first
SELECT pid,
now() - query_start AS runtime,
state,
wait_event_type,
left(query, 80) AS query_text
FROM pg_stat_activity
WHERE state <> 'idle'
ORDER BY runtime DESC;Concurrency, locking and integrity questions
| Question | What it tests | What a strong answer shows |
|---|---|---|
| Explain the transaction isolation levels. | ACID and isolation | Read uncommitted to serializable, which anomalies each allows (dirty reads, non-repeatable reads, phantoms), and the engine's default |
| What is a deadlock and how do you reduce them? | Locking | Two sessions each holding what the other needs; the engine kills one. Fix with consistent access order, shorter transactions and better indexes |
| What is MVCC? | Row versioning | Readers see a snapshot and do not block writers; in PostgreSQL that leaves dead tuples that VACUUM must clean |
| Why does autovacuum matter in PostgreSQL? | Engine maintenance | Reclaims dead rows, updates statistics and prevents transaction ID wraparound; tuning it on busy tables |
| How do you check for corruption? | Integrity | DBCC CHECKDB in SQL Server, checksums and amcheck in PostgreSQL, and what you do when a check fails |
High availability, replication and cloud questions
- Compare high availability with disaster recovery. HA keeps the service up through a single failure in one site; DR brings it back after losing a site. Many designs need both.
- Synchronous or asynchronous replication? Synchronous avoids data loss at the cost of write latency; asynchronous is faster but can lose the last transactions on failover.
- Walk me through a planned failover. Confirm the replica is caught up, stop or redirect writes, fail over, point the application at the new primary through a listener or DNS, and verify before closing the change.
- A read replica is lagging by minutes. What do you check? Long-running transactions on the primary, network throughput, replica disk I/O, and heavy queries on the replica that hold up replay.
- What changes when the database moves to a managed cloud service? No OS access, provider-managed patching and backups within set retention, different monitoring tools, and new cost questions about storage and IOPS.
- How would you plan a major version upgrade? Test on a restored copy, check deprecated features, rehearse the timing, choose in-place or side-by-side, and keep a rollback path.
Security and access questions
- How do you set up access for a new application? A dedicated login with only the permissions it needs, granted through roles, never the admin account, and credentials stored in a secrets manager.
- What does encryption at rest cover, and what does it miss? Data files and backups on disk. It does not protect against a user who already has query access.
- How do you audit who changed sensitive data? Engine audit features or triggers for specific tables, logs shipped somewhere the DBA cannot quietly edit, and regular review.
- How do you handle requests for production data in test? Mask or generate data, follow the company's data policy, and never copy personal data to less protected systems by default.
Working with developers and change control
- Tell me about a schema change you pushed back on. What did you propose instead?
- How do you review a migration script before it runs in production?
- Describe an outage you handled. What did you tell people while it was happening?
- How do you document runbooks so someone else can restore at 3 a.m.?
- What do you automate first on a new estate of database servers?
These follow the story structure in the behavioral question guide. For a DBA, a strong story names the risk you prevented and how you proved the fix, such as a restore drill or a before and after plan.
Fictional example
- A developer ran an UPDATE without a WHERE clause on the customers table of our order system at about 2 p.m. Support saw it within ten minutes. I told the incident channel we would restore to a separate database rather than overwrite production, so new orders could keep coming in. I restored the last full and differential backups plus log backups to one minute before the statement, which I found in the audit log. Then I wrote a join between the restored copy and production to put back only the changed columns. Customers were correct again within ninety minutes, and no new orders were lost. Afterwards we removed direct write access to production for that team and moved ad hoc fixes into reviewed scripts.
A ten-day preparation plan
- Days 1 and 2: on a local or cloud test instance, take full and log backups, then restore to a point in time. Time it.
- Days 3 and 4: read execution plans for five slow queries, add or change one index each, and explain the difference aloud.
- Days 5 and 6: create a deadlock on purpose with two sessions, read the engine's report, and fix it.
- Day 7: set up a replica, break the network between them, and watch what lag and failover look like.
- Day 8: review isolation levels, MVCC and the security questions above until each fits in a minute.
- Days 9 and 10: rehearse two outage stories and one schema review story, and prepare questions about the team's estate size and on-call rotation.
If you rehearse these scenarios with Natively, an AI interview assistant for Mac and Windows, it writes a transcript of the mock session on your computer, so you can check whether your restore steps came out in the right order. It can draft answer suggestions as the practice questions come in, read a query or execution plan from a screenshot and talk through it, and, with Pro or the free trial, take the résumé and job description you add into account. Notes and transcripts stay available for review afterwards.
Database work overlaps with server and storage work, so the systems administrator guide is worth a read too.
Questions people ask
What questions are asked in a database administrator interview?
Expect questions on backup types and point-in-time restore, RPO and RTO, indexes and execution plans, isolation levels and deadlocks, replication and failover, user access and encryption, plus outage scenarios such as a full transaction log.
How do I answer DBA troubleshooting scenarios?
Say what you would check first and why: current waits and blocking, recent changes, the execution plan and statistics, disk and log space. Protect the data before you try a fix, and keep people updated while you work.
Do DBA interviews include a SQL test?
Often a short one: writing joins and aggregates, reading an execution plan, or writing a diagnostic query against the engine's system views. Development DBA roles go deeper into query rewriting and schema design.
What should a fresher study for a DBA interview?
SQL fundamentals, normalization, keys and indexes, backup and restore on one engine, transactions and isolation levels, and basic user and role management. Practice a restore yourself on a test instance before the interview.
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.
