Error : CREATE DATABASE or ALTER DATABASE failed because the resulting cumulative database size would exceed your licensed limit of 4096 MB per database.




Purging Microsoft SQL Server 2005 Express Edition

Error:

vCenter Server An unknown Connection error occurred |
VCServer was not able to connect from the VSphere Client. An unknown Connection error occurred

SQL Server Error:

CREATE DATABASE or ALTER DATABASE failed because the resulting cumulative database size would exceed your licensed limit of 4096 MB per database.

VCServer Error:

Could not allocate space for object ‘dbo.VPX_EVENT_ARG’.’PK_VPX_EVENT_ARG’ in database ‘VIM_VCDB’ 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.

Reason:

Microsoft SQL Server 2005 Express Edition installed along with the VCenter server has a database size limitation of 4GB (log files excluded).  vCenter Server stores performance data in the vCenter Server database. Over time, data collection results in growth of the database files. Once it reach 4GB Database will be disconnected form the VCServer.

Solution For VMware VCenter Server:

By shrinking the database using the below mentioned script, we can reduce the database size.
1.Download the Microsoft SQL Server Management Studio Express form the following link and install it in the VCServer.
2. Download the database script from  VMware
3. Follow the procedure in the below video.
Purging old data from the database used by vCenter Server

Solution Video:

Prevention:

vCenter Server has a Database Retention Policy setting that allows you to specify when vCenter Server tasks and events should be deleted. Since this setting does not affect performance data records it is still possible to purge or shrink old records from the database using the scripts attached to this article. To access the Database Retention Policy setting in the vSphere Client, click Administration > vCenter Server Settings > Database Retention Policy.