Backup and restore • Replication and failover • Query tuning • Production incidents • 2026

Database Administrator Interview Questions

30 questions What each one tests, an answer frame, a spoken answer 35 min read

Database administrator interviews check one thing above all: can we trust you with production data? Expect a few questions on your background, a solid block on backups, restores, replication and failover, some tuning and locking problems read from execution plans and wait data, and several what-would-you-do scenarios set at the worst possible hour. Stories about outages, migrations and your own mistakes carry a lot of weight. Examples use SQL Server, Oracle and PostgreSQL, but the ideas carry across engines, so answer in terms of the platform you know best. Each question shows what the interviewer is listening for, a shape for your answer and a short answer you can say out loud.

Search all questions by round, difficulty and level, or save the ones you want to practise.

Career and Motivation 3 questions

Easy Screening round Fresher, Mid-level, Senior Practice question

1. Walk me through how you ended up as a DBA, and which database platforms you've looked after in production.

What the interviewer is really testing:
Whether you have real production ownership, not just SQL knowledge, and can be honest about which engines you know deeply and which only lightly.
Answer frame:

Path: how you moved into database work, often from development, support or system administration.

Platforms: the engines you've run in production and at what size, honestly ranked.

Why it stuck: the part of the job that keeps you in it.

Sample spoken answer:

"I started as a support engineer, and most of the tickets I ended up owning were slow reports and failed jobs, which kept pulling me into the database. My team lead let me take over the nightly backup checks, and within a year I was doing SQL Server maintenance for the whole team. For the last four years I've been a DBA looking after around forty SQL Server instances, including two availability groups, plus about a dozen PostgreSQL databases that came in with a newer product. I'm deepest on SQL Server. On PostgreSQL I'm solid on backups, replication and tuning, and still learning some of the internals. What keeps me here is that the database is where problems get real, and I like being the person who can say calmly what happened and how we get it back."

Red flag to avoid:

Claiming equal expert depth in every engine, or describing only writing queries with no ownership of backups, uptime or access.

They may ask next:
  • Which of those platforms would you be least comfortable being on call for tomorrow?
  • What's the largest database you've been responsible for, and what made it hard?
Say it in 60 seconds
Easy Screening round Fresher, Mid-level Practice question

2. In your own words, what is a production DBA responsible for that a developer who writes good SQL usually isn't?

What the interviewer is really testing:
Whether you see the role as keeping data recoverable, available and safe, not as running scripts other people hand over.
Answer frame:

Recoverability: backups that are tested, and restores that meet agreed targets.

Availability and performance: replication, failover, monitoring and tuning under the whole workload.

Safety: access control, auditing, change control and upgrades.

Sample spoken answer:

"A developer who writes good SQL cares whether their query is correct and fast. A production DBA owns everything around that. First, can we get the data back: backups that actually restore, within the time the business agreed. Second, is it up and fast for everyone at once: replication, failover, monitoring, capacity, and tuning that comes from seeing the whole workload rather than one query. Third, is it safe: who has access, what gets audited, and how changes and upgrades reach production without surprises. The short version I use is that developers own what the data means, and the DBA owns keeping it safe, available and recoverable. Good teams overlap a lot, but when something breaks at night, the DBA is the one expected to know the restore path."

Red flag to avoid:

Describing the job as running whatever scripts developers send, with nothing about backups, recovery or access.

They may ask next:
  • Where should the line between DBA and developer sit when it comes to schema design?
  • How have managed cloud databases changed what a DBA spends time on?
Say it in 60 seconds
Easy Screening round Mid-level, Senior Practice question

3. Why this DBA role, and what would you want to learn about our databases before your first on-call shift?

What the interviewer is really testing:
Whether you've thought about the environment you'd inherit and know what a careful DBA checks before being trusted with production.
Answer frame:

Why here: something specific about the team, workload or platforms that fits you.

First questions: restore evidence, failover setup, monitoring and the known pain points.

First weeks: listen and map the estate before changing anything.

Sample spoken answer:

"I'm interested because the role covers SQL Server and PostgreSQL at real scale, and from the description you're moving more of it to managed cloud services, which is where I want to grow. Before my first on-call shift I'd want to know four things. When was each important database last restored as a test, and how long did it take? How is failover set up, and has anyone actually run it recently? What does monitoring alert on, and which alerts are known noise? And what are the three things that break most often? In the first few weeks I'd mostly read runbooks, shadow someone on call and build my own map of the servers before changing anything, because a new DBA making confident changes in week one is how outages start."

Red flag to avoid:

Having no questions about backups or failover, or promising to overhaul everything straight away.

They may ask next:
  • What would worry you most if you found it in your first month?
  • How would you get up to speed on a platform you've used less?
Say it in 60 seconds

Backup and Recovery 4 questions

Easy Technical round Fresher, Mid-level Practice question

4. Explain full, differential and transaction log backups. How would you combine them into a schedule for a busy database?

What the interviewer is really testing:
Whether you know what each backup type captures and how they chain together into something you can actually restore from.
Answer frame:

Full: a complete copy, the starting point of every restore.

Differential: everything changed since the last full, so a restore needs only the latest one.

Log: the changes since the previous log backup, which make point-in-time recovery possible.

Schedule: set by how much data loss and restore time the business accepts.

Sample spoken answer:

"A full backup copies the whole database and is the base of every restore. A differential captures everything that changed since the last full, so it grows through the week, and at restore time you only need the most recent one. A log backup captures the transaction log since the previous log backup, and that unbroken chain is what lets you recover to a precise moment. For a busy database I'd typically run a weekly full, a nightly differential and log backups every few minutes, then tune that to the agreed data-loss limit. The restore path is the full, then the latest differential, then every log backup after it, in order. Engines name these differently, like RMAN incrementals in Oracle or a base backup plus archived WAL in PostgreSQL, but the idea is the same."

