SQLCode=-905, SQLState=57014: File System Full Error Fix in 3 Steps

Troubleshooting

SQLCode=-905, SQLState=57014: File System Full Error Fix in 3 Steps

SQLCode=-905, SQLState=57014 hit me like a brick wall last week during a critical batch job. ⚡ The error means your database can't write to disk because the file system is full—simple as that, but the solutions aren't always obvious.

I spent hours chasing permissions and locks before realizing the root cause was a 98% disk utilization on the data directory.

The fix isn't just about freeing space—it's about preventing it. First, verify disk usage with df -h (Linux) or CHKDSK (Windows). Then check for locked tables with db2 list applications (DB2) or IBM i WRKDBF (AS/400).

Often, the culprit is a runaway transaction or a misconfigured backup job hogging space. I caught one case where a 20GB log file was stuck because of an unclosed connection.

Here's the three-step fix:

  1. Free space by archiving old logs or deleting temp files,
  2. Grant write permissions to the database user if needed (use GRANT UPDATE ON TABLE TO USER), and
  3. Run REORG TABLE on suspect tables to reclaim space.

My team uses this exact sequence during peak hours—it's saved us from production outages more times than I can count.

Works across DB2, IBM i, and similar databases. The key is checking the obvious first: disk space, permissions, and active transactions. Once you've cleared those, the error disappears faster than you'd expect. Let's walk through the exact commands that fixed it for my team.

Root Causes Of Storage Limits

The SQLCODE=-905, SQLState=57014 error is a clear signal from your database that the underlying file system has reached its storage capacity. This isn’t just a random glitch—it’s a direct result of how databases interact with their storage environments.

Let’s break down the most common reasons why this happens, so you can pinpoint the exact issue in your setup.

###

📂 Insufficient Disk Space Allocation

This is the most straightforward cause: your database files (data files, logs, or temp files) have simply filled up the available disk space.

Databases like IBM Db2, Oracle, or SQL Server rely on file systems to store their data, and when those files grow beyond their allocated limits, operations fail with errors like SQLCODE=-905.

  • Data file growth: Tables, indexes, or temporary tables may have expanded beyond their initial size due to new data inserts, updates, or large transactions.
  • Log file overflow: Transaction logs (especially in Db2) can fill up quickly if they’re not managed properly, especially during high-volume operations.
  • Temp space exhaustion: Complex queries, sorting operations, or temporary tables can consume massive temporary storage, triggering this error if the temp space is constrained.

Pro Tip: 💡 Use tools like df -h (Linux) or dir (Windows) to check disk space before diving into database logs. If the disk is full, the issue is resolved at the OS level.

###

🔄 Automatic File Growth Misconfigurations

Databases often have built-in mechanisms to automatically expand file sizes when needed. However, if these settings are misconfigured—or if the file system itself has strict limits—growth operations can fail silently, leaving you with a full disk and no room for new data.

  • Fixed-size files: If database files (e.g., Db2’s db2move or Oracle’s datafile) are set to a fixed size with no auto-growth, they won’t expand when data exceeds capacity.
  • Incremental growth limits: Some databases allow files to grow in increments (e.g., 1GB at a time). If the increment is too small or the max size is capped, the file may never reach the needed capacity.
  • Filesystem-level restrictions: Certain file systems (like ext4 with reserved blocks or Windows NTFS with quota limits) may prevent files from growing beyond predefined thresholds.

Pro Tip: ✨ Review your database’s file growth settings. For example, in Db2, check db2 get bufferpool or db2 get database manager configuration for auto-storage settings. In SQL Server, verify MAXSIZE and AUTOGROWTH parameters.

###

🗑️ Unmanaged Data Retention Policies

Databases often accumulate "junk" data over time—orphaned logs, obsolete backups, or unused temporary files. If this debris isn’t regularly cleaned up, it can consume critical storage space, leading to the SQLCODE=-905 error.

  • Unreclaimed logs: In Db2, active logs aren’t automatically deleted until a backup or REORG operation runs. If backups are infrequent, logs can pile up.
  • Temp table remnants: Temporary tables or session-specific objects may linger if not explicitly dropped, especially in long-running transactions.
  • Backup file retention: Old backup files (e.g., .tar, .bkp, or .dmp) left on the file system can occupy significant space if not archived or deleted.

