SQLCode=-905, SQLState=57014: Disk Full Error Fix in Seconds

Troubleshooting

SQLCode=-905, SQLState=57014: Disk Full Error Fix in Seconds

SQLCODE=-905 and SQLSTATE=57014 mean your database just hit a wall—literally. ⚡ I’ve seen this error freeze entire systems, but the fix is almost always simpler than it seems.

The message screams "disk full," but the real culprit could be corrupted files, permission snags, or even a sneaky storage limit you missed.

Most of the time, it’s a permissions issue or a database file that’s grown beyond its allocated space. I’ve fixed this on Db2, SQL Server, and even legacy AS/400 systems—every time, the root cause was one of three things: a full disk, a locked file, or a misconfigured backup.

The good news? You can diagnose it in under a minute.

Here’s what you’ll do: check free space with df -h, verify database logs for errors, and run a quick CHECKDB if you’re on SQL Server. For Db2, db2pd -dbname reveals hidden bottlenecks.

Once you spot the blocker, the fix is usually a CHECKPOINT, a permissions reset, or freeing up space—no reboot needed.

If the error persists, we’ll dig into backups or repair tools. But 90% of the time, this error is just your database screaming for attention—like a car running on fumes. Let’s get it back online fast.

Root Causes Of Storage Errors

When you encounter the infamous SQLCODE=-905, SQLState=57014 error, it’s almost always a sign that your database storage is under siege—like a server room packed to the brim with files, with no room for a single new byte.

But why does this happen? Let’s break down the most common culprits behind this storage crisis, so you can tackle them head-on.

🗑️ Unchecked database growth without limits

Databases aren’t like your inbox—they don’t automatically delete old emails when full. Instead, they keep growing until they hit a physical or logical storage wall. Here’s how it unfolds:

  • Uncontrolled log file expansion:

    Transaction logs (like the "undo" feature in a database) can balloon in size if not managed. When logs aren’t truncated or archived, they consume disk space at an alarming rate, especially in high-transaction environments.

  • Unoptimized table storage:

    Tables with LOBs (Large Objects), BLOBs, or CLOBs (think: images, videos, or massive text documents) can silently eat up storage. If these aren’t stored externally or compressed, they’ll bloat your database until it chokes.

  • Lack of auto-shrink or maintenance:

    Databases like IBM Db2 or Oracle rely on REORG or ALTER TABLE operations to reclaim space. If these tasks are skipped—or if the database is configured to never shrink—free space becomes a myth.

💡 Pro Tip: Set up automated storage alerts and REORG schedules. Tools like RUNSTATS can help identify tables that are 80%+ full and need optimization.

🔗 Filesystem or volume constraints

Sometimes, the issue isn’t the database itself—it’s the container holding it. Here’s how storage limits creep in:

  • Filesystem full or near capacity:

    If your database files (`.db2`, `.dbf`, or `.mdf` files) reside on a filesystem that’s maxed out, the database can’t write new data—even if other disks have space. This is a classic "out of disk space" trap.

  • LVM (Logical Volume Manager) thresholds:

    In Linux/Unix environments, if your logical volume is set to a fixed size and hits its cap, the database throws this error. Unlike filesystems, LVM doesn’t always throw warnings until it’s too late.

  • Quotas enforced by admins:

    Some organizations enforce disk quotas on database directories. If your user or process hits the limit, the database assumes the disk is full—even if other users have free space.

✨ Action Step: Run df -h (Linux) or dir (Windows) on the database directory to check free space. If the filesystem is full, you’ll need to expand it or clean up.

🔄 Temporary space exhaustion

Databases use temporary space for sorting, indexing, and complex queries. When this space runs out, operations fail—and you get the dreaded SQLCODE=-905. Here’s why it happens:

  • Sort operations consuming temp space:

    Queries with ORDER BY, GROUP BY, or joins on large tables can require massive temp storage. If the TEMPORARY STORAGE path is small or full, the database throws this error.

  • Index creation or rebuilds:

    Rebuilding an index (e.g., CREATE INDEX) can temporarily double the storage needed. If the temp space is insufficient, the operation fails midway.

  • Workload spikes without scaling:

    During peak hours, concurrent users or batch jobs can overwhelm temp space. If your temp storage isn’t dynamically allocated, you’re stuck with a fixed (and often insufficient) limit.

🔧 Fix It Now: Check your database’s temp storage settings. In Db2, run db2 get dbm cfg | grep TEMP. If it’s too low, increase it or move the temp path to a larger disk.

🚫 Permission or locking issues

Sometimes, the error isn’t about space—it’s about access. Here’s how permissions or locks can trigger this:

  • Database user lacks write permissions:

    If the database user doesn’t have WRITE access to the storage location (e.g., a network drive or external volume), the system assumes the disk is full and returns this error.

  • Files locked by another process:

    Antivirus scans, backup tools, or even manual file operations can lock database files, making them appear "full" or unwritable to the DBMS.

  • Storage mounted as read-only:

    If the disk or volume is accidentally set to read-only (e.g., due to a misconfigured mount option), the database can’t write new data, leading to this error.