Red flag to avoid:

Saying a differential holds only the changes since the previous differential, or never mentioning that the log chain must be unbroken.

They may ask next:
  • What happens to your log backups if someone switches the database to the simple recovery model?
  • Why can a differential backup end up nearly as large as a full one?
  • How would you prove these backups can actually be restored?
Say it in 60 seconds
Easy Role knowledge round Fresher, Mid-level, Senior Practice question

5. What do RPO and RTO mean, and how would each one change the design you'd propose for a database?

What the interviewer is really testing:
Whether you start from business targets and can turn them into concrete backup and availability choices.
Answer frame:

RPO: how much data, measured in time, the business can afford to lose.

RTO: how long the business can be without the system.

Design link: RPO drives backup frequency and replication mode; RTO drives restore speed, standby servers and practised failover.

Sample spoken answer:

"RPO, the recovery point objective, is how much data we can lose, measured in time. If it's fifteen minutes, backups or replication have to capture changes at least that often. RTO, the recovery time objective, is how long we can be down. They push the design in different directions. A tight RPO means frequent log backups, and if it's close to zero, synchronous replication so every commit exists in two places. A tight RTO means you can't rely on restoring a big backup, because that can take hours, so you need a warm standby and a failover you've actually practised. I always get both numbers agreed in writing for each system, because a reporting database and the order system rarely need the same answer, and the cost difference between them is large."

Red flag to avoid:

Mixing up the two terms, or choosing a design before asking what the business can tolerate.

They may ask next:
  • How would you test that you can really meet the RTO you've promised?
  • What would you say to a manager who asks for zero data loss and zero downtime?
Say it in 60 seconds
Medium Behavioral round Mid-level, Senior Practice question

6. Tell me about a time you found out a backup wasn't as useful as everyone assumed. How did you find out, and what did you change?

What the interviewer is really testing:
Whether you verify backups by restoring them, and fix the process rather than only the one failure.
Answer frame:

Assumption: what everyone believed about the backups.

Discovery: the test restore, audit or incident that exposed the gap.

Fix: the immediate repair and the lasting change, such as scheduled restore tests.

Result: what you can now prove.

Sample spoken answer:

"At my last company every backup job showed green, so everyone assumed we were covered. When I joined I set up a monthly test restore of our largest database onto a spare server, and the first one failed. The full backups were fine, but the log backups went to a share that an old cleanup script also swept, so every weekend we had gaps in the log chain. Recovering to a point on a Saturday would have been impossible. I fixed the script that day and moved log backups to their own location. The lasting change was automating it: every week a job restores the latest backups to a test server, runs a consistency check and reports how long it took. Now when the business asks how long a restore takes, we give them a measured number, not a guess."

Red flag to avoid:

A story where the green job status was treated as proof, or where the fix was just rerunning the backup.

They may ask next:
  • How long did the test restore take compared with what the business expected?
  • What does your consistency check actually verify?
Say it in 60 seconds
Medium Situational round Mid-level, Senior Practice question

7. A developer tells you they deleted most of a customers table in production twenty minutes ago, and other tables have kept changing since. How do you get the data back?

What the interviewer is really testing:
Whether you recover only the lost data without throwing away everything else that happened since, and keep calm while doing it.
Answer frame:

Contain: stop whatever made the change, and pin down the exact time and scope.

Restore aside: take a fresh log backup, then restore to a separate copy, stopped just before the delete.

Put back: copy the missing rows into production, checking keys, triggers and related tables.

Afterwards: review who could do this and add safeguards.

Sample spoken answer:

"First I make sure nothing is still running, like a job repeating the delete, and pin down exactly what was run and when. I would not restore over production, because twenty minutes of other orders would be lost. I take a log backup of production straight away, so the backup chain covers the moment of the delete. Then I restore the last full backup and the log backups to a separate database, stopping just before the delete. I compare that copy with production and insert the missing customer rows back, watching for identity values, triggers, foreign keys and rows the application has changed since. I keep the business updated on how long it will take. In Oracle, if it's recent enough, flashback query might return the rows without any restore, and in PostgreSQL I'd do the same point-in-time restore to a separate instance. Afterwards I'd look at why a developer could delete directly in production."

Code:
RESTORE DATABASE Sales_Recover
  FROM DISK = N'/backup/sales_full.bak'
  WITH MOVE N'Sales' TO N'/data/Sales_Recover.mdf',
       MOVE N'Sales_log' TO N'/data/Sales_Recover.ldf',
       NORECOVERY;
-- restore each earlier log backup in order WITH NORECOVERY, then:
RESTORE LOG Sales_Recover
  FROM DISK = N'/backup/sales_log_1500.trn'
  WITH STOPAT = N'2026-09-25T14:46:00', RECOVERY;
Red flag to avoid:

Restoring the whole database over production and wiping out every other change made since the delete.

They may ask next:
  • How would you handle customers who were deleted and then partly re-created by the application since?
  • What would change in your plan if the most recent log backup was two hours old?
Say it in 60 seconds

High Availability 3 questions

Medium Technical round Mid-level, Senior Practice question

8. What's the difference between high availability and disaster recovery, and where do synchronous and asynchronous replication fit?

What the interviewer is really testing:
Whether you understand that surviving a server failure and surviving the loss of a whole site are different problems with different trade-offs.
Answer frame:

HA: survive a server or instance failure quickly, usually within one site.

DR: survive losing a whole site or region, using a copy far away.

Sync vs async: sync waits for the replica before the commit returns, so no loss but extra latency; async doesn't wait, so it's faster but can lose recent commits.

