Disk / tablespace full
Symptom
'unable to extend', 'disk full', 'log file full' errors; writes are stopping.
1. Don't panic; first find what is full
Is it a datafile, the transaction log, the archive/redo area, temp or the OS disk? Cleaning the wrong place does not help. Check the disk with df -h at the OS level and the space views inside the DB.
2. Measure usage
Which tablespace/file/directory is full, and by what percentage?
Oracle
SELECT d.tablespace_name, ROUND((1-(d.alloc-NVL(f.free,0))/d.maxb)*100,1) pct_free FROM (SELECT tablespace_name, SUM(bytes) alloc, SUM(GREATEST(bytes,maxbytes)) maxb FROM dba_data_files GROUP BY tablespace_name) d LEFT JOIN (SELECT tablespace_name, SUM(bytes) free FROM dba_free_space GROUP BY tablespace_name) f ON f.tablespace_name = d.tablespace_name;PostgreSQL
SELECT datname, pg_size_pretty(pg_database_size(datname)) FROM pg_database ORDER BY 2 DESC; -- use OS df for the diskMySQL
SELECT table_schema, ROUND(SUM(data_length+index_length)/1048576,1) mb FROM information_schema.tables GROUP BY table_schema ORDER BY mb DESC;SQL Server
SELECT name, size/128.0 size_mb, size/128.0 - CAST(FILEPROPERTY(name,'SpaceUsed') AS int)/128.0 free_mb FROM sys.database_files;Redis
INFO memory # used_memory vs maxmemory3. Find the largest consumers
Identify the largest tables/segments, the largest log/archive files and unneeded old backups. Most of the time a single runaway table or accumulated archived logs are to blame.
Oracle
SELECT segment_name, bytes/1048576 mb FROM dba_segments ORDER BY bytes DESC FETCH FIRST 10 ROWS ONLY;PostgreSQL
SELECT relname, pg_size_pretty(pg_total_relation_size(relid)) FROM pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC LIMIT 10;SQL Server
SELECT TOP 10 OBJECT_NAME(object_id), SUM(reserved_page_count)*8/1024 mb FROM sys.dm_db_partition_stats GROUP BY object_id ORDER BY mb DESC;4. Reclaim space safely (quick)
For logs/archives: back them up, then purge old archived logs/backups (Oracle: RMAN delete archivelog; MSSQL: take a log backup and shrink the log). In Redis: maxmemory-policy and eviction. NEVER delete a live datafile manually; NEVER delete archived logs without a backup.
5. Grow capacity permanently
Add space to the datafile or enable autoextend (Oracle: ALTER DATABASE DATAFILE ... AUTOEXTEND ON MAXSIZE), grow the disk, add a tablespace. Fix the root cause: log rotation, archive cleanup job, retention policy.
6. Prevent recurrence
Set up disk usage alerts (80%/90% thresholds), automate archive/log cleanup and define the retention policy clearly. Avoid having to open this playbook again.