Lesson 49 of 60 intermediate

Database Services, Users & Backups

Operational DBA-lite tasks

Open interactive version (quiz + challenge)

Real-world analogy

DBA-lite is caretaking a library. You don’t write the books, but you know where each one lives, who is allowed to borrow, and how to reopen the library after a flood.

What is it?

Database admin-lite is the survival kit for supporting DB-backed apps: services, users, backups, simple queries, and recognizing HA/encryption layers without managing them from scratch.

Real-world relevance

App goes down at 7 AM. You check DB service status: OK. Connections: open. Query recent logs: many deadlocks overnight. You note this in the ticket, escalate with evidence to the DBA team. Without your triage, the DBA team would have started from zero.

Key points

Code example

-- some operator DB snippets

-- PostgreSQL: show long locks
SELECT pid, usename, application_name, state,
       now() - xact_start AS duration, query
FROM pg_stat_activity
WHERE state <> 'idle'
ORDER BY duration DESC NULLS LAST
LIMIT 20;

-- PostgreSQL: size of largest tables
SELECT relname, pg_size_pretty(pg_total_relation_size(relid)) AS size
FROM pg_catalog.pg_statio_user_tables
ORDER BY pg_total_relation_size(relid) DESC
LIMIT 10;

-- SQL Server: recent error log (T-SQL)
EXEC xp_readerrorlog 0, 1, NULL, NULL, NULL, NULL, 'DESC';

-- SQL Server: who’s connected right now
SELECT session_id, login_name, host_name, program_name, status, last_request_end_time
FROM sys.dm_exec_sessions
WHERE is_user_process = 1
ORDER BY last_request_end_time DESC;

Line-by-line walkthrough

  1. 1. Operator DB snippets
  2. 2. Postgres long locks
  3. 3. Blank separator
  4. 4. Postgres biggest tables
  5. 5. Blank separator
  6. 6. SQL Server recent errorlog
  7. 7. Blank separator
  8. 8. SQL Server current sessions

Spot the bug

App outage. Junior restarts the DB service every time. Alerts are silenced to reduce noise. Nobody reads the logs.
Need a hint?
What disciplined approach turns this into real support?
Show answer
Stop silencing. Before restart: capture service status, recent logs, connection stats, active queries. After restart: log timeline, reason, outcome. Escalate to DBA team with evidence. Patterns emerge quickly — and the real fix (indexing, tuning, capacity) stops being hidden by endless restarts.

Explain like I'm 5

The database is the library. You’re the helpful front-desk person: you don’t write books, but you check if the library is open, who’s allowed in, and whether the backup shelves have today’s copies.

Fun fact

‘DBA-lite’ skills (service status, simple queries, basic backup/restore understanding) often earn a junior a huge reputation boost — because most teams are desperate for someone who can triage DB issues without escalating blindly.

Hands-on challenge

Install SQL Server Express or PostgreSQL. Create a user with read-only rights on a specific schema. Take a backup, restore to a new database, prove it by counting rows. Document your runbook.

More resources

Open interactive version (quiz + challenge) ← Back to course: IT Jobs Bootcamp