Sample spoken answer:

"High availability is about surviving a single failure, like a server dying, with only a short blip, usually by failing over to a replica in the same site or a nearby zone. Disaster recovery is about losing the whole site or region and still coming back, from a copy somewhere far away. Replication mode is where the trade-off shows. Synchronous replication makes the commit wait until the replica has the change, so failover loses nothing, but every write pays the round trip, which is fine nearby and painful over long distances. Asynchronous replication doesn't wait, so writes stay fast, but on failover you can lose whatever hadn't shipped yet. So a common design is synchronous to a nearby replica for HA and asynchronous to a distant one for DR. And neither replaces backups, because a bad delete replicates instantly."

Red flag to avoid:

Treating a replica as a backup, or claiming synchronous replication across distant regions costs nothing.

They may ask next:
  • What happens to writes on the primary if the synchronous replica goes offline?
  • How would you build this with SQL Server availability groups or PostgreSQL streaming replication?
  • Why doesn't replication protect you from someone dropping a table?
Say it in 60 seconds
Hard Technical round Mid-level, Senior Practice question

9. A read replica keeps falling several minutes behind the primary. What usually causes replication lag, and how do you find out which cause it is?

What the interviewer is really testing:
Whether you can separate a shipping delay from an apply delay and diagnose with the engine's own views instead of guessing.
Answer frame:

Split it: is the change slow to reach the replica, or slow to be applied once there?

Shipping causes: network bandwidth, or bursts of log from big batches and index rebuilds on the primary.

Apply causes: slow replica storage, or queries on the replica holding up replay.

Evidence: the replication views, lined up against the primary's workload over time.

Sample spoken answer:

"First I split the lag in two: is the log reaching the replica late, or arriving on time and being applied late? In PostgreSQL, pg_stat_replication on the primary shows write, flush and replay lag separately, and for SQL Server availability groups the replica state views show the send queue and the redo queue. If sending is behind, I look at the network and at what the primary was doing, because a big batch update or an index rebuild can produce a flood of log in minutes. If applying is behind, I check the replica's storage, and whether long reporting queries on the replica conflict with replay. In PostgreSQL a hot standby can hold replay back for conflicting queries up to a configured delay. Then I line the lag graph up with the primary's workload, because lag that spikes at the same hour every night usually has a scheduled job behind it."

Red flag to avoid:

Blaming the network straight away without checking whether the replica is receiving the log on time.

They may ask next:
  • What's the risk of letting replay wait for long reporting queries without any limit?
  • How should the application handle a user reading their own write from a lagging replica?
Say it in 60 seconds
Hard Situational round Senior Practice question

10. The primary database server has stopped responding, and your only replica is a few seconds behind. The business wants the site back now. Do you fail over?

What the interviewer is really testing:
Whether you weigh data loss against downtime using agreed targets, know who makes the call, and prevent two primaries.
Answer frame:

Check fast: is the primary really gone, or is it a network or monitoring problem?

Weigh: how soon the primary could return against the data you'd lose by promoting the replica.

Decide with the owner: follow the agreed targets and runbook, and say plainly what may be lost.

Fence: make sure the old primary can't come back and accept writes.

Sample spoken answer:

"I'd spend a minute or two confirming it's really down, from more than one place, because failing over on a network blip does more harm than good. If it is down, I'd estimate how quickly it could come back. If a restart would take a few minutes and our targets allow that, waiting keeps every transaction. If it's a hardware failure or could take an hour, failing over is usually right, but with a few seconds of lag some recent transactions may be lost. That's a business call as much as a technical one, so I'd say it plainly to the incident lead and follow what our runbook and data-loss target already say. Before promoting the replica I'd make sure the old primary is fenced off, so it can't come back, accept writes and leave us with two diverging copies. Later I'd try to recover the missing transactions from the old primary."

Red flag to avoid:

Failing over instantly without checking, or never mentioning the danger of two servers both accepting writes.

They may ask next:
  • How would you find the transactions that were on the old primary but never reached the replica?
  • Why is automatic failover risky when the two servers can't see each other but both are still running?
Say it in 60 seconds

Performance Tuning 6 questions

Medium Technical round Fresher, Mid-level, Senior Practice question

11. How do you decide whether to rebuild an index, reorganize it, or just leave it alone?

What the interviewer is really testing:
Whether you maintain indexes on evidence and cost, rather than rebuilding everything every night out of habit.
Answer frame:

Measure: fragmentation, page density, size, and whether the index is used at all.

Choose: light fragmentation, reorganize or skip; heavy fragmentation or poor page density, rebuild, online if your edition allows.

Statistics: often the real win is fresh statistics, not less fragmentation.

Sample spoken answer:

"I measure first rather than rebuilding on a timer. In SQL Server I look at fragmentation and page density per index, and I skip small indexes entirely, because a few hundred pages won't matter. The old rule of thumb is to reorganize when an index is lightly fragmented and rebuild when it's heavily fragmented. A reorganize is always online and can be stopped, but it doesn't update statistics. A rebuild recreates the index, refreshes that index's statistics with a full scan and compacts the pages, but it writes a lot of log and can block unless you use an online rebuild where the edition supports it. On modern SSD storage fragmentation matters less than it used to, and I've seen plenty of slow queries fixed by the statistics update that came with a rebuild, with the rebuild getting the credit. In PostgreSQL the same worry shows up as bloat, handled with vacuum and REINDEX CONCURRENTLY."

Red flag to avoid:

Rebuilding every index every night regardless of size or use, and not knowing statistics change along with it.

They may ask next:
  • Why can a large rebuild cause replication lag or a growing transaction log?
  • How do you find indexes that are never used?
  • When would you lower the fill factor on an index, and what does it cost?