Pro Tip: 🗑️ Schedule regular maintenance:

  • Run db2 cleanup (Db2) or DBCC SHRINKFILE (SQL Server) to reclaim space.
  • Use db2advis to identify unused objects.
  • Set up automated cleanup scripts for backup files.

###

🔗 Filesystem or Storage Layer Issues

Sometimes the problem isn’t the database itself but the storage infrastructure it relies on. File systems, storage arrays, or even cloud storage buckets can impose hidden limits that trigger this error.

  • Filesystem reserved space: Many Unix-like systems reserve 5–10% of disk space for root/administrative use. If this threshold is hit, user-accessible space may appear full even if total disk usage is below 100%.
  • Storage quotas: Shared environments (e.g., cloud VMs, containerized databases) often enforce quotas. Hitting a quota limit can block further writes, causing the error.
  • Snapshot or replication overhead: Storage snapshots or replication jobs may consume hidden space, reducing available capacity for the database.

Pro Tip: 🔧 Check storage layer settings:

  • Run tune2fs -l /dev/sdX (Linux) to see reserved blocks.
  • Review cloud provider storage metrics (e.g., AWS EBS, Azure Disk).
  • Monitor LUN or volume usage in SAN/NAS environments.

Quick Fixes for Database Storage Errors

Encountering SQLCode=-905 and SQLState=57014 means your database is running out of disk space, and it’s time to act fast. Below are targeted solutions—mapped to common causes—to resolve the issue and prevent future disruptions. Follow these steps in order, starting with the most urgent fixes.

🔥 Free Up Immediate Space

If your database can’t write new data due to a full filesystem, these steps will reclaim space quickly:

1️⃣ Delete Unnecessary Log Files

Database transaction logs (like archivelog or redo logs) can bloat storage. Clean them up with:

  • Oracle:
    -- Purge archived logs older than 7 days
    SQL> ALTER SYSTEM ARCHIVE LOG ALL;

    Then manually delete files from $ORACLEBASE/oradata/<SID>/archivelog.

  • SQL Server:
    -- Shrink transaction log (use cautiously!)
    DBCC SHRINKFILE (N'YourDBLog', 100);
  • PostgreSQL:
    -- Vacuum full to reclaim space
    VACUUM FULL;

⚠️ Warning: Only shrink logs if you’re sure no active transactions are pending. For Oracle, use ALTER SYSTEM SWITCH LOGFILE; first.

2️⃣ Clear Temporary or Old Backups

Check these common culprits:

  • Database backups in /tmp or /var/tmp.
  • Old .dbf (Oracle) or .mdf (SQL Server) files in /data or C:\Program Files\...\MSSQL\DATA.
  • Log files from syslog, mysql.log, or application logs.

Run these commands to identify large files:

# Linux/macOS
du -sh /path/to/database/* | sort -h

Get-ChildItem "C:\path\to\database" | Sort-Object Length -Descending | Select-Object -First 10

🍳 Optimize Database Storage Long-Term

Once you’ve freed up space, prevent future errors with these structural fixes:

3️⃣ Adjust Database Growth Settings

Let the database manage its own space dynamically:

  • SQL Server: Set AUTOGROW for data/log files (avoid fixed sizes).
    ALTER DATABASE YourDB MODIFY FILE (NAME = 'YourDBData', SIZE = 5GB, FILEGROWTH = 10%);
  • PostgreSQL: Use tablespaces to distribute data across disks.
    CREATE TABLESPACE datats LOCATION '/new/disk/path';
  • Oracle: Enable AUTOMATIC STORAGE MANAGEMENT (ASM) if using Oracle Grid Infrastructure.

4️⃣ Archive or Purge Old Data

Use partitioning or TTL (Time-to-Live) policies to auto-delete stale data:

  • SQL Server:
    -- Partition by date and drop old partitions
    ALTER TABLE Orders SPLIT RANGE (TODATE('2023-01-01', 'YYYY-MM-DD'));
    ALTER TABLE Orders DROP PARTITION FOR (RANGE (TODATE('2020-01-01', 'YYYY-MM-DD'), TODATE('2023-01-01', 'YYYY-MM-DD')));
  • PostgreSQL:
    -- Use pgpartman for automated archiving
    CREATE EXTENSION pgpartman;
  • Oracle:
    -- Partition tables by date
    CREATE TABLE sales (
        id NUMBER,
        saledate DATE,
        amount NUMBER
    ) PARTITION BY RANGE (saledate) (
        PARTITION pold VALUES LESS THAN (TODATE('2020-01-01', 'YYYY-MM-DD')),
        PARTITION pcurrent VALUES LESS THAN (MAXVALUE)
    );

👨‍🍳 Expand Storage Capacity

If optimization isn’t enough, scale your storage:

5️⃣ Add More Disk Space

Extend your filesystem or add a new disk:

  • Linux (LVM):
    # Extend logical volume
    lvextend -L +10G /dev/mapper/vgdb-lvroot
    resize2fs /dev/mapper/vgdb-lvroot
  • Windows:
    # Extend volume via Disk Management
    Extend Volume (add unallocated space to D:)
  • Cloud (AWS/Azure):
    # Resize EBS volume
    aws ec2 modify-volume --volume-id vol-123456 --size 100

6️⃣ Move Data to Faster/Cheaper Storage

Use tiered storage (e.g., SSD for logs, HDD for archives):

  • Configure Oracle Data Guard or SQL Server Always On to offload backups to secondary storage.
  • For PostgreSQL, use WAL (Write-Ahead Log) archiving:
    wallevel = replica
    archivemode = on
    archivecommand = 'test ! -f /mnt/backup/%f && cp %p /mnt/backup/%f'

⏰ Prevention Tips to Avoid Future Errors

Stop the panic before it starts with these proactive steps:

  • 💡 Set Up Alerts: Use tools like Oracle Enterprise Manager, SQL Server Agent, or Prometheus/Grafana to monitor disk space (df -h for Linux, Get-Volume for Windows).
  • 🌡️ Schedule Regular Maintenance:
    • Run VACUUM ANALYZE (PostgreSQL) or DBMSSPACE.ANALYZESCHEMA (Oracle) weekly.
    • Purge logs automatically (e.g., Oracle’s LOG_ARCHIVE_CONFIG).
  • 🎯 Right-Size Your Database:
    • Avoid VARCHAR(MAX) or BLOB columns for large data—use external storage (e.g., Amazon S3 with SQL Server FileTable).
    • Compress tables (Oracle: ALTER TABLE compress; SQL Server: ROW COMPRESSION).
  • ✨ Automate Cleanup: Use scripts or tools like Spring Cleaning for SQL Server or pg_partman to auto-archive data.

Frequently asked questions

1

Why does SQLCODE=-905 keep appearing even after I freed up disk space?

This often happens when database files have fixed maximum sizes or when filesystem reserved space (like Unix's 5-10% root reserve) prevents growth. Check your database's auto-growth settings and verify the filesystem isn't enforcing hidden limits with commands like df -h or tune2fs -l /dev/sdX. Sometimes active transactions or locks prevent immediate space reclamation.

2

Can I safely delete database log files to fix this error?

Only if you've confirmed no active transactions are using them. For Db2, run db2 list applications first. In Oracle, use ALTER SYSTEM SWITCH LOGFILE before purging. Never delete logs during peak operations—wait until after business hours or use database-specific cleanup commands like db2 cleanup or ALTER SYSTEM ARCHIVE LOG ALL.

3

How do I check which tables are consuming the most space in Db2?

Use the db2advis tool or run these commands:

db2 "SELECT tabschema, tabname, size FROM syscat.tables ORDER BY size DESC"
For detailed analysis, try:
db2 "SELECT * FROM sysibm.sysdummy1" (this runs db2advis automatically)
Look for tables over 100MB—these are prime candidates for reorganization or archiving.
4

Will expanding my database files prevent future SQLCODE=-905 errors?

Only temporarily. To prevent recurrence, combine file expansion with proper growth settings (AUTOGROWTH in SQL Server, MAXSIZE in PostgreSQL) and implement retention policies. The root cause is usually unmanaged data growth—address that first. Set up alerts for 80% disk usage to catch issues before they block operations.

5

How does this error differ from SQLCODE=-803 (lock timeout)?

SQLCODE=-905 is purely a storage issue (full disk), while -803 indicates a locking conflict where one transaction holds resources another needs. The solutions are completely different: -905 requires freeing space, while -803 needs transaction management (like shorter queries, better isolation levels, or deadlock detection). Always check the error logs first to distinguish them.

★★★★★4.8(14 reviews)
Categories Troubleshooting