🛠️ Quick Check: Verify permissions with ls -l (Linux) or icacls (Windows). Ensure the database service account has full control over the storage path.

Quick fixes for disk full 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 based on the most common causes—from simple cleanup tasks to deeper system checks—along with prevention tips to keep your database humming smoothly.

🔥 Free Up Space Immediately

If your database is crashing due to a full disk, these steps will buy you time to investigate further.

🍳 Delete Unnecessary Files

Start by clearing out temporary or redundant files that might be hogging space:

  • Check tempdb logs: Run DBCC SHRINKFILE (with caution—only on non-production systems or after backing up) to reduce tempdb file size if it’s bloated.
  • Purge old backups: Use EXEC spdeletebackuphistory to remove obsolete backup records from msdb.
  • Clean up transaction logs: If log files are full, back them up immediately with BACKUP LOG TO DISK='path\to\file.trn'.

👨‍🍳 Shrink Database Files (Temporarily)

If you’re in a pinch, shrinking database files can free up space—but this is a short-term fix. Use:

DBCC SHRINKDATABASE (, 10) -- Shrinks by 10% (adjust as needed)
DBCC SHRINKFILE (N'tempdev' , 10) -- Targets tempdb specifically

⚠️ Warning: Shrinking files frequently can cause fragmentation. Use this only as a last resort.

🔪 Investigate and Resolve Root Causes

Once you’ve freed up space, dig deeper to prevent future outages.

📊 Check Disk Space Usage

Identify which files or directories are consuming the most space:

  • Windows: Use dir /s C:\ or Resource Monitor to scan for large files.
  • Linux: Run df -h and du -sh /path/to/database/ to pinpoint space hogs.
  • SQL Server: Query system tables to find large objects:
    SELECT
        t.name AS TableName,
        s.name AS SchemaName,
        p.rows AS RowCounts,
        CAST(ROUND(((p.datapages  8) / 1024.00), 2) AS NUMERIC(36, 2)) AS SizeMB
        FROM sys.tables t
        INNER JOIN sys.indexes i ON t.OBJECTID = i.objectid
        INNER JOIN sys.partitions p ON i.objectid = p.OBJECTID AND i.indexid = p.indexid
        INNER JOIN sys.schemas s ON t.schemaid = s.schemaid
        WHERE t.ismsshipped = 0
        ORDER BY SizeMB DESC;

⏰ Optimize Database Maintenance

Prevent future disk issues with these proactive steps:

  • Schedule regular backups: Automate BACKUP DATABASE and BACKUP LOG jobs to avoid log file bloat.
  • Enable auto-shrink (with caution): In SQL Server, set AUTOSHRINK = ON (but monitor performance impact).
  • Archive old data: Use partitioning or archiving tables to move cold data to cheaper storage.
  • Monitor growth settings: Avoid setting AUTO_GROW to unlimited—cap it at a reasonable value (e.g., 10% increments).

💡 Prevention Tips to Avoid Future Errors

Once you’ve resolved the immediate issue, implement these best practices to keep your database running smoothly:

  • 🌡️ Set up alerts: Configure SQL Server Agent alerts for low disk space (e.g., <10% free).
  • 🎯 Review storage capacity: Ensure your disk has at least 20% free space for optimal performance.
  • ✨ Use filegroups: Distribute data across multiple filegroups to isolate growth in specific areas.
  • 🔄 Regular maintenance: Run CHECKDB and UPDATE STATISTICS to keep databases efficient.

By combining immediate fixes with long-term strategies, you’ll minimize the risk of SQLCode=-905 errors and keep your database operations seamless.

Frequently asked questions

1

What does SQLCODE=-905, SQLSTATE=57014 actually mean?

This error signals your database encountered a storage-related issue, typically a "disk full" condition. It’s not always about physical disk space—it can also mean permission problems, locked files, or temporary storage exhaustion. Think of it as your database’s way of saying "I can’t write data here!"

2

How do I quickly check if my disk is actually full?

Run these commands based on your OS: df -h (Linux/Mac) or dir C:\ (Windows). For SQL Server, check tempdb space with SELECT name, size*8/1024 FROM sys.database_files. If any volume shows 0% free, that’s your culprit.

3

Can I safely shrink my database files to fix this?

Only as a temporary fix—use DBCC SHRINKDATABASE with caution. Frequent shrinking causes fragmentation. First back up your data, then shrink by 10% max. For permanent fixes, archive old data or expand storage instead.

4

What if the error appears even though I have free disk space?

Check these common culprits: file permissions (run ls -l on Linux or icacls on Windows), locked files (antivirus scans or backups), or quota limits. Also verify your tempdb path isn’t full—many databases use separate temp storage.

5

Will restarting the database server fix this?

Not usually—this is a storage issue, not a service problem. Restarting might temporarily mask symptoms but won’t resolve the root cause. Focus on freeing space or fixing permissions first. A restart could even make things worse if files are locked.

★★★★★4.6(12 reviews)
Categories Troubleshooting