Say it in 60 seconds
Hard Technical round Mid-level, Senior Practice question

12. In an actual execution plan, one step estimated a single row but really returned four hundred thousand. What does that tell you, and what do you check next?

What the interviewer is really testing:
Whether you know that bad row estimates drive bad plan choices, and can trace where the estimate went wrong before reaching for hints.
Answer frame:

Meaning: the optimizer planned for one row, so join types, memory and index choices are wrong for the real volume.

Usual causes: stale statistics, a sniffed parameter, table variables, functions or type conversions on columns, correlated filters.

Fix and confirm: fix the cause, rerun, and compare estimated and actual rows again.

Sample spoken answer:

"That gap is the real problem, not just a detail. The optimizer built the plan around one row, so it probably chose a nested loop with lots of lookups and gave the query too little memory, which makes sorts and hashes spill to disk. Next I work out where the estimate went wrong. I check when statistics on those columns were last updated and how many rows have changed since, because freshly loaded data is the classic cause. I look for a function or an implicit type conversion on the filtered column, which hides it from the statistics. I check whether the plan was compiled for a different parameter value, and whether a table variable is involved. Then I fix the cause, rerun, and compare estimated and actual rows again, rather than jumping to a hint that forces a join type."

Red flag to avoid:

Jumping to a new index or a hint without explaining why the estimate was wrong.

They may ask next:
  • Why can a query's plan change after nothing more than an overnight statistics update?
  • When would you accept a query hint, and what does it cost you later?
Say it in 60 seconds
Hard Technical round Mid-level, Senior Practice question

13. A stored procedure is fast for most customers but painfully slow for your biggest one. What is parameter sniffing, and how would you fix it?

What the interviewer is really testing:
Whether you understand how cached plans interact with skewed data, and know several fixes with their trade-offs.
Answer frame:

What it is: the plan is compiled for the first parameter values seen, then reused for every call.

Why it hurts: a plan that suits a small customer is wrong for a huge one, or the other way round.

Fixes: recompile per call, optimize for a typical value, split the code path, or pin a known good plan.

Sample spoken answer:

"When a procedure is first compiled, SQL Server looks at the parameter values it was called with, builds a plan for those, caches it and reuses it for every later call. That's usually good, but if the data is skewed, say most customers have fifty orders and one has five million, whichever value came first decides the plan for everyone. So the big customer might get nested loops meant for fifty rows. The fix depends on how often it runs. If it isn't called often, a recompile hint on each run is simple and reliable. If it's hot, I might optimize for a typical value, send the very large customers down their own code path, or use Query Store to force a plan that's good enough for both. Oracle and PostgreSQL have the same issue under different names, bind peeking and generic plans."

Code:
CREATE OR ALTER PROCEDURE dbo.GetCustomerOrders @CustomerId int
AS
SELECT order_id, order_date, total
FROM dbo.Orders
WHERE customer_id = @CustomerId
OPTION (RECOMPILE); -- fresh plan per call, costs CPU on every run
Red flag to avoid:

Clearing the whole plan cache in production as the fix, or not knowing why the first caller decides the plan.

They may ask next:
  • What does a recompile on every call cost you on a procedure that runs thousands of times a minute?
  • How would you prove the cause is parameter sniffing and not blocking or stale statistics?
Say it in 60 seconds
Medium Behavioral round Mid-level, Senior Practice question

14. Tell me about a database performance problem you solved where the answer was not simply adding an index.

What the interviewer is really testing:
Whether you diagnose from evidence like waits and plans, and know that many slowdowns have nothing to do with a missing index.
Answer frame:

Symptom: what users saw and how bad it was.

Evidence: the waits, plans, statistics or settings you checked.

Cause and fix: the real cause and what you changed.

Result: the measured improvement and how you guarded it.

Sample spoken answer:

"We had a nightly batch that went from forty minutes to over three hours within a couple of weeks. Everyone assumed an index was missing, but the wait stats showed most of the time was spent waiting on memory grants and tempdb, not reading tables. The plans showed big sorts spilling to disk because the row estimates were far too low. The cause was a new client whose data skewed one large table, and automatic statistics updates hadn't kicked in yet because the change was below their threshold. I added a statistics update with a larger sample straight after the load step, and split one huge query into two stages with a temp table so the second part got accurate estimates. The batch went back to about thirty-five minutes, and I added an alert if it ever runs twice its usual time."

Red flag to avoid:

A story that jumps to a fix with no evidence of where the time was actually going.

They may ask next:
  • Why didn't the automatic statistics updates catch this?
  • How did you make sure your change didn't slow other queries?
Say it in 60 seconds
Medium Situational round Mid-level, Senior Practice question

15. At ten in the morning, CPU on the main database jumps close to its limit and the app slows down. No release went out. Where do you look first?

What the interviewer is really testing:
Whether you compare the current workload with its history to find what changed, rather than restarting the server.
Answer frame:

What's running: the top queries by CPU in the last few minutes, and current waits.

Compare: which query got more expensive per run, or runs far more often, than at the same time yesterday.

Find the change: a new plan, fresh statistics, a new data pattern, a new job or caller.

Act: force the old plan or fix the cause, then confirm CPU drops.

Sample spoken answer:

"I'd look at what's using the CPU right now, the top queries by CPU over the last few minutes, and compare them with the same hour yesterday. Query Store in SQL Server and AWR in Oracle keep that history, and in PostgreSQL I compare snapshots of pg_stat_statements. Usually it's one of two things. Either a query suddenly got a worse plan, which shows up as a new plan with far more CPU per execution, often after an overnight statistics update. Or a normal query is suddenly running far more often, like a new report or an integration calling one endpoint in a loop. For a plan regression, forcing the previous good plan, where the engine allows it, is a quick, reversible fix while I find the real cause. For a volume change, I'd track down the caller with the app team. I'd avoid restarting the server, because that throws away the cache and the evidence."

