Database Administration, Quality, and GovernanceIntroductionA database is not valuable merely because it stores data. It must remain available, accurate, secure, recoverable, understandable, and lawful throughout its life. Database administration therefore connects technical operations with organisational responsibility. Administrators configure database platforms, manage identities and permissions, protect information, test recovery procedures, monitor service quality, and maintain documentation. Governance establishes the policies and decision rights that determine how data may be collected, used, shared, retained, and deleted. For full-stack developers, database administration is not an isolated specialist activity. Application design affects backup requirements, transaction behaviour, data quality, security exposure, and operational cost. Developers who understand administration can design systems that are easier to operate and less likely to cause data loss or regulatory harm. Learning ObjectivesBy the end of this chapter, you should be able to: - describe the responsibilities of database administration and governance;
- configure databases using secure and repeatable practices;
- manage users, roles, privileges, and authentication;
- distinguish backup types and design a practical restore strategy;
- explain replication, high availability, and disaster recovery;
- define data-quality rules and operational metrics;
- plan data retention, archival, deletion, and documentation;
- identify compliance, ethical, and stewardship obligations; and
- use evidence and metrics to support operational decisions.
1. Database Administration as an Operational DisciplineDatabase administration (DBA) is the systematic management of database software, data structures, access, performance, availability, and recovery. In a small organisation, one person may perform DBA tasks alongside development. In a larger organisation, responsibilities may be divided among database administrators, site-reliability engineers, security teams, data stewards, compliance officers, and application teams. A useful distinction is between database operations and data governance. Operations concerns whether the technical service works: Is the database running? Can it process transactions? Can it be restored? Governance concerns whether the organisation is using data appropriately: Is the data accurate? Is access justified? Is retention lawful? Who is accountable for decisions? A database service should be managed across several dimensions: | Dimension | Central question | Typical evidence |
|---|
| Availability | Can authorised users obtain service when needed? | Uptime, outage records | | Integrity | Is data correct and internally consistent? | Constraints, validation results | | Confidentiality | Is information protected from unauthorised disclosure? | Access logs, permission reviews | | Recoverability | Can service and data be restored after failure? | Restore tests, recovery times | | Performance | Does the system respond within acceptable limits? | Latency, throughput | | Compliance | Are legal and organisational obligations met? | Policies, audit reports | | Maintainability | Can people understand and safely change the system? | Documentation, version history |
These dimensions can conflict. Strong encryption may add processing overhead; long retention may support investigations but increase privacy risk; aggressive replication may improve availability while increasing cost and operational complexity. Administration is therefore a decision-making discipline, not simply a collection of commands. 2. Configuration and Environment ManagementA sound configuration begins with a documented baseline. The baseline records the database engine and version, operating system, storage arrangement, network endpoints, character encoding, time-zone policy, connection limits, logging settings, backup destinations, and monitoring arrangements. Configuration should be version-controlled or managed through approved automation rather than changed informally on a production server. 2.1 Development, testing, and productionSeparate environments reduce the risk that experimentation will damage live data. Development environments support rapid change; test environments provide controlled verification; production environments serve real users. Data copied from production into development must be masked, anonymised, or replaced with synthetic data where personal or confidential information is present. Configuration differences should be intentional and documented. For example, a test environment may use smaller storage and lower connection limits, but it should retain equivalent security controls and representative database behaviour. Environment-specific values such as passwords, tokens, and connection strings should be supplied through secure secret-management systems, not embedded in source code. 2.2 Change controlA production change should have a purpose, owner, risk assessment, implementation plan, validation step, and rollback or recovery plan. Schema migrations should be incremental and repeatable. A migration that adds a nullable column is often safer than one that immediately rewrites a large table or removes a column used by an older application version. Backward-compatible changes allow application and database versions to coexist during deployment. Configuration drift occurs when servers that should be equivalent gradually acquire different settings. Automated configuration management, infrastructure-as-code, standard images, and periodic audits reduce drift. Every important change should be recorded with who made it, when it occurred, what was changed, and what evidence demonstrates success. 3. Identity, Roles, and Access ControlThe principle of least privilege states that a user or process should receive only the permissions necessary for its authorised task, for only as long as necessary. This principle limits the damage caused by mistakes, compromised credentials, or malicious insiders. A practical access model separates: - human identities, associated with named individuals and strong authentication;
- service identities, used by applications and automated jobs;
- roles, which group permissions according to responsibilities; and
- privileges, such as selecting, inserting, updating, deleting, or executing a stored procedure.
Role-based access control is generally easier to review than assigning permissions directly to individuals. A web application might have a role that can read product data and execute approved order procedures, but cannot alter database structure or read payroll records. Administrative accounts should be separate from ordinary user accounts, and shared accounts should be avoided because they weaken accountability. Access management includes the complete identity lifecycle: - approve access based on a documented business need;
- create the account or assign the role;
- authenticate the identity securely;
- monitor use and investigate anomalies;
- review privileges periodically; and
- remove or suspend access when the role ends.
Authentication proves who or what is connecting; authorisation determines what that identity may do. Encryption protects data during transmission and, where appropriate, at rest, but encryption does not replace access control. Audit logs should record significant authentication, privilege, administrative, and data-access events while avoiding unnecessary exposure of sensitive values. 4. Backup, Restore, and Recovery PlanningA backup is a recoverable copy of data or database state. A restore is the technical act of reconstructing data from backups. A recovery plan is broader: it defines priorities, responsibilities, procedures, communication, and decisions during disruption. Common backup forms include: - full backup: a complete copy of the selected database;
- differential backup: changes since a reference full backup;
- incremental backup: changes since the most recent relevant backup;
- transaction-log or write-ahead-log backup: recorded changes that may support point-in-time recovery; and
- snapshot: a storage-level point-in-time representation, subject to the consistency guarantees of the platform.
A backup is not trustworthy merely because a job reports success. It must be protected from accidental deletion and ransomware, stored with appropriate geographic or environmental separation, encrypted when necessary, and periodically restored in a controlled test. Two planning measures are especially important: - Recovery Point Objective (RPO): the maximum acceptable amount of data loss measured in time. An RPO of 15 minutes means that, after a severe failure, the organisation aims to lose no more than approximately 15 minutes of committed changes.
- Recovery Time Objective (RTO): the target maximum time to restore an acceptable service level after disruption.
RPO and RTO are requirements, not guarantees. Achieving them depends on backup frequency, network capacity, storage, automation, staff availability, dependencies, and testing. A simple availability calculation is useful when its assumptions are understood. If a service is available for time Ta during an observation period of total time T, then: Availability = Ta ÷ T × 100% Here both times must use the same unit, such as minutes. This calculation treats the observation period and outage classification consistently; it does not by itself explain the causes of downtime or distinguish planned from unplanned interruption. For example, if a monthly service window is 43,200 minutes and unplanned downtime is 43.2 minutes, service availability is (43,200 − 43.2) ÷ 43,200 × 100% = 99.9%. The result is a measurement, not a promise that every future month will have the same performance. A restore runbook should specify the incident trigger, recovery authority, backup selection, dependency checks, restoration sequence, validation queries, application reconnection, communication, and post-incident review. Validation should include row counts where meaningful, checksums or consistency checks, application smoke tests, and confirmation that restored data is at an acceptable point in time. 5. Replication, Availability, and Disaster RecoveryReplication maintains copies of data on more than one database instance. A primary instance may accept writes while one or more replicas receive changes. Replication can support read scaling, reporting, failover, or geographic resilience, but it is not automatically a backup. A corrupted or maliciously deleted record may be replicated to every copy. Replication modes differ. Synchronous replication generally requires confirmation from another participant before a transaction is considered committed, reducing potential data loss but increasing latency and dependence on network health. Asynchronous replication allows the primary to proceed without waiting, improving responsiveness but creating a replication lag and a possible loss window during primary failure. High availability (HA) aims to reduce service interruption through redundancy and controlled failover. Disaster recovery (DR) addresses larger failures such as regional outages, destructive incidents, or loss of an entire operating environment. A robust design considers: - failure detection and false alarms;
- election or designation of a replacement primary;
- preservation of data consistency;
- client redirection and connection handling;
- split-brain prevention;
- recovery of dependent services;
- human approval requirements; and
- regular failover testing.
A system with multiple servers but no tested failover procedure may have redundancy without dependable availability. Conversely, a single database with excellent backups may have good recoverability but poor short-term availability. 6. Data Quality and ValidationData quality is fitness for an intended use. Common dimensions include accuracy, completeness, consistency, timeliness, validity, uniqueness, and conformity to required formats. Quality is contextual: a postal address may be complete enough for analysis but not accurate enough for delivery. Validation should occur at multiple layers. User interfaces can provide immediate feedback, application services can apply business rules, and database constraints provide a final integrity boundary. Database-level controls may include primary keys, foreign keys, unique constraints, non-null requirements, check constraints, and controlled domains. Constraints should not be treated as a substitute for thoughtful application design; they are complementary controls. A quality rule should identify the field or relationship, the accepted condition, the detection method, the responsible owner, and the response to failure. For example, an order total should not be negative; an order’s customer identifier should refer to an existing customer; and an email field should follow the organisation’s accepted syntax if email is required. A basic completeness rate can be calculated as: Completeness = (Number of required values present ÷ Number of required values expected) × 100% The numerator and denominator must refer to the same population and period. If 9,700 of 10,000 required values are present, completeness is 97%. This metric does not prove that the present values are accurate. A defect rate may be expressed as: Defect rate = Number of records failing a defined rule ÷ Number of records evaluated The result is a proportion; multiply by 100 to express it as a percentage. Teams should define sampling, rule versions, severity, and time period, otherwise comparisons can be misleading. Data profiling helps discover unexpected nulls, duplicate values, unusual ranges, invalid codes, and distribution changes. Data-quality dashboards should support action rather than encourage metric manipulation. A falling defect rate may indicate improvement, but it may also indicate that monitoring rules were removed or that fewer records were evaluated. 7. Monitoring and Operational MetricsMonitoring should connect technical observations to service objectives. Useful measures include query latency, throughput, error rate, connection utilisation, storage growth, lock waits, cache behaviour, replication lag, backup duration, restore-test success, and failed authentication attempts. For a set of response times, the mean is: Mean response time = ∑xᵢ ÷ n Here xᵢ is an individual response time, n is the number of observations, and all response times must use the same unit. The mean can be distorted by a small number of very slow requests, so percentiles such as the 95th percentile are often more informative for user experience. A metric must have a defined collection method, time window, threshold, and owner. Operational metrics should be interpreted together. High CPU may result from legitimate growth, inefficient queries, or an attack. Low database latency is not sufficient if requests are failing because of authorisation errors. A useful incident review asks what users experienced, which control failed, how quickly the issue was detected, how quickly service was restored, and what preventive action is justified. 8. Data Lifecycle Management and DocumentationData lifecycle management governs data from creation through use, sharing, archival, and disposal. A typical lifecycle is: - collect or create data for a defined purpose;
- classify its sensitivity and business value;
- store and use it under approved controls;
- retain it for the required period;
- archive it when active use declines; and
- securely delete or irreversibly anonymise it when retention ends.
Retention should not be indefinite by default. It must balance legal obligations, business needs, historical value, storage cost, privacy, and the risk that old information will be misused. Legal holds or investigations may suspend ordinary deletion. Deletion from a primary table may not immediately remove copies from backups, replicas, caches, exports, or logs; the organisation therefore needs a documented deletion and expiry policy. Essential documentation includes a data dictionary, entity-relationship model, schema migration history, ownership register, classification scheme, access matrix, backup schedule, restore runbook, recovery dependencies, monitoring definitions, incident procedures, and records of review. Documentation should be maintained as part of operational work, not written only after a failure. 9. Governance, Compliance, and Responsible StewardshipGovernance assigns accountability. A data owner makes decisions about business use and risk; a data steward helps maintain definitions and quality; a technical administrator implements controls; and a privacy or compliance function interprets applicable obligations. In smaller organisations, one person may hold several roles, but the decisions and responsibilities should still be explicit. Important governance practices include data classification, purpose limitation, access review, separation of duties, change approval, auditability, incident response, vendor assessment, and periodic policy review. Applicable laws vary by jurisdiction and sector, so technical teams must not assume that a generic checklist establishes compliance. Requirements may concern personal data, financial information, health information, payment records, breach notification, cross-border transfer, or records retention. Responsible stewardship also includes ethical questions that may exceed legal minimums. Data should not be collected simply because it is technically possible. People should receive understandable information about important uses of their data. Automated decisions should be monitored for unfair impacts, inappropriate proxies, and unjustified exclusion. Administrators should avoid exposing sensitive values in logs, test datasets, screenshots, or support tickets. Artificial intelligence increases the importance of governance. Training and retrieval datasets require provenance, quality checks, access controls, retention rules, and evaluation for leakage or bias. An AI system connected to a production database should normally use constrained, auditable interfaces rather than unrestricted administrative credentials. Generated queries and automated remediation require validation, approval boundaries, and logging. 10. An Illustrative Case: Community Clinic Appointment SystemBackgroundA fictional community clinic operates an appointment database used by receptionists, clinicians, billing staff, and a patient portal. The system contains personal and health-related information. It experiences occasional outages, duplicate patient records, and uncertainty about whether backups can be restored. ProblemAll staff use broadly privileged accounts. The nightly backup job reports completion but has never been restored in a test. A reporting replica is used as though it were a backup. Patient data has been copied into a developer laptop for troubleshooting. Management has no agreed RPO or RTO. AnalysisThe clinic faces confidentiality risk from excessive privileges and uncontrolled copies. It faces integrity risk from duplicate records and weak validation. It faces availability and recoverability risk because replication does not protect against logical corruption and the restore process is untested. The absence of service objectives makes it impossible to decide whether current controls are adequate. Approach and solutionThe clinic first classifies the data and assigns a business owner, technical custodian, and privacy contact. It creates separate roles for reception, clinical use, billing, reporting, and administration. Service accounts receive only the permissions required by each application function, and administrative access requires stronger authentication and review. The database receives constraints for patient identifiers, appointment references, and permitted status values. A duplicate-detection process is introduced, with human review before merging patient records. Development receives synthetic data rather than live records. The clinic defines an RPO of 15 minutes and an RTO of two hours for appointment services, subject to budget approval. It combines full backups with transaction-log protection, stores encrypted copies separately from the production environment, and performs a scheduled restore test. The reporting replica remains useful for reporting but is explicitly excluded from the backup definition. Monitoring records backup success, restore-test results, replication lag, failed logins, storage growth, and appointment-service latency. A runbook identifies who declares an incident, who approves failover, how restored data is validated, and how staff and patients are informed. OutcomeThe clinic gains measurable recovery capability, more defensible access decisions, improved duplicate detection, and reduced exposure of sensitive information. It also discovers during a restore test that one required configuration file was not included in the original recovery procedure. The test therefore prevents a future failure rather than merely confirming an optimistic assumption. Learning pointsThe case demonstrates that administration is a system of mutually supporting controls. Replication, backups, permissions, constraints, monitoring, documentation, and governance solve different problems. No single control provides complete protection. 11. Challenges, Limitations, and Best PracticesDatabase administration involves unavoidable trade-offs. Automation can accelerate safe operations but can also spread an incorrect configuration quickly. Encryption can protect confidentiality but creates key-management responsibilities. Extensive logging supports investigation but may increase storage cost and privacy exposure. Strict constraints improve integrity but may reject imperfect data that requires a defined exception process. Recommended practices for a certificate-level practitioner are: - use named accounts and least privilege;
- keep development, test, and production environments separate;
- document configuration and changes;
- test backups by restoring them, not merely checking job status;
- treat replicas as availability or reporting mechanisms unless backup properties are proven;
- enforce important integrity rules in the database;
- measure quality with clearly defined populations and rules;
- review access and retention periodically;
- protect secrets and sensitive test data; and
- practise incident and recovery procedures with relevant staff.
The most mature teams learn from near misses as well as incidents. A blameless technical review should still assign owners and deadlines for corrective actions. Governance is effective when it changes behaviour and produces evidence, not when it exists only as a policy document. Chapter SummaryDatabase administration combines configuration, access management, performance monitoring, backup and restore, replication, availability planning, and documentation. Governance adds accountability for data quality, lawful and ethical use, retention, security, and compliance. Least privilege, environment separation, controlled change, tested recovery, layered validation, and explicit ownership are foundational practices. RPO describes tolerable data loss in time, while RTO describes the target time to restore service. Replication may improve availability but is not automatically a backup. Data-quality metrics require defined rules and populations, and operational metrics must be interpreted in context. Lifecycle management ensures that data is collected for a purpose, retained appropriately, and securely deleted or anonymised when no longer required. Responsible stewardship extends beyond technical capability to privacy, fairness, transparency, and accountable use of automation and AI. Key TermsDatabase administration: The operational management of database systems, data, access, performance, and recovery. Data governance: Organisational decision-making, accountability, and policies for managing data. Least privilege: Granting only the access necessary for an authorised task. Role-based access control: Assigning permissions through roles associated with responsibilities. Authentication: Verifying the identity of a user or service. Authorisation: Determining what an authenticated identity may do. Full backup: A complete copy of selected database data. Incremental backup: A copy of changes since the relevant previous backup. Recovery Point Objective (RPO): The maximum acceptable amount of data loss expressed as time. Recovery Time Objective (RTO): The target time for restoring an acceptable service level. Replication: Maintaining data copies on multiple database instances. High availability: Designing systems to reduce service interruption through redundancy and failover. Data integrity: Accuracy, consistency, and validity of data and its relationships. Data quality: Fitness of data for an intended use. Data steward: A person responsible for helping maintain data definitions, quality, and appropriate use. Data lifecycle: The stages from data creation and use through retention and disposal. Configuration drift: Unintended divergence between systems that should have equivalent settings. Audit trail: A record of relevant actions, events, identities, and changes. Data classification: Categorising data according to sensitivity, value, or handling requirements. Restore test: A controlled demonstration that a backup can be used to reconstruct a usable database. Review QuestionsShort Answer Questions- What is the difference between database operations and data governance?
- Define RPO and RTO.
- Why is a replica not automatically a backup?
- State two dimensions of data quality.
- What does least privilege require?
Long Answer Questions- Explain how roles, privileges, authentication, and auditing work together in a secure access-control design.
- Compare full, incremental, and transaction-log backups, including circumstances in which each may be useful.
- Explain why restore testing is necessary even when backup jobs report successful completion.
- Describe how a database lifecycle policy can balance business value, privacy, compliance, and storage cost.
- Discuss the relationship between replication, high availability, and disaster recovery.
Analytical / Application Questions- A service has 43,200 minutes in a monthly observation period and experiences 43.2 minutes of unplanned downtime. Calculate its availability and explain one limitation of the result.
- Design an access model for an online shop containing customer, order, payment, and product data. Identify suitable roles and permissions, and justify where separation of duties is needed.
- A company discovers that its backups have never been restored, its reporting replica is two hours behind, and developers use production extracts. Prioritise the first five corrective actions and explain your reasoning.
Multiple Choice Questions with AnswersQuestion 1Which statement best describes the principle of least privilege? A. Every employee receives administrative access for convenience B. Each identity receives only the access needed for its authorised task C. Users may access any data after authenticating D. Permissions are assigned permanently to avoid disruption Correct Answer: B. Each identity receives only the access needed for its authorised task Question 2What does an RPO primarily specify? A. The target time to restart a server B. The maximum acceptable amount of data loss measured in time C. The number of database replicas required D. The maximum number of users Correct Answer: B. The maximum acceptable amount of data loss measured in time Question 3Why is replication not automatically a backup? A. Replicas cannot contain indexes B. Replicas are always read-only C. Logical corruption or deletion may be copied to every replica D. Replication prevents all failover Correct Answer: C. Logical corruption or deletion may be copied to every replica Question 4Which control most directly enforces that a child record refers to an existing parent record? A. Foreign key constraint B. Password policy C. Storage snapshot D. Query latency alert Correct Answer: A. Foreign key constraint Question 5A system has 10,000 required values, of which 9,700 are present. What is its completeness rate? A. 0.97% B. 3% C. 97% D. 103% Correct Answer: C. 97% Question 6What is the main purpose of a restore test? A. To increase the number of database users B. To demonstrate that a backup can reconstruct a usable database C. To replace access reviews D. To remove the need for replication Correct Answer: B. To demonstrate that a backup can reconstruct a usable database Question 7Which statement correctly distinguishes authentication from authorisation? A. Authentication determines permissions; authorisation verifies identity B. Authentication verifies identity; authorisation determines permitted actions C. They are two names for encryption D. Authorisation is required only for backups Correct Answer: B. Authentication verifies identity; authorisation determines permitted actions Question 8Which practice best reduces configuration drift? A. Making undocumented manual changes on each server B. Using version-controlled configuration and repeatable automation C. Disabling monitoring D. Sharing one administrator password Correct Answer: B. Using version-controlled configuration and repeatable automation Question 9A service window is 43,200 minutes and downtime is 43.2 minutes. What is the approximate availability? A. 90% B. 97% C. 99% D. 99.9% Correct Answer: D. 99.9% Question 10Which statement about data lifecycle management is most appropriate? A. All data should be retained indefinitely B. Data should be collected, used, retained, and disposed of according to defined needs and obligations C. Deletion from a primary table always removes every copy immediately D. Retention decisions are purely technical Correct Answer: B. Data should be collected, used, retained, and disposed of according to defined needs and obligations
|