The database file is larger than the configured maximum database size

Topics: Troubleshooting
Feb 19, 2015 at 11:17 PM
Edited Feb 19, 2015 at 11:18 PM
Our current database is SQLCe and is sitting right at 256MB. Problems started to present themselves during an update approximately 2-12-15.

What has been attempted:

Setting the connection string in the settings.txt file like so:
 Data Source=MyData.sdf;Max Database Size=512;Persist Security Info=False;
Modifying and rebuilding the source code using instructions from sfmskywalker from this link:

https://orchard.codeplex.com/discussions/451134

Swapping out the db for a backup version from last week before the behavior began.

And increasing the max db size using SQL Server Compact Toolbox to no avail.

Here are the last few lines of the most recent log file. Any help is much appreciated as we are already a couple days down on our site.

2015-02-19 14:45:12,849 [12] NHibernate.Util.ADOExceptionReporter - The database file is larger than the configured maximum database size. This setting takes effect on the first concurrent database connection only. [ Required Max Database Size (in MB; 0 if unknown) = 257 ]
2015-02-19 14:45:12,849 [12] NHibernate.Util.ADOExceptionReporter - The database file is larger than the configured maximum database size. This setting takes effect on the first concurrent database connection only. [ Required Max Database Size (in MB; 0 if unknown) = 257 ]
2015-02-19 14:45:12,849 [12] Orchard.Exceptions.DefaultExceptionPolicy - An unexpected exception was caught
NHibernate.Exceptions.GenericADOException: could not execute query
[ SELECT this_.Id as Id32_3_, this_.Number as Number32_3_, this_.Published as Published32_3_, this_.Latest as Latest32_3_, this_.Data as Data32_3_, this_.ContentItemRecord_id as ContentI6_32_3_, contentite1_.Id as Id31_0_, contentite1_.Data as Data31_0_, contentite1_.ContentType_id as ContentT3_31_0_, commonpart3_.Id as Id43_1_, commonpart3_.OwnerId as OwnerId43_1_, commonpart3_.CreatedUtc as CreatedUtc43_1_, commonpart3_.PublishedUtc as Publishe4_43_1_, commonpart3_.ModifiedUtc as Modified5_43_1_, commonpart3_.Container_id as Container6_43_1_, contenttyp2_.Id as Id33_2_, contenttyp2_.Name as Name33_2_ FROM Orchard_Framework_ContentItemVersionRecord this_ inner join Orchard_Framework_ContentItemRecord contentite1_ on this_.ContentItemRecord_id=contentite1_.Id inner join Common_CommonPartRecord commonpart3_ on contentite1_.Id=commonpart3_.Id inner join Orchard_Framework_ContentTypeRecord contenttyp2_ on contentite1_.ContentType_id=contenttyp2_.Id WHERE contenttyp2_.Name in (@p0, @p1) and contenttyp2_.Name in (@p2) and this_.Latest = @p3 ORDER BY commonpart3_.ModifiedUtc desc OFFSET 0 ROWS FETCH NEXT @p4 ROWS ONLY ]
Name:cp0 - Value:Page Name:cp1 - Value:ProjectionPage Name:cp2 - Value:Page Name:cp3 - Value:True
[SQL: SELECT this_.Id as Id32_3_, this_.Number as Number32_3_, this_.Published as Published32_3_, this_.Latest as Latest32_3_, this_.Data as Data32_3_, this_.ContentItemRecord_id as ContentI6_32_3_, contentite1_.Id as Id31_0_, contentite1_.Data as Data31_0_, contentite1_.ContentType_id as ContentT3_31_0_, commonpart3_.Id as Id43_1_, commonpart3_.OwnerId as OwnerId43_1_, commonpart3_.CreatedUtc as CreatedUtc43_1_, commonpart3_.PublishedUtc as Publishe4_43_1_, commonpart3_.ModifiedUtc as Modified5_43_1_, commonpart3_.Container_id as Container6_43_1_, contenttyp2_.Id as Id33_2_, contenttyp2_.Name as Name33_2_ FROM Orchard_Framework_ContentItemVersionRecord this_ inner join Orchard_Framework_ContentItemRecord contentite1_ on this_.ContentItemRecord_id=contentite1_.Id inner join Common_CommonPartRecord commonpart3_ on contentite1_.Id=commonpart3_.Id inner join Orchard_Framework_ContentTypeRecord contenttyp2_ on contentite1_.ContentType_id=contenttyp2_.Id WHERE contenttyp2_.Name in (@p0, @p1) and contenttyp2_.Name in (@p2) and this_.Latest = @p3 ORDER BY commonpart3_.ModifiedUtc desc OFFSET 0 ROWS FETCH NEXT @p4 ROWS ONLY] ---> System.Data.SqlServerCe.SqlCeException: The database file is larger than the configured maximum database size. This setting takes effect on the first concurrent database connection only. [ Required Max Database Size (in MB; 0 if unknown) = 257 ]
at System.Data.SqlServerCe.SqlCeDataReader.ProcessResults(Int32 hr)
at System.Data.SqlServerCe.SqlCeDataReader.IsEndOfRowset(Int32 hr)
at System.Data.SqlServerCe.SqlCeDataReader.Move(DIRECTION direction)
at System.Data.SqlServerCe.SqlCeDataReader.Read()
at NHibernate.Driver.NHybridDataReader.Read()
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
--- End of inner exception stack trace ---
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet1 querySpaces, IType[] resultTypes)
at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results)
at NHibernate.Impl.CriteriaImpl.List(IList results)
at NHibernate.Impl.CriteriaImpl.List[T]()
at Orchard.ContentManagement.DefaultContentQuery.Slice(Int32 skip, Int32 count) in c:\Users\sebros\My Projects\Orchard\src\Orchard\ContentManagement\DefaultContentQuery.cs:line 146
at Orchard.ContentManagement.DefaultContentQuery.ContentQuery
1.Orchard.ContentManagement.IContentQuery<T>.Slice(Int32 skip, Int32 count) in c:\Users\sebros\My Projects\Orchard\src\Orchard\ContentManagement\DefaultContentQuery.cs:line 195
at Orchard.Core.Contents.Controllers.AdminController.List(ListContentsViewModel model, PagerParameters pagerParameters) in c:\Users\sebros\My Projects\Orchard\src\Orchard.Web\Core\Contents\Controllers\AdminController.cs:line 92
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.<InvokeActionMethodWi
Developer
Feb 20, 2015 at 5:12 PM
See: https://orchard.codeplex.com/workitem/20395 But at this DB size you'd be better off using a standard DB.
Marked as answer by mcoulter567 on 2/20/2015 at 9:17 AM
Feb 20, 2015 at 5:16 PM
Thank you Piedone.

We have fixed the issue using this method but had to download the older source code we are running. We will be migrating to a standard DB in the future.
Feb 20, 2015 at 6:26 PM
Btw, I just realized that the link provided by Peidone is the best solution but the link provided was not the fix we applied for the time being.

Here's the fix that worked from sfmskywalker from the link in my original post:
Ok. Yeah, you will have to download the project source, look for the file "SqlCeDataServicesProvider.cs" in Orchard.Framework/Data/Providers and change line 39 from this:
string localConnectionString = string.Format("Data Source={0}", _fileName);
To this:
string localConnectionString = string.Format("Data Source={0};Max Database Size=1024", _fileName);
Then build the solution, and copy over Orchard.Framework.dll to your own project (replace all occurrences of that file with your custom built one).
Make sure you use the same source code as the version of Orchard you are using.

With that said, the better solution is what Piedone suggests and that is upgrading to a standard DB.