Jun 30 2008
What happens if the database fills up?
Many of our customers use Microsoft SQL Server, and recently, we have been using Microsoft SQL Server 2005 Express at sites where the advanced features of the full product are not required. The Express edition is great for IVR systems, small call centers, and for small web sites, but it also has some limitations including (1) it will never use more than 1GB of memory, and (2) the maximum database size is 4GB. (The maximum database size was increased to 10GB in SQL Server Express 2008 R2.)
Generally speaking, these limitations have no effect on us because the main thing that we do is save call detail and agent activity data. (The database isn’t used for processing millions of online orders, so we don’t need petabyte databases with hyper-performance.) However, the question “What happens if the database fills up?” sometimes arises, and the related question “How big is my database now?”
The answer to the first question is:
- Teleplex will keep running, and will write the data to a text file (provided that the disk isn’t actually full), and
- You will start getting supervisory Alerts, along with error messages like this:
| 2008-06-29,17:36:22.805,ERROR. In CDBObject::Process() for Call Log from LogCall-1: [Microsoft][ODBC SQL Server Driver][SQL Server]Could not allocate space for object ‘dbo.CallLog’.'PK_CallLog’ in database ‘Teleplex’ because the ‘PRIMARY’ filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.> [42000], NativeError=1105. |
The portion shown in yellow is from SQL Server, and the “NativeError” is the actual SQL Server error code.
The answer to the second question can be found by one of the following methods:
- In Microsoft SQL Server Management Studio (“SSMS”) right-click on the database in question to reveal its properties. On the “General” property page you can see the “Size” and the “Space Available”. The Size is the allocated size on disk, which is not necessarily how much space is actually in use inside the database. Space Available indicates the amount of free space within the allocated space, not within the maximum space allowed. Therefore, these numbers do not necessarily show whether you have hit the 4GB limit or not because the allocated size might show 4GB, but there might actually be unused space within that 4GB. (Of course, you are probably reading this article because you are running out of space.)Furthermore, SSMS seems to display the sum of sizes of the “.MDF” (Master Data File) and “.LDF” (transaction log) files (which is confusing), so the magic number you are really looking for is a total Size of around 5GB.
- Look directly at the size of “.MDF” file. With a default installation, data files will be in “C:\Program Files\Micrsoft SQL Server\MSSQL.1\MSSQL\Data”. If the “.MDF” file is around 4GB, you are probably near the limit.
Note that in the SSMS Database Properties “Files” page, you can also see under the “Autogrowth” column how the database is configured to grow. The default settings allows a database to grow automatically to an unlimited size (although the Express server, as mentioned, has a maximum limit of 4GB). You may want to confirm that someone didn’t actually limit the size. (If so, you can change the configuration by clicking on the button in the Autogrowth column.)
When the database appears to be full, you should do the following:
- Check the obvious: Are you actually almost out of disk space? If so, delete some unnecessary files. You can probably quickly free up some disk space by deleting the contents of the Teleplex “Logs” subdirectory, deleting Internet Explorer temporary files, and by deleting files in any of your “temp” directories.
- If you still have plenty of disk space, check the database size as described above. If you are nearing your configured limit, increase the limit.
- If, however, you have reached the 4GB limit of SQL Server Express, you have no choice but to delete some old data (or upgrade to the full version of SQL Server). You easily delete old data from the “Manage Database” screen in Teleplex, and probably the best place to start is with the Call Log, which will get you back to a normal running state in short order.
Of course you should always do the following anway:
- Make regular backups.
- Monitor your disk space.
- Delete old data.
- If you are low on disk space, use SMSS to shrink the database (or use the DBCC SHRINKDATABASE command). You might also want to consider moving the database to a larger drive or partition.
