Skip to main content
MSSQL DBA LAB interview Questions
MSSQL DBA LAB interview Questions
SECTION 1 — Installation, Instance Configuration & Startup (15)
- Install SQL Server 2022 with only Database Engine + Full‑Text; validate features and service accounts.
- Change default instance to use a dedicated collation; assess rebuilding system databases vs new install.
- Move system databases (master, model, msdb) to new drives and restart cleanly.
- Configure default data/log/backup directories for new databases.
- Run instance under gMSA and validate SPNs for Kerberos.
- Configure MaxDOP and Cost Threshold for Parallelism based on CPU layout; benchmark before/after.
- Enable instant file initialization and validate it’s effective.
- Setup tempdb with multiple data files, equal sizes, fixed growth; confirm latch contention reduction.
- Instance fails to start with “Error 17113” after path change—recover without reinstall.
- Switch from mixed to Windows authentication; safely rotate the sa password and disable the sa login.
- Configure Dedicated Admin Connection (DAC) and test remote DAC access.
- Diagnose “Login failed for user” storms; identify source app from logs.
- Automate SQL Server startup options (trace flags) and verify via error log.
- Validate TLS 1.2‑only connectivity; disable weak ciphers at OS level; test client apps.
- Fix collation mismatch between instance and database during migration.
🟦 SECTION 2 — Security, Logins, Roles, Encryption (20)
- Map orphaned users to logins after database restore; fix SID mismatches.
- Enforce Contained Database authentication and migrate logins into DB scope.
- Implement Always Encrypted with secure enclaves for a PII column; prove client‑side encryption.
- Configure Transparent Data Encryption (TDE); back up cert and key; test restore on another server.
- Audit failed logins and privileged actions using SQL Server Audit to a file target.
- Create custom server roles and delegate least privilege for deployment pipelines.
- Identify logins with UNSAFE assemblies or CONTROL SERVER; reduce privileges safely.
- Force password policy and expiration for SQL logins; detect non‑compliant accounts.
- Implement row‑level security predicate for a multi‑tenant table; verify plan stability.
- Restrict xp_cmdshell usage and detect any attempts to re‑enable.
- Configure Always On endpoints with certificates for cross‑domain replicas.
- Trace who dropped a critical login; reconstruct timeline from default trace/extended events.
- Enable TDS encryption (force encryption) and validate from client side.
- Detect logins connecting from unexpected subnets; enforce logon triggers with guardrails.
- Rotate TDE keys; re‑encrypt the database; validate restore ability with old backups.
- Secure Linked Server creds; detect plaintext password usage in scripts.
- Identify and disable SQL Browser where not required; test multi‑instance connectivity.
- Implement Certificate‑based signatures for elevated stored procedures.
- Lock down CLR with strict permission sets and signing; detect unsafe assemblies.
- Inventory all public role permissions and revert accidental grants.
🟦 SECTION 3 — Database Files, Transaction Log & Recovery (20)
- A database log grows to fill disk—stabilize log growth without data loss; identify cause.
- Switch recovery model FULL → SIMPLE → FULL safely; validate log backup chain continuity.
- Fix “The log for database is not available” after abrupt shutdown; recover with minimal downtime.
- Automate pre‑sizing and auto‑growth policies to eliminate VLF proliferation; validate with DBCC LOGINFO/LOGINFO2.
- Shrink a log file safely after addressing cause—prove no log reuse wait remains.
- Diagnose log reuse wait reasons using sys.databases; eliminate ACTIVE_TRANSACTION or REPLICATION wait.
- Split data and log to separate disks; baseline write latencies with sys.dm_io_virtual_file_stats.
- Fix “Cannot recover the master database” on startup—restore master from backup.
- Convert multiple‑file filegroup design for a hot table; test proportional fill distribution.
- Enable Accelerated Database Recovery (ADR); measure rollback/recovery improvements.
- Repair inconsistent file metadata after interrupted growth.
- Implement FILESTREAM; store and query BLOBs; test backup/restore.
- Recover a database stuck in In Recovery state after crash.
- Move data files to new storage with ALTER DATABASE … MODIFY FILE and downtime planning.
- Detect auto‑shrink enabled and remove it; demonstrate fragmentation impact.
- Create read‑only filegroup for archive data; prove write blocking.
- Fix suspect database; decide between restore vs emergency mode repair.
- Use DBCC CHECKDB with PHYSICAL_ONLY on schedule; test full integrity weekly.
- Interpret DBCC CHECKDB output; repair minimally without data loss where possible.
- Investigate and fix page checksum errors; track to storage vs memory issues.
🟦 SECTION 4 — Backup, Restore, PITR & DR (25)
- Implement full + diff + log strategy with msdb job history and retention.
- Validate page‑level restore for a single damaged page.
- Perform file/filegroup restore for a large DB to minimize recovery time.
- Execute point‑in‑time restore using marked transactions.
- Restore a database with MOVE clauses to new paths; fix orphaned users post‑restore.
- Test copy‑only backups not breaking diff chain.
- Implement backup compression; measure CPU vs time savings.
- Encrypt backups at rest; store keys safely; verify out‑of‑band restore.
- Validate backups with RESTORE VERIFYONLY and DBCC CHECKDB on restored copies.
- Script automated cleanup of old backup files; prevent accidental deletion of newest.
- Restore production backup to lower environment with data masking.
- Simulate DR to a different data center; document RTO/RPO achieved.
- Restore master and msdb to a clean instance; re‑register jobs, operators, alerts.
- Validate log shipping configuration; simulate primary outage and manual failover.
- Compare log shipping vs AG readable secondary for reporting; measure latency.
- Throttle backups to reduce I/O contention during business hours.
- Investigate failed backups due to VSS writers on Windows; fix coordination.
- Capture backup throughput metrics and identify bottlenecks.
- Prove you can restore TDE‑encrypted backup on a new server (cert/keys).
- Restore a differential without proper base—detect and correct sequence.
- Validate transaction log chain across copy‑only full backups.
- Implement staging restores for nightly integrity checks.
- Test partial restores for read‑only filegroups.
- Build DR runbook; conduct a full failover simulation.
🟦 SECTION 5 — High Availability: Always On AG / FCI / DR (30)
- Build a 2‑node FCI (Failover Cluster Instance) on WSFC; validate shared storage.
- Deploy a 3‑replica Always On Availability Group with automatic failover.
- Configure synchronous + asynchronous replicas; test commit latency and failover combos.
- Configure Readable Secondary routing lists; validate read‑intent connection strings.
- Test automatic seeding; measure backup preferences impact.
- Simulate automatic failover; verify client reconnection with listener.
- Diagnose AG synchronization health; identify HADR_WAITONLINE issues.
- Fix seeding failures and AG replica join errors with Extended Events.
- Simulate split‑brain risk (multi‑subnet); show prevention with quorum/witness.
- Configure multi‑subnet listener; test client retry logic across subnets.
- Tune Availability Mode and Session Timeout; observe failover sensitivity.
- Validate backup on secondary strategy; ensure proper copy‑only usage.
- Test planned manual failover with zero data loss; confirm synchronization state.
- Validate DTC support across AGs for distributed transactions.
- Integrate AGs with TDE across replicas; synchronize certs.
- Implement read‑scale availability groups (no WSFC) and load balance reporting.
- Capture AG latency and redo queue metrics; correlate to workload.
- Rebuild a failed replica without re‑initializing the primary.
- Diagnose log send/redo queue growth under heavy load; optimize.
- Perform in‑place upgrade of AG nodes with minimal downtime.
- Restore quorum after multiple node failures in a stretched cluster.
- Evaluate distributed availability groups across regions; measure lag.
- Fix listener DNS registration issues across domains.
- Configure automatic seeding with compression; verify impact.
- Enable Accelerated Database Recovery with AGs; observe failover behavior.
- Create policy‑based management to enforce HADR configurations.
🟦 SECTION 6 — Performance, Waits, Query Store & XE (30)
- Capture top waits (sys.dm_os_wait_stats) over a peak window; produce before/after snapshot.
- Identify high SOS_SCHEDULER_YIELD vs PAGEIOLATCH_*; propose CPU vs I/O fixes.
- Detect parameter sniffing; compare forced plan vs recompile strategies.
- Enable Query Store; capture regressions; force a known good plan.
- Diagnose CXPACKET/CXCONSUMER waits; tune MaxDOP/CTFP properly.
- Trace a sudden regression with an Extended Events session; tie to code release.
- Identify Top 10 queries by CPU/reads/writes with Query Store.
- Detect implicit conversions causing index scans; fix datatypes.
- Find missing indexes safely; validate benefit vs overhead.
- Detect memory grants causing spills; adjust workload group or query.
- Correlate tempdb spills using actual execution plans and XE.
- Baseline PFS/SGAM/GAM contention; verify tempdb configuration improvements.
- Identify blocking chains; capture lead blocker and query text.
- Use Resource Governor to cap runaway ETL workloads; prove effect.
- Capture deadlocks using XE; diagram the victim/culprit.
- Track auto‑statistics updates; correlate with plan changes.
- Diagnose ASYNC_NETWORK_IO; identify chatty app patterns.
- Measure server memory pressure via memory clerks/pressure notifications.
- Find top I/O consumers per db/file; verify with perf counters.
- Capture spinlock contention (advanced); interpret.
- Identify RBAR procedural T‑SQL patterns; rewrite set‑based.
- Prove improvement from table variables → temp tables under load.
- Diagnose latch vs lock contention differences.
- Use Automatic Tuning (Azure SQL) to force last good plan; measure impact.
- Build a performance baseline workbook and automate daily captures.
🟦 SECTION 7 — Indexing & Schema Design (20)
- Find and drop redundant/duplicate indexes; re‑test workload.
- Evaluate filtered indexes for selective predicates; validate plan picks.
- Convert wide clustered index to narrow surrogate key; measure page density.
- Test columnstore index for large fact table; monitor rowgroup quality.
- Rebuild vs reorganize strategy; automate thresholds based on fragmentation + page count.
- Create covering indexes for hot queries; verify key lookup elimination.
- Detect ascending key problems; enable OPTIMIZE FOR SEQUENTIAL KEY (SQL 2022).
- Use computed columns + indexes; prove sargability with persisted computed.
- Identify heap tables with forwarded records; evaluate clustering.
- Evaluate partitioned tables and aligned indexes for sliding window loads.
- Migrate a hot unique index to hash partitioning (where applicable).
- Detect GUID vs BIGINT PK tradeoffs; show fragmentation differences.
- Build spatial indexes on geography data; validate query shapes.
- Tune columnstore batch mode performance; address row mode fallbacks.
- Validate statistics sampling vs fullscan impact on regressions.
- Implement incremental statistics on partitioned tables.
- Test memory‑optimized table indexes (Hekaton) for specific workload.
- Identify write amplification from too many nonclustered indexes.
- Prove benefit of compressed indexes (row/page) on I/O‑bound systems.
- Design unique filtered indexes to enforce conditional business rules.
🟦 SECTION 8 — Concurrency, Locks, Deadlocks & Isolation (20)
- Compare READ COMMITTED vs SNAPSHOT isolation; measure version store impact.
- Enable RCSI; monitor tempdb version store growth; catch long‑running readers.
- Generate and capture a deadlock; analyze victim selection and fix.
- Diagnose LCK_M_S/IX/X waits from a hot table; deploy mitigations.
- Identify metadata locking during DDL; rewrite deployment to avoid blocks.
- Track ghost record cleanup and its impact on queries.
- Capture lock escalation events; prevent with partitioning or hints.
- Fix blocking caused by long implicit transactions.
- Identify abandoned transactions from app pool recycles; add safeguards.
- Tune snapshot isolation for reporting replicas; validate throughput.
- Prove NOLOCK side effects with inconsistent reads; propose alternatives.
- Identify THREADPOOL waits under connection storms; tune worker counts.
- Isolate HADR_SYNC_COMMIT latency affecting OLTP.
- Diagnose SNI / network timeouts vs lock waits.
- Trace sp_prepare/sp_execute misuse causing excessive plan cache bloat.
- Capture spinlock backoffs tied to latch contention (advanced).
- Identify and fix temp table/table variable concurrency hotspots.
- Prove improvement from batch mode on rowstore (where supported).
- Eliminate implicit conversions on join keys causing S‑X lock skew.
- Capture and resolve availability group readable routing deadlocks.
🟦 SECTION 9 — Tempdb, Memory, Storage & I/O (15)
- Size tempdb correctly; add files and set trace flags; validate reduced SGAM contention.
- Identify spill events to tempdb for sorts/hashes; tune memory grants.
- Diagnose PAGEIOLATCH_SH/EX vs WRITELOG patterns; propose storage changes.
- Track READ_AHEAD misses; validate sequential scan patterns.
- Validate storage tiering benefits (SSD/NVMe) for log vs data.
- Use Buffer Pool Extension (legacy feature) on SSD; measure effect (educational).
- Detect compressed backups vs storage dedupe impacts.
- Analyze I/O queue depth saturation; coordinate with SAN team.
- Prove impact of PAGE verification (CHECKSUM) on corruption detection.
- Identify tempdb growth storms; pin to culprit queries.
🟦 SECTION 10 — SQL Agent, SSIS/ETL & Automation (15)
- Harden SQL Agent security; proxy credentials; separate service accounts.
- Create robust retry logic for failing jobs; add alerts/operators.
- Build database mail with OAuth (where supported) or secure relay; send alerts.
- Audit which jobs modify data in key databases; tag and document owners.
- Capture job runtime baselines; alert on anomalies automatically.
- Implement SSIS catalog; deploy package; secure environments.
- Troubleshoot SSIS package memory leaks and parallelism settings.
- Automate index and statistics maintenance with adaptive thresholds.
- Create a self‑healing job to detect and kill runaway sessions by policy.
- Build a first responder script pack execution (sp_Blitz, etc.) on schedule.
- Orchestrate ETL dependencies with Agent; add failure fencing.
- Capture job history to a warehouse; visualize SLAs.
- Validate Agent failover behavior on FCI/AG nodes.
- Implement Powershell health checks across a fleet of instances.
- Build policy‑based management for configuration drift.
🟦 SECTION 11 — Azure SQL / Managed Instance / Hybrid (20)
- Migrate on‑prem DB to Azure SQL Managed Instance with DMS; validate compatibility.
- Enable Geo‑replication (Azure SQL DB); test failover and latency.
- Configure Auto‑failover groups across regions; test read‑write listener routing.
- Use Automatic tuning (force last good plan) and measure improvement.
- Diagnose TempDB performance on Managed Instance; adjust workload.
- Capture wait stats and query store on Azure SQL DB with limited permissions.
- Integrate Azure Key Vault with TDE; rotate keys and validate restore.
- Evaluate Hyperscale tier (Azure SQL) for large database; measure log service behavior.
- Validate long‑term backup retention (LTR) restores in a sandbox.
- Compare Private Link vs Public endpoint; restrict inbound traffic.
- Validate vCore sizing vs DTU workloads; scale up/down with minimal impact.
- Audit connection failures via Azure diagnostics; correlate to app changes.
- Implement failover runbook for Azure SQL + on‑prem hybrid apps.
- Test BACPAC export/import for schema‑only migrations; capture pitfalls.
- Validate serverless auto‑pause/resume behavior on Azure SQL DB.
- Measure Storage IOPS limits per tier; throttle workloads.
- Implement ADF/SSIS IR pipelines to/from Azure SQL; secure secrets.
- Capture Intelligent Insights incidents; validate recommendations.
- Test Active Geo‑replica seeding time vs DB size.
Comments
Post a Comment