---
title: Azure SQL Storage | Blue Matador - Troubleshooting
description: How to troubleshoot Azure SQL Database and Elastic Pool Storage
image: https://www.bluematador.com/hubfs/logo-1.png
---

 Docs

# Azure SQL Storage

Storage measures the percentage of your max file storage that is in use. The **max** storage is easily confused with the **allocated** storage but they are different. Allocated storage is the amount of file storage that has been formatted and is writable by your database, and is automatically increased as more storage is needed, up to the maximum amount of storage. Blue Matador automatically monitors the **storage_percent** metric for high usage.

 

## Effects

---

Reaching max storage will prevent your database from storing additional data.

 

## Increasing Max Storage

---

For single databases, the max storage can be configured as part of your database configuration. If your max storage cannot be increased further, you may need to upgrade your database to the next service tier. 

For databases that are part of an elastic pool, max storage can be increased up to the maximum allowed by the elastic pool. If the elastic pool is also at max storage, then it must be configured for more storage before any of its databases can increase max storage. This also may require upgrading to a higher service tier for your elastic pool.

 

## Reducing Used Storage

---

If you can identify specific databases where you would like to reduce storage used, you can use the **DBCC SHRINKDATABASE** command as documented [here](https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-shrinkdatabase-transact-sql?view=sqlallproducts-allversions). Using SHRINKDATABASE will severely impact database performance and should only be used during periods of low database activity. 

You can also enable Auto-Shrink to reduce database size. Auto-Shrink is less impactful than SHRINKDATABASE but also less effective. You can enable Auto-Shrink with the following SQL:

```
-- Enable auto-shrink for the database.
ALTER DATABASE [db1] SET AUTO_SHRINK ON
```

After shrinking a database you may need to rebuild indexes if your performance degrades. You can follow the documentation [here](https://docs.microsoft.com/en-us/sql/relational-databases/indexes/reorganize-and-rebuild-indexes?view=sqlallproducts-allversions) to rebuild your indexes in your SQL database. 

## Resources

---

- [Manage file space for single and pooled databases in Azure SQL Database](https://docs.microsoft.com/en-us/azure/sql-database/sql-database-file-space-management) (Microsoft Azure Documentation)
- [DBCC SHRINKDATABASE](https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-shrinkdatabase-transact-sql?view=sqlallproducts-allversions) (Microsoft Azure Documentation)
- [Reorganize and Rebuild Indexes](https://docs.microsoft.com/en-us/sql/relational-databases/indexes/reorganize-and-rebuild-indexes?view=sqlallproducts-allversions) (Microsoft Azure Documentation)