Red flag to avoid:

Restarting the server or clearing the plan cache first, without looking at what changed.

They may ask next:
  • What are the risks of leaving a forced plan in place for months?
  • How would you tell a plan regression apart from a plain increase in traffic?
Say it in 60 seconds
Medium Situational round Fresher, Mid-level, Senior Practice question

16. Your weekly index and statistics maintenance now runs into business hours and slows the morning. What do you change?

What the interviewer is really testing:
Whether you can shrink maintenance to what actually helps and make it safe to run alongside users.
Answer frame:

Measure: which steps take the time, and whether they help.

Do less: skip small or unused indexes, rebuild only what needs it, update statistics where data changed.

Do it gently: online or resumable operations where supported, spread across nights.

Guard: a hard stop time so it can never run into the morning.

Sample spoken answer:

"First I'd look at the job history and see which steps take the time. Very often it's rebuilding every index on a few huge tables whether they need it or not. So I'd switch to measured maintenance: skip indexes below a size threshold, reorganize or rebuild only the ones that are actually fragmented and actually used, and update statistics only on tables where enough rows changed. Next I'd make the heavy work gentler, with online and resumable rebuilds where our edition supports them, so a rebuild can pause at a set time and carry on the next night. I'd spread the biggest tables across the week instead of one window. I'd add a hard stop, so anything unfinished by the cutoff waits for the next night. And I'd check whether backups or consistency checks are fighting for the same window."

Red flag to avoid:

Just starting the job earlier, or dropping maintenance entirely without measuring the effect.

They may ask next:
  • How would you know whether skipping a rebuild made any query slower?
  • Where do consistency checks fit, and how would you run them on a very large database?
Say it in 60 seconds

Locking and Concurrency 2 questions

Medium Technical round Fresher, Mid-level, Senior Practice question

17. The app is hanging and users say the database is stuck. How do you tell blocking from a deadlock, and how do you find the session at the head of the chain?

What the interviewer is really testing:
Whether you can diagnose live lock contention calmly, and know that blocking waits for a human decision while a deadlock is resolved by the engine.
Answer frame:

Blocking: one session waits for a lock another holds, until the holder finishes or is killed.

Deadlock: two sessions wait on each other; the engine detects it and rolls one back.

Find the head: follow who blocks whom to the session that holds locks but isn't waiting itself, then see what it's doing.

Sample spoken answer:

"Blocking is ordinary lock waiting: session B wants a row that session A has locked, so B waits until A commits or rolls back, and that can go on for a long time. A deadlock is a cycle, A waits for B and B waits for A, and the engine spots it quickly and rolls one of them back with an error, so a deadlock on its own doesn't cause a long hang. For a hang I'm looking for a blocking chain. In SQL Server I check the blocking session ID in the requests view, in PostgreSQL pg_blocking_pids, and in Oracle the blocking session column. I follow the chain to the session that's blocking others but isn't waiting on anything itself. Often it's idle inside an open transaction, like an app that began one and never committed. I find out who owns it before I kill it, because killing it rolls back its work."

Code:
-- PostgreSQL: who is waiting, and on whom
SELECT pid,
       pg_blocking_pids(pid) AS blocked_by,
       state,
       now() - xact_start AS transaction_age,
       left(query, 80) AS query
FROM pg_stat_activity
WHERE cardinality(pg_blocking_pids(pid)) > 0;
Red flag to avoid:

Killing sessions at random until things move, or treating a deadlock and long blocking as the same thing.

They may ask next:
  • What would you do if killing the head blocker means rolling back a transaction that has run for two hours?
  • How would you stop idle-in-transaction sessions from coming back?
Say it in 60 seconds
Hard Situational round Mid-level, Senior Practice question

18. Two overnight jobs deadlock with each other most nights and one of them fails. The developers say it's a database problem. What do you do?

What the interviewer is really testing:
Whether you use the deadlock details as evidence and fix the access pattern together with the developers instead of trading blame.
Answer frame:

Capture: get the deadlock graph or log entry showing both statements and the locked resources.

Read it: which tables and indexes, and in what order each job takes its locks.

Fix: one consistent access order, shorter transactions, a supporting index, or row-versioning reads.

Safety net: retry on deadlock errors.

Sample spoken answer:

"First I get the evidence. SQL Server's built-in system health session keeps recent deadlock graphs, PostgreSQL writes the details to its log, and Oracle writes a trace file. The graph shows both statements, which rows or index keys each one held, and which each one wanted. Usually it's one of three things. The jobs touch the same tables in opposite orders, so I'd ask the developers to update in one consistent order. Or a missing index forces a scan that locks far more rows than needed, and a targeted index shrinks the overlap. Or each job does a whole night's work in one long transaction, and committing in batches fixes it. I'd also make sure both jobs retry on a deadlock error, because you can't rule deadlocks out completely. And I'd bring the graph to the developers, because it turns an argument into a shared puzzle."

Red flag to avoid:

Adding NOLOCK hints everywhere, or arguing about whose fault it is without ever reading the deadlock details.

They may ask next:
  • When would snapshot or other row-versioning isolation help here, and what does it cost?
  • Why is simply scheduling the two jobs at different times only a partial fix?
Say it in 60 seconds

Security 2 questions

Medium Role knowledge round Mid-level, Senior Practice question

19. How would you set up database access so that the application, developers and the support team each get only what they need?

