Knowledge BaseCREATE DATABASE or ALTER DATABASE failed because the resulting cumulative database size would exceed your licensed limit of 4096 MB per database.
W P Staff asked 6 years ago

On Windows Small Business Server 2008 im getting flooded with Event ID 1827 “CREATE DATABASE or ALTER DATABASE failed because the resulting cumulative database size would exceed your licensed limit of 4096 MB per database. ” In Application Log.

1 Answers
W P Staff answered 6 years ago

The cause is that the database is not configured to purge old data. There is a fix for this and it turns out to the same sql script that is used for an SBS problem where the Console displays too slowly. Run this script against your SBS Monitoring database and it will only hold data for the last 90 days. So if your database isn’t completely filled up yet you’ll want to run this now.
NOTE: The following instructions and script link from from the Official SBS Blog posting SBS 2008 Console May Take Too Long to Display Alerts and Security Statuses, Display Not Available, or Crash.

  • Download the following file to the server you are going to be working on:
    1. Copy bellow script and paste it into notepad, save it as updateSBSMonitoring.sql
      USE SBSMonitoring
      UPDATE [SBSMonitoring].[dbo].[Settings] SET [Value] = 30 WHERE [Name] = ‘CleanupPeriod’
      EXECUTE [SBSMonitoring].[dbo].[CleanupDatabase]
      CREATE NONCLUSTERED INDEX [_SBS_BLOG_index_WMICollectedData_5_K4_K1_K5_2] ON [dbo].[WMICollectedData] ([WMIPropertyID] ASC,[ID] ASC, [WMIInstanceID] ASC) INCLUDE ( [DateCollected]) WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY]
      CREATE NONCLUSTERED INDEX [_SBS_BLOG_index_Reports_5_K2_K3_1_4] ON [dbo].[Reports] ([ConfigurationID] ASC, [DateGenerated] ASC) INCLUDE ([ID], [Data]) WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY]
      CREATE NONCLUSTERED INDEX [_SBS_BLOG_index_WMICollectedData_5_K2D_K4_K5] ON [dbo].[WMICollectedData] ([DateCollected] DESC, [WMIPropertyID] ASC, [WMIInstanceID] ASC) WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY]
      CREATE INDEX [_SBS_BLOG_index_Alerts_8_7_] ON [SBSMonitoring].[dbo].[Alerts] ([DefinitionID], [ComputerID]) INCLUDE ([DateOccured])
      CREATE STATISTICS [_SBS_BLOG_stat_WMICollectedData_5_1_4] ON [dbo].[WMICollectedData]([WMIInstanceID], [ID], [WMIPropertyID])
      CREATE STATISTICS [_SBS_BLOG_dta_stat_WMICollectedData_4_1_5_2_3] ON [dbo].[WMICollectedData]([WMIPropertyID], [ID], [WMIInstanceID], [DateCollected], [StatusID])
      CREATE STATISTICS [_SBS_BLOG_dta_stat_WMICollectedData_5_1_3_4] ON [dbo].[WMICollectedData]([WMIInstanceID], [ID], [StatusID], [WMIPropertyID])
      CREATE STATISTICS [_SBS_BLOG_dta_stat_WMICollectedData_5_4_2] ON [dbo].[WMICollectedData]([WMIInstanceID], [WMIPropertyID], [DateCollected])
      CREATE STATISTICS [_SBS_BLOG_stat_WMICollectedData_2_1_5] ON [dbo].[WMICollectedData]([DateCollected], [ID], [WMIInstanceID])
      CREATE STATISTICS [_SBS_BLOG_stat_WMICollectedData_1_3_5_2] ON [dbo].[WMICollectedData]([ID], [StatusID], [WMIInstanceID], [DateCollected])
    2. We recommend you save the file to an easy to access path, such as c:\windows\temp.
  • Complete a backup of the SBSMonitoring Databases
    1. Open Services from Administrative Tools, Services
    2. Accept the UAC prompt
    3. Find and stop the SQL Server (SBSMONITORING) service.
    4. Make a copy of the files in the following folder:
      1. C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data
    5. Once the file backup is completed, start the SQL Server (SBSMONITORING)service.
  • Proceed to run the following set of commands to implement the improvements
    1. Open an Administrative Command Prompt (Run As Admin)
    2. Type the following command, substitute the path to the updateSBSMonitoring.sql file as needed (We recommend that you do NOT copy & paste this command directly from the blog post):
      1. Sqlcmd -S %computername%\SBSMonitoring -E  -i c:\windows\temp\updateSBSMonitoring.sql
      2. Success will show an output like this: 
        Changed database context to ‘SBSMonitoring’ 
        (1 rows affected)

If your database is completely filled up like mine was, then you need to replace it with a clean empty one. I consulted out resident SQL expert, Edwin Sarmiento, for this advice. You’ll have to get clean empty database through one of 3 methods: Open a ticket with Third Tier, open a ticket with Microsoft, or stand up an SBS 2008 server and grab it from there.
To install your new clean database do this:

  1. Open an elevated SQL Server Management Studio Express
  2. Connect to the <servername>\SBSMonitoring database using Windows Authentication
  3. Expand Databases and right-click on SBS Monitoring
  4. Choose Tasks, then Backup
  5. Make a backup of the current database
  6. Next Choose Tasks, then Detach to detach the database from SQL
  7. Open Services.msc and stop the SQL Server (SBSMonitoring) and SQL Full Text Search (SBSMonitoring) services
  8. Open an elevated Windows Explorer and drill down to c:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data and replace the SBSMonitoring and SBSMonitoring_Log files with the blank ones you obtained.
  9. Start the services that you stopped earlier
  10. Verify that you can run a report from the console

Since you have now gone to the trouble of installing a new database, to insure that this doesn’t happen again run the above SQL script on the new database.