14. Database Administration, Reliability and DataOpsIntroduction and ContextA database is not merely a software product installed on a server. It is an operational service on which applications, analytical systems, financial processes and organizational decisions depend. Database administration therefore extends beyond creating tables and users. It includes planning deployment, configuring the database engine, protecting data, monitoring performance, managing capacity, applying changes safely, recovering from failure and continuously improving operational practice. Traditional database administration often relied on manually executed procedures and the experience of a small group of specialists. Modern organizations operate more complex environments: cloud databases, distributed replicas, containerized services, automated pipelines, infrastructure as code and frequent application releases. These conditions have led to the integration of database administration with reliability engineering and DataOps. DataOps applies DevOps principles—automation, version control, testing, collaboration and continuous feedback—to data platforms and database workflows. The central problem is a balancing problem. A database must be available and responsive, but it must also remain secure, correct, recoverable and economically sustainable. Rapid change without control can cause data loss or service interruption; excessive control without automation can make delivery slow and error-prone. Professional database administration provides the governance, engineering practices and operational evidence needed to balance these objectives. Learning ObjectivesAfter studying this chapter, the learner should be able to: 1. Explain the responsibilities of database administration, reliability engineering and DataOps. 2. Plan database deployment, configuration, monitoring and capacity. 3. Define service-level objectives and select meaningful reliability indicators. 4. Design high-availability and disaster-recovery strategies. 5. Apply safe schema migration, testing, version-control and rollback practices. 6. Explain the role of containers and infrastructure as code in database operations. 7. Analyze incidents using structured response and post-incident learning. 8. Evaluate governance, security, cost and ethical implications of operational database decisions. The Operational Responsibility of a Database TeamDatabase administration can be viewed as a lifecycle rather than a collection of isolated tasks. The lifecycle begins with requirements and architecture, continues through deployment and operation, and includes retirement or migration at the end. Typical responsibilities include installation, configuration, account management, backup and recovery, performance tuning, storage planning, patching, replication, auditing and technical support. Reliability engineering adds a systematic way to reason about failure. It asks what users require, how failure will be detected, how quickly service must be restored and what level of data loss is acceptable. DataOps extends this perspective to data delivery. It seeks reproducible and observable data workflows in which database changes, data pipelines and infrastructure can be tested and promoted through controlled environments. These responsibilities are connected. A poorly designed schema migration may increase application latency; increased latency may trigger an incident; inadequate monitoring may delay detection; and an untested backup may make recovery impossible. Operational quality therefore depends on the whole system, including applications, networks, identity services, storage, cloud infrastructure and human procedures. Deployment and Configuration as Engineering DecisionsA deployment plan should identify the database engine and version, workload characteristics, data volume, availability requirements, security boundaries, integration points and expected growth. It should also document dependencies such as operating-system packages, network routes, certificates, extensions, connection pools and backup storage. Configuration should be managed deliberately. Important settings include memory allocation, connection limits, transaction logging, checkpoint behavior, storage layout, parallel execution, timeouts and replication parameters. A setting that improves one workload may harm another. For example, permitting unlimited connections can exhaust memory and create contention, while an excessively small connection limit can cause application failures. Configuration should therefore be based on measured workload behavior rather than copied blindly from another environment. A sound environment usually separates development, testing, staging and production. The environments should be similar enough for tests to be meaningful, while production data must be protected through masking, anonymization or synthetic data. Configuration should be externalized and versioned where possible. Secrets such as passwords, tokens and encryption keys must not be stored in source-code repositories. Deployment plans also require change sequencing. A database may need to be provisioned before an application is deployed, but destructive schema changes generally require application compatibility first. Deployment is safer when it is repeatable, observable and reversible. Reliability: Availability, Recovery and Service ObjectivesReliability is broader than uptime. A reliable database preserves correctness, provides acceptable performance, protects confidentiality and can be recovered after failure. Three related measures are particularly important: - Recovery Point Objective (RPO): the maximum acceptable amount of data loss measured in time.
- Recovery Time Objective (RTO): the maximum acceptable time to restore service.
- Service-Level Objective (SLO): a target level of service, such as a percentage of successful requests or a latency threshold.
An SLO should be expressed using a measurable service-level indicator (SLI). For example, an SLI may be the proportion of read requests completed within 300 milliseconds, or the percentage of committed transactions that remain durable. A service-level agreement may contain externally negotiated commitments, whereas an SLO is an engineering target used to manage reliability. The concept of an error budget is useful. If an SLO permits a small amount of failure, the permitted unreliability constitutes an error budget. Teams can use that budget to decide whether to prioritize new functionality or reliability work. When the budget is being consumed too quickly, risky releases may be delayed while corrective action is taken. This makes reliability a measurable management concern rather than an abstract aspiration. Reliability also involves dependencies. A database may be operational while an application cannot connect because of a failed network service, expired certificate or exhausted connection pool. Monitoring must therefore measure user-visible outcomes as well as internal database metrics. Monitoring and Capacity ManagementMonitoring converts system behavior into evidence for decisions. Effective monitoring combines metrics, logs, traces and alerts. Database metrics may include transaction rate, query latency, lock waits, deadlocks, cache efficiency, replication lag, connection utilization, storage consumption, backup duration and failed authentication attempts. A metric is useful only when its meaning and action are understood. An alert such as “CPU above 80 percent” may be noisy if the workload is healthy at that level. A better alert may combine sustained CPU utilization with increased latency and queue growth. Alerts should identify severity, ownership, likely impact and an initial response path. Capacity management is the practice of ensuring that resources remain sufficient as workload and data volume grow. It includes forecasting storage, memory, compute, network bandwidth, I/O operations and connection capacity. Growth is not always linear. Marketing campaigns, month-end processing and sudden analytical queries can create bursts that average-based forecasts miss. A capacity review should examine: - current utilization and saturation points;
- rate of data and transaction growth;
- seasonal and exceptional workloads;
- index and table expansion;
- backup and replica-storage requirements;
- cost of scaling vertically or horizontally; and
- the effect of archiving, partitioning, caching or query optimization.
Capacity planning should include a margin for uncertainty, but excessive overprovisioning wastes resources. Autoscaling can help with variable workloads, although it does not eliminate the need for limits, cost controls and workload governance. High Availability and Disaster RecoveryHigh availability aims to reduce service interruption during expected or localized failures. Common techniques include replication, failover clusters, standby databases, load balancing and geographically separated instances. High availability is not the same as disaster recovery. Disaster recovery addresses major events such as regional outages, corruption, ransomware, accidental deletion or loss of an entire infrastructure environment. Replication may be synchronous or asynchronous. Synchronous replication can provide stronger durability because a transaction is acknowledged only after being recorded at another location, but it may increase latency and depends on network conditions. Asynchronous replication usually offers better performance and geographical flexibility, but a failure can leave the replica behind the primary database. The choice must reflect RPO, RTO and business priorities. A disaster-recovery design should specify backup frequency, retention, encryption, off-site storage, restoration procedures, alternate infrastructure, DNS or routing changes, application reconfiguration and decision authority. Backups are not a recovery strategy until restoration has been tested. A backup may be incomplete, corrupted, inaccessible or incompatible with the intended database version. Recovery tests should measure actual RTO and RPO, validate data integrity and record unexpected dependencies. A runbook should describe technical steps and communication responsibilities. Failover without coordination can produce split-brain behavior, in which multiple systems believe they are authoritative. Fencing, quorum mechanisms and clearly defined authority help prevent this condition. Schema Migration and Change ControlSchema migration is the controlled modification of database structures, including tables, columns, indexes, constraints, procedures and data transformations. In modern delivery environments, migrations are treated as code. Each migration has an identifier, a defined purpose, dependencies, test evidence and a deployment order. A safe pattern for a potentially disruptive change is the expand-and-contract approach. First, the schema is expanded in a backward-compatible way—for example, by adding a nullable column. The application is then changed to write to the new structure while retaining compatibility with the old structure. Data is backfilled in controlled batches, and the new path is validated. Only after dependent services have migrated is the old column or table removed. Large data transformations should be resumable and observable. A single transaction involving millions of rows may create long locks, excessive log growth and difficult rollback. Batching, throttling and checkpoints reduce operational risk. Before a migration, the team should estimate execution time, lock behavior, storage growth and replication effects. Version control provides a history of intended database state. However, a migration file alone is not sufficient. Teams also need automated tests, code review, environment promotion, backup or recovery plans and a decision about whether rollback means reversing the schema or restoring data. Some data transformations cannot be safely reversed, so forward-compatible corrective migrations are often preferable to destructive rollback. Testing Database ChangesDatabase testing should occur at several levels. Unit tests can verify stored procedures, constraints or transformation logic. Integration tests examine interaction between the application and database. Migration tests apply changes to a realistic schema and verify both old and new application versions. Performance tests assess query plans, concurrency, lock contention and behavior at representative scale. Recovery tests validate backup restoration and failover. Test data requires special care. Production data may contain personal, financial or confidential information. Masking and anonymization reduce exposure, but the transformed data must still preserve relevant statistical and relational properties. Synthetic data is safer but may not reproduce production skew, unusual values or pathological relationships. A release pipeline should fail when migrations cannot be applied, tests reveal incompatible behavior, performance exceeds an agreed threshold or security checks detect unsafe configuration. Testing cannot prove the absence of all failure, but it reduces uncertainty and makes risk visible before production deployment. Version Control, Containers and Infrastructure as CodeVersion control should include migration scripts, database configuration, monitoring rules, infrastructure definitions, deployment manifests and operational runbooks. A repository creates traceability: the organization can determine who proposed a change, what was reviewed and which version was deployed. Containers package an application and its dependencies in a portable unit. They are useful for development, testing and repeatable pipeline execution. Stateful production databases require additional design because data must survive container replacement. Persistent volumes, backup integration, storage performance, network identity and failure handling must be explicit. Containers do not automatically provide high availability. Infrastructure as code (IaC) defines infrastructure through declarative or programmable files. It can provision networks, compute resources, storage, identity permissions, replicas and monitoring consistently. IaC supports review, reproducibility and environment comparison. Its risks include accidental destructive changes, state-file exposure, provider differences and excessive privileges. Plans should be reviewed before application, and sensitive state must be protected. A mature DataOps pipeline may include the following flow: commit a migration; perform static validation; build a disposable test database; execute unit and integration tests; scan for secrets; review the change; deploy to staging; run performance and migration checks; obtain an approval where required; deploy progressively to production; and monitor the resulting indicators. Automation should support judgment, not conceal it. Patching, Security and GovernancePatching addresses defects, vulnerabilities, compatibility issues and improvements in database software and its dependencies. A patching policy should classify vulnerabilities by severity, identify maintenance windows, define testing requirements and specify emergency procedures. Delaying every patch increases exposure; applying every patch immediately without testing may interrupt service. Risk-based prioritization is necessary. Security administration includes least-privilege access, strong authentication, encryption in transit and at rest, network segmentation, audit logging, secret rotation and separation of duties. Administrative activity should be attributable to an individual or controlled service identity. Access should be reviewed periodically and removed when no longer required. Governance determines who may create, modify, export or delete data and how those actions are recorded. Regulatory obligations may require retention, data-subject rights, breach notification, residency controls or demonstrable access management. Data classification helps determine handling requirements. Operational convenience is not a justification for exposing personal data in test environments or logs. Incident Management and LearningAn incident is an event that negatively affects service, data integrity, security or agreed performance. Incident management begins with detection and triage. The responder establishes impact, scope, severity and a communication channel. Immediate actions may include limiting traffic, disabling a faulty release, failing over, restoring a service or stopping a damaging job. A useful incident process separates restoration from root-cause investigation. The first priority is to reduce harm and restore a safe service. After stabilization, evidence is preserved and a timeline is constructed. Root-cause analysis should examine technical, procedural and organizational contributors rather than assigning blame to one individual. A blameless post-incident review asks what conditions made the failure possible, why controls did not detect it earlier and which improvements will reduce recurrence. Actions should have owners, deadlines and measurable completion criteria. Repeated incidents often indicate systemic weaknesses such as undocumented dependencies, insufficient testing, alert fatigue or unclear authority. Illustrative Case: The Failed Billing MigrationBackground. A fictional online subscription company operated a relational database for customer accounts, invoices and payments. Its billing service needed to replace a short integer status code with a more descriptive status value. The company released weekly application updates and used an asynchronous standby database. Situation. Engineers added a new status column and began a full-table backfill during business hours. The update acquired locks, generated substantial transaction logs and caused replication lag. The application experienced increasing latency, payment requests timed out and the standby could not immediately support failover. Monitoring detected CPU utilization but did not alert on replication lag or user-visible latency. Analysis. The migration had been reviewed as a small schema change, but the team had not estimated row count, lock duration or log growth. There was no representative-scale rehearsal, no throttling and no explicit migration owner. The recovery plan assumed that the standby was current, although its lag made the assumed RPO unattainable. Approach. The team stopped the backfill, disabled new writes to the affected path and allowed the database to catch up. A compatibility release restored the previous application behavior. Engineers then rehearsed the migration on a masked production-sized copy, introduced batched and resumable updates, added replication-lag and request-latency alerts, and used the expand-and-contract pattern. The revised migration was executed during a controlled window with a documented rollback and communication plan. Outcome. Service was restored without confirmed data loss, although the incident caused delayed payments and required customer communication. The organization added migration checklists, mandatory scale testing, recovery validation and post-deployment observation periods. Learning points. A change that is syntactically simple may be operationally large. High availability depends on replica currency, not merely the existence of a replica. Monitoring must represent customer impact, and database changes must be treated as production software. Challenges, Trade-offs and Common MistakesOperational database work involves unavoidable trade-offs. Stronger durability may increase latency; longer retention improves investigation but raises cost and privacy exposure; aggressive automation increases speed but can amplify a faulty change; and extensive redundancy improves resilience but complicates consistency and operations. Common mistakes include treating backups as automatically valid, measuring only CPU and memory, ignoring storage and log growth, changing production manually, placing secrets in migration files, assuming rollback is always possible, failing to test failover, using production personal data in development, and confusing a successful deployment with a successful service outcome. Another mistake is excessive reliance on a single expert. Documentation, pair reviews, runbooks and rehearsals distribute operational knowledge. Teams should also avoid alert overload. An alert without a clear action trains responders to ignore warnings. Emerging Directions in Database OperationsCloud-managed databases increasingly provide automated backups, patching, scaling, observability and multi-region capabilities. These features reduce administrative effort but do not remove responsibility for architecture, cost, access control or recovery testing. Serverless and elastic databases introduce new pricing and performance behavior that must be monitored carefully. Artificial intelligence is being applied to anomaly detection, query optimization suggestions, capacity forecasting, incident correlation and natural-language assistance. Such tools can accelerate diagnosis, but recommendations require validation. An automated system that changes indexes, resources or failover state without appropriate safeguards may create new risks. Explainability, auditability and human approval are particularly important for high-impact actions. Data contracts, lineage systems and policy-as-code are also becoming important in DataOps. They make expectations about schema, ownership, quality and permitted use more explicit. The broader trend is toward treating data platforms as products with defined consumers, reliability targets, documentation and continuous improvement. Best Practices for Professional OperationA reliable database practice generally follows these principles: - define RPO, RTO, SLO and ownership before selecting technology;
- manage schema, configuration and infrastructure through version control;
- make deployments repeatable and test them at realistic scale;
- monitor customer-visible indicators as well as internal resources;
- test restoration and failover rather than merely creating backups;
- use backward-compatible, observable and resumable migrations;
- apply least privilege, encryption and controlled secret management;
- automate routine actions while retaining approvals for high-risk changes;
- document runbooks and rehearse incident procedures; and
- conduct blameless reviews that produce tracked engineering improvements.
Chapter SummaryDatabase administration is a lifecycle discipline involving deployment, configuration, security, performance, reliability, recovery and controlled change. Reliability engineering gives operational work measurable targets through SLIs, SLOs, error budgets, RPO and RTO. Monitoring and capacity planning connect technical signals with service impact. High availability and disaster recovery require explicit choices about replication, failover, backups and tested restoration. DataOps applies version control, automation, testing, infrastructure as code and continuous feedback to database and data-platform operations. Safe schema migration depends on compatibility, staged change, realistic testing and careful handling of irreversible transformations. Containers and IaC improve reproducibility but do not eliminate state, security or governance concerns. Finally, incident management should restore service quickly and convert failures into organizational learning. Key TermsSLO: A target level of service used to manage reliability. SLI: A measurable indicator of actual service performance. RPO: The maximum acceptable period of data loss after a failure. RTO: The maximum acceptable time required to restore service. Error budget: The permitted unreliability implied by an SLO. High availability: Design that minimizes service interruption during failures. Disaster recovery: Processes and resources for restoring service after major disruption. Replication: Maintaining copies of database data on another system. Replication lag: The delay between changes on a primary database and a replica. Schema migration: A controlled change to database structures or database-related logic. Expand-and-contract: A migration pattern that introduces compatible structures before removing old ones. DataOps: Operational practices applying automation, testing and collaboration to data delivery. Infrastructure as code: Defining infrastructure through versioned, executable specifications. Observability: The ability to understand system behavior from metrics, logs and traces. Capacity planning: Forecasting and providing resources for expected workload and growth. Runbook: A documented procedure for routine or incident-related operations. Failover: Transferring service from a failed or impaired system to another system. Blameless post-incident review: A learning-oriented examination of contributing conditions without personal blame. Least privilege: Granting only the access necessary to perform an authorized task. Review QuestionsShort Answer Questions1. Distinguish between RPO and RTO. 2. What is the purpose of an error budget? 3. Why must database backups be restoration-tested? 4. Define replication lag and explain one operational consequence. 5. What is meant by infrastructure as code? Long Answer Questions1. Explain how monitoring, alerting and capacity planning work together in database operations. 2. Discuss the design considerations for high availability and disaster recovery. 3. Describe the expand-and-contract method for schema migration and explain why it reduces risk. 4. Explain how version control, testing and deployment automation support DataOps. 5. Discuss the responsibilities of a database team during and after a production incident. Analytical / Application Questions1. A company has an RPO of five minutes but its only replica is usually twenty minutes behind. Analyze the reliability gap and recommend corrective actions. 2. A migration adding a non-nullable column must be deployed while two application versions are running. Design a compatible deployment sequence. 3. A database shows normal CPU utilization but users report slow transactions and payment failures. Identify the additional indicators and investigation steps that should be used. 22. Multiple Choice Questions with AnswersQuestion 1A company can tolerate at most ten minutes of committed data loss but requires service restoration within one hour. Which pair correctly represents these requirements? A. RPO of one hour and RTO of ten minutes B. RPO of ten minutes and RTO of one hour C. SLO of ten minutes and RPO of one hour D. RTO of ten minutes and SLO of one hour Correct Answer: B. RPO of ten minutes and RTO of one hour Question 2Which migration sequence best represents the expand-and-contract approach? A. Drop the old column, add the new column, then update the application B. Stop the application, rewrite all data, and restart it with the new schema C. Add a compatible structure, deploy compatible application code, backfill and validate, then remove the old structure D. Change the schema directly in production and rely on failover if it fails Correct Answer: C. Add a compatible structure, deploy compatible application code, backfill and validate, then remove the old structure Question 3Why is an asynchronous replica potentially unsuitable for a strict zero-data-loss requirement? A. It cannot store indexes B. It may not have received the latest committed transactions when the primary fails C. It always has higher latency than synchronous replication D. It cannot be used for read operations Correct Answer: B. It may not have received the latest committed transactions when the primary fails Question 4Which alert is most closely connected to customer-visible database impact? A. CPU remains at 75 percent for one minute B. A configuration file changed C. Request latency and failed transactions exceed defined thresholds D. The database process has existed for thirty days Correct Answer: C. Request latency and failed transactions exceed defined thresholds Question 5What is the principal purpose of infrastructure as code? A. To eliminate the need for database backups B. To define and reproduce infrastructure through versioned specifications C. To guarantee that every deployment is risk-free D. To replace all operational decision-making with scripts Correct Answer: B. To define and reproduce infrastructure through versioned specifications Question 6A team has created nightly backups but has never restored one. What is the most important conclusion? A. The backups are automatically valid because they completed successfully B. The team has evidence of backup creation but not of recoverability C. Restoration testing is unnecessary when replication is enabled D. The database has a guaranteed RTO equal to the backup interval Correct Answer: B. The team has evidence of backup creation but not of recoverability Question 7During an incident, what should generally receive the first priority? A. Assigning personal blame for the change B. Writing the final post-incident report C. Reducing harm and restoring a safe service D. Deleting logs to reduce storage consumption Correct Answer: C. Reducing harm and restoring a safe service Question 8Which practice best protects sensitive production information in test environments? A. Copying the full production database to every developer laptop B. Removing database constraints from the test copy C. Using masked, anonymized or synthetic data appropriate to the test purpose D. Storing production passwords in the test migration script Correct Answer: C. Using masked, anonymized or synthetic data appropriate to the test purpose Question 9Why can a containerized database still require careful state management? A. Containers cannot run database software B. Container replacement may remove data unless persistent storage and recovery are designed C. Containers automatically disable replication D. Container images always contain confidential data Correct Answer: B. Container replacement may remove data unless persistent storage and recovery are designed Question 10A migration causes long locks and replication lag because it updates millions of rows in one transaction. Which improvement is most appropriate? A. Increase the number of application connections without limit B. Remove monitoring during the migration C. Use observable, throttled batches with checkpoints and a rehearsed execution plan D. Disable transaction logging permanently Correct Answer: C. Use observable, throttled batches with checkpoints and a rehearsed execution plan
|