What the interviewer is really testing:
Whether you practise least privilege with roles, separate identities and auditing, rather than shared admin logins.
Answer frame:

Separate identities: one login per application and per person, never a shared admin account.

Roles, not users: grant permissions to roles such as app writer, support read-only and developer read.

Narrow scope: the app gets data rights on its own schema, not ownership or admin; schema changes run under a separate deploy identity.

Watch it: audit sensitive access and review role membership regularly.

Sample spoken answer:

"I'd start by making sure every application and every person has their own identity, ideally tied to the company directory, so nobody shares an admin login and every action can be traced. Then I grant permissions to roles, not individuals. The application gets a role that can read and write its own schema, ideally just run its procedures, but it doesn't own objects and can't change the schema. Migrations run under a separate deployment identity. Support gets read-only access, and where there's personal data, views that mask the sensitive columns. Developers get full rights in dev and test, and in production usually read-only, with higher access granted for a limited time and logged when they're working an incident. Finally I turn on auditing for logins and sensitive tables, and review who's in each role every quarter, because permissions pile up quietly."

Red flag to avoid:

Giving the application an admin or owner account because it's easier, or sharing one login across a team.

They may ask next:
  • How would you store and rotate the application's database password?
  • What's the risk of the application login owning its own tables?
Say it in 60 seconds
Medium Situational round Mid-level, Senior Practice question

20. A senior developer asks for permanent admin rights on production so they can fix things faster during incidents. How do you respond?

What the interviewer is really testing:
Whether you can hold a security line politely while solving the real need behind the request.
Answer frame:

Understand: what they couldn't do in recent incidents.

Explain the risk: compromise, accidental damage and audit, without implying they're careless.

Offer an alternative: time-limited, logged emergency access, better read access, runbooks.

Follow through: make the alternative fast enough that people actually use it.

Sample spoken answer:

"I'd start by asking what they couldn't do in the last few incidents, because the request usually hides a real problem, like waiting an hour for a DBA to kill a session. Then I'd explain why permanent admin is a no from me, and that it isn't about trusting them: every standing admin account is a risk if it's ever compromised, mistakes on production get much easier, and our audits expect access to be limited and traceable. What I'd offer is a break-glass path: during an incident they can request elevated access that's approved within minutes, expires after a few hours and is fully logged. I'd also give them read access to the monitoring views so they can diagnose without admin rights, and write runbooks for the common fixes. If the fast path is genuinely fast, people stop asking for permanent access."

Red flag to avoid:

Either granting it to keep the peace, or refusing flatly with no alternative.

They may ask next:
  • What if their director approves the request over your head?
  • How would you review what was done during a break-glass session?
Say it in 60 seconds

Operations 5 questions

Medium Technical round Fresher, Mid-level, Senior Practice question

21. What do you monitor on a production database, and which of those alerts deserve to wake someone up at night?

What the interviewer is really testing:
Whether you can separate signals that need action now from trends that belong in a morning review.
Answer frame:

Page-worthy: instance down, backups failing past the agreed window, replication broken or far behind, storage nearly full, long blocking.

Daytime trends: CPU, memory pressure, waits, expensive queries, growth.

Baseline: know what normal looks like so you can spot abnormal.

Runbook: every page links to what to do.

Sample spoken answer:

"I split it into two lists. Things that should page someone are the ones where waiting until morning makes it worse: the instance down or refusing connections, backups or log backups failing past the window we promised, replication broken or lagging beyond our data-loss target, data or log storage about to fill, and blocking that has lasted more than a few minutes. Everything else goes to dashboards and a daily review: CPU, memory pressure, top waits, the most expensive queries, connection counts and growth. The key for both is a baseline, because high CPU on a reporting server at month-end is normal and the same number on a quiet Tuesday morning isn't. And every page should link to a runbook, because an alert nobody knows how to act on just trains people to ignore it."

Red flag to avoid:

Paging on every CPU spike, or not monitoring whether backups succeed at all.

They may ask next:
  • How would you notice a slow problem, like a query getting a little worse every week?
  • Where do wait statistics fit into your monitoring?
Say it in 60 seconds
Medium Case round Mid-level, Senior Practice question

22. Our main database has grown steadily for two years. How would you work out when we'll run out of storage, memory or CPU, and what would you do before then?

What the interviewer is really testing:
Whether you forecast from real trend data and plan ahead with options, instead of reacting when a disk fills.
Answer frame:

Collect: growth history by database and table, plus peak CPU, memory pressure and I/O, not just averages.

Forecast: project each trend forward, add headroom, and ask about known business events.

Cheaper levers first: archive or purge, compress, tune the top consumers.

Dates: turn the forecast into a plan worked back from buying or migration lead time.

Sample spoken answer:

"I'd start with history. Most monitoring keeps data file and backup sizes over time, and I'd break growth down by table, because usually a few tables, like audit logs or events, drive most of it. For CPU, memory and I/O I'd look at peaks and busy periods, not averages, since averages hide the month-end crunch. Then I project each trend forward, add headroom, and ask the business about launches or big new customers that would bend the line. That gives me a rough date for each resource. Before buying anything I'd look at cheaper levers: archiving old data, a retention policy for logs, compression, and tuning the handful of queries that use most of the CPU. Whatever's left becomes a plan with dates, worked back from how long it takes to get hardware or move to a bigger cloud tier, so we act months early rather than during an outage."

Red flag to avoid:

Answering only with 'add more disk' without looking at what is growing or when it will run out.

They may ask next:
  • How do backup and restore times change as the database doubles in size?
  • When would you add read replicas or split the database instead of buying a bigger server?
Say it in 60 seconds
Medium Behavioral round Mid-level, Senior Practice question

23. Tell me about the worst database outage you've dealt with. How did you get it working again, and what changed afterwards?

What the interviewer is really testing:
Whether you stay methodical under pressure, communicate while you work, and turn an outage into a lasting fix.
Answer frame:

Situation: the system, the impact and how you heard about it.

Actions: confirm the cause, stabilise, and keep people updated.

Outcome: time to recover and any data impact.

Afterwards: the change that stops a repeat.

Sample spoken answer:

"The worst one was our order database refusing new orders on a Friday evening because its data drive filled up. A reporting team had started a huge export into a staging table in the same database. I first confirmed it was storage and not corruption, told the incident channel what I knew and that I'd update every fifteen minutes, then stopped the export after checking with its owner, dropped the staging table and extended the volume. Orders were flowing again in about forty minutes, with no data lost. In the review we agreed three changes: storage alerts at two levels instead of one very late one, a separate database for reporting scratch work, and a growth forecast for every production volume. That earlier alert has caught two near misses since."

Red flag to avoid:

Describing solo heroics with no communication, or blaming another team with no change to the process.

They may ask next:
  • How did you decide it was safe to stop the export?
  • What did you tell the business while orders were failing?
Say it in 60 seconds
Easy Behavioral round Fresher, Mid-level, Senior Practice question

24. Tell me about a mistake you made on a production database. What happened, and what do you do differently now?

What the interviewer is really testing:
Whether you own mistakes openly, limited the damage quickly, and built a habit or safeguard so it can't happen the same way again.
Answer frame:

Mistake: what you did, said plainly.

Impact and fix: how you noticed and how you limited the damage.

Change: the habit or safeguard you added.

Sample spoken answer:

"Early on I ran a cleanup script on what I thought was the test server, and it was production. I had two connection windows open with almost the same names. It deleted old session rows, so nothing critical, but a couple of hundred active users were logged out. I told my manager straight away, and because it was only session data we didn't need a restore, just a note in the status channel. What I changed was how I work. My production connections now show in a different colour in my tool, every manual data change starts inside a transaction and I check the row count before committing, and anything larger than a handful of rows becomes a reviewed script instead of something I type live. That row count check has stopped me twice since."

Red flag to avoid:

Claiming you've never made a mistake in production, or telling a story that blames the tool or a colleague.

They may ask next:
  • How did you decide who to tell, and how quickly?
  • What safeguards would you put in place for the whole team, not just yourself?
Say it in 60 seconds
Hard Situational round Mid-level, Senior Practice question

25. It's two in the morning and the transaction log drive for a critical database is almost full. What do you do?

What the interviewer is really testing:
Whether you find out why the log can't be reused before acting, and avoid quick fixes that destroy recoverability.
Answer frame:

Buy time: confirm the numbers and, if needed, add log space on another drive.

Ask why: check what the log is waiting on before it can be reused.

Fix the cause: a failed log backup, a long open transaction, a secondary that has fallen behind, or a stalled replication reader.

Avoid: switching recovery model or deleting files in a panic.

Sample spoken answer:

"First I check how much space is left and how fast it's filling, because that tells me how long I have. If it's minutes, I add a second log file on another drive to buy time. Then I ask SQL Server why the log can't be reused, which sys.databases shows as the log reuse wait. If it's waiting on a log backup, the backup job has probably failed, so I run one and fix the job. If it's an active transaction, I find the oldest open one and its owner before deciding whether to kill it. If it's an availability replica, a secondary is behind or disconnected and the primary keeps log for it. If it's replication, the log reader or change capture has stalled. What I won't do is switch to simple recovery, which breaks the log chain, or shrink the file blindly, which fixes nothing. PostgreSQL has the same pattern when a failing archive command or an abandoned replication slot holds WAL."

Code:
SELECT name, recovery_model_desc, log_reuse_wait_desc
FROM sys.databases
WHERE name = N'Orders';
Red flag to avoid:

Deleting log files, or switching to simple recovery without mentioning the broken backup chain.

They may ask next:
  • Once it's stable, what would you put in place so this never pages anyone again?
  • If the cause is an abandoned replication slot in PostgreSQL, what are the consequences of dropping it?
Say it in 60 seconds

Migrations and Upgrades 2 questions

Hard Technical round Mid-level, Senior Practice question

26. How do you plan a major version upgrade of a production database so that downtime is short and you can still back out?

What the interviewer is really testing:
Whether you run upgrades as rehearsed projects with a real rollback path, not a one-night gamble.
Answer frame:

Prepare: check removed or changed features and client drivers; capture performance baselines.

Method: upgrade in place, or build the new version alongside and switch over after syncing.

Rehearse: run the whole thing on a production copy and time it.

Rollback: an upgraded database usually can't be downgraded, so keep the old system intact.

Sample spoken answer:

"I treat it as a project. First I read the release notes for removed or changed features, check the application's drivers, and record baseline timings for the important queries. For the method, in place is simpler, but the outage lasts as long as the upgrade. I usually prefer building the new version alongside the old one and keeping it in sync, with logical replication in PostgreSQL or backups and log shipping in SQL Server, so the cutover is a short switch. I rehearse the whole thing on a production copy and time every step. For rollback, you usually can't downgrade a database in place once it's upgraded, so my back-out is to leave the old server untouched until we're confident. In SQL Server I'd also keep the old compatibility level at first and raise it after testing, so optimizer changes don't surprise us on day one."

Red flag to avoid:

Planning an untested in-place upgrade and assuming you can downgrade if it goes wrong.

They may ask next:
  • If you roll back two hours after cutover, what happens to the writes made on the new version?
  • What would you check in the first day after the upgrade?
Say it in 60 seconds
Medium Behavioral round Mid-level, Senior Practice question

27. Tell me about a database migration you led. What did your rollback plan look like, and did you end up needing it?

What the interviewer is really testing:
Whether you plan migrations with rehearsal and a real exit route, and can talk honestly about what didn't go to plan.
Answer frame:

Scope: what moved, how big, and how much downtime was allowed.

Plan: method, rehearsals and the go or no-go checks.

Rollback: the exact back-out and how long it would take.

Result: what happened and what you'd repeat.

Sample spoken answer:

"I led moving a PostgreSQL database of around two terabytes from our own servers to a managed cloud instance. We were allowed thirty minutes of downtime, so a dump and restore was out. I used logical replication to keep the cloud copy in sync for two weeks, and we rehearsed the cutover three times on a copy. The rollback plan was that the old server stayed untouched, and for the first two hours after cutover we replicated changes back to it, so backing out wouldn't lose new orders. We had a written go or no-go checklist with row counts, sequence values and timings for key queries. The one surprise in rehearsal was sequences: logical replication on the version we ran copied the rows but not the sequence values, so we scripted setting each one past its highest key just before cutover. On the night we didn't need the rollback, and the cutover took eighteen minutes."

Red flag to avoid:

A rollback plan that was just 'restore the backup', with no idea how long that takes or what data would be lost.

They may ask next:
  • What was on your go or no-go checklist?
  • How did you confirm the data matched after the move?
Say it in 60 seconds

Teamwork 3 questions

Medium Behavioral round Mid-level, Senior Practice question

28. Tell me about a time you pushed back on a schema change or a query a development team wanted to release. How did you handle it?

What the interviewer is really testing:
Whether you can protect production without becoming a blocker, using evidence and offering a workable alternative.
Answer frame:

Change: what the team wanted and why it was risky.

Evidence: how you showed the risk instead of just asserting it.

Alternative: what you offered in its place.

Outcome: the release, and the relationship afterwards.

Sample spoken answer:

"A team wanted to add a non-nullable column with a default to our largest table in a normal daytime release. On the engine version we ran, that meant rewriting the whole table under a lock, which I estimated at close to an hour of blocked orders. Instead of just saying no, I ran the change on a restored copy of production and showed them the timing and the lock it held. Then I proposed a different order: add the column as nullable, backfill it in small batches overnight, then add the constraint once the data was in. They were a bit frustrated at first because it spread the change across three releases, but it went out with no impact at all. Afterwards the team lead asked me to look at their migrations earlier, which is really what I wanted."

Red flag to avoid:

A story that ends with you simply blocking the release, or winning by seniority instead of evidence.

They may ask next:
  • What would you have done if they'd insisted on shipping it as it was?
  • How do you review database changes without slowing every release down?
Say it in 60 seconds
Easy Culture fit round Fresher, Mid-level, Senior Practice question

29. How do you make sure someone else on the team could restore our most important database at three in the morning without calling you?

What the interviewer is really testing:
Whether you treat runbooks and knowledge sharing as part of the job, and test them rather than just writing them.
Answer frame:

Write: step-by-step runbooks with exact commands, locations and expected times.

Test: have someone else follow them during planned restore drills.

Keep current: update them after every incident and every change.

Sample spoken answer:

"I write the runbook for someone who's tired and has never done it before, so it has the exact commands, where the backups live, which account to use and roughly how long each step should take, so they can tell when something is off. But a document nobody has followed isn't trustworthy, so during our scheduled restore tests I ask a teammate to run the restore from the runbook while I watch and keep quiet. Every place they hesitate becomes an edit. I also rotate who runs the drill, so I'm never the only person who has done it recently. After any incident or change to backups or servers, updating the runbook is part of closing the ticket. The goal is that me being on holiday is never a risk to the business."

Red flag to avoid:

Saying the team can just call you, or that the procedure lives in your head.

They may ask next:
  • What would you put at the very top of a restore runbook?
  • How do you stop runbooks going stale when servers keep changing?
Say it in 60 seconds
Easy Culture fit round Mid-level, Senior Practice question

30. Some teams see the DBA as a gatekeeper who slows them down. How do you work with developers so they see you as a partner instead?

What the interviewer is really testing:
Whether you can protect production while helping teams move faster, through early involvement, clear standards and self-service.
Answer frame:

Early: join design talks before code is written, not at release time.

Clear rules: write down what a safe migration and a safe query look like.

Self-service: let teams see their own query performance in production.

Alternatives: every 'not like that' comes with a 'here's how'.

Sample spoken answer:

"Most gatekeeping comes from getting involved too late, when a change is ready to ship and the only thing left to say is no. So I try to be in design conversations early, when a better index or table shape costs nothing. I also write down our rules, like how to add a column to a big table or when a migration needs review, so teams aren't guessing what will get stopped. I give developers read access to query performance data in production, so they can spot their own slow queries before I do. And when I do push back, I bring an alternative and help make it work. When teams start messaging me before they write the migration, not after, I know it's working."

Red flag to avoid:

Describing developers as the problem, or approving every change without review just to be liked.

They may ask next:
  • Where do you draw the line between reviewing every change and trusting teams?
  • How would you handle a team that keeps ignoring the migration guidelines?
Say it in 60 seconds
Were you asked something else? Share it A person checks every question before it goes on the site. No name is shown.
For the call itself

The questions above are the prep. The call has ten more.

ClapAssist is an AI interview assistant for Mac and Windows. It listens to the interview on your computer and shows you what to say, in short lines you can read while you talk. Your resume and notes are never stored on our servers. It stays out of screen share on every plan; only you can see it.

Download ClapAssist with 10 free minutes
Mac and Windows · Stays out of screen share · No card