Error when to do da…
 
Notifications
Clear all

Error when to do database update after upgrade

6 Posts
2 Users
0 Reactions
3,855 Views
0
Topic starter

Hello,

 

After installing the last update 3.1.0.905 and want to do the database update we get the following error :

String or binary data would be truncated.
The statement has been terminated.

After looking in the cloudpanel log we found the first error.

2016-03-03 11:37:37,472 ::: [8] INFO? ::: CloudPanel.Bootstrapper — The following migrations were pending and attempting to update: 201602010143012_AddMailProtector_Index_And_Other, 201602010155429_AddMisingIndexOnStatMailboxSizeTable, 201602010224586_AddMisingIndexOnStatMailboxDatabaseSizeTable, 201602010325262_CombineIndexesOnStatMailboxSizes, 201602010355061_CombineIndexesOnStatMailboxSizesv2, 201602080456395_CombineIndexesOnStatMessageTrackingCount, 201602121446523_UpdateSamAccountNameForSecurityGroups, 201602201659535_AddDescriptionToFiles
2016-03-03 11:37:39,383 ::: [8] ERROR ::: CloudPanel.Bootstrapper — Error updating database automatically: System.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated.
The statement has been terminated.

6 Answers
0

There is a column that it is modifying with more characters in it than allowed. Here is a list of the columns being modified and their MAX Length set. You have something that is exceeding the maximum allowed… the database columns were limited to the Active Directory limits:

AlterColumn("dbo.AD_SecurityGroup", "sAMAccountName", c => c.String(maxLength: 20));
AlterColumn("dbo.AD_SecurityGroup", "Name", c => c.String(maxLength: 64));
AlterColumn("dbo.AD_SecurityGroup", "DisplayName", c => c.String(maxLength: 256));
AlterColumn("dbo.Users", "CompanyCode", c => c.String(nullable: false, maxLength: 64));
AlterColumn("dbo.Users", "sAMAccountName", c => c.String(maxLength: 20));
AlterColumn("dbo.Users", "UserPrincipalName", c => c.String(nullable: false, maxLength: 64));
AlterColumn("dbo.Users", "DisplayName", c => c.String(nullable: false, maxLength: 256));
AlterColumn("dbo.Users", "Firstname", c => c.String(maxLength: 64));
AlterColumn("dbo.Users", "Middlename", c => c.String(maxLength: 64));
AlterColumn("dbo.Users", "Lastname", c => c.String(maxLength: 64));
AlterColumn("dbo.Users", "Email", c => c.String(maxLength: 256));
AlterColumn("dbo.Users", "Department", c => c.String(maxLength: 64));
AlterColumn("dbo.Users", "Description", c => c.String(maxLength: 1024));
AlterColumn("dbo.Users", "Skype", c => c.String(maxLength: 256));
AlterColumn("dbo.Users", "Facebook", c => c.String(maxLength: 2083));
AlterColumn("dbo.Users", "Twitter", c => c.String(maxLength: 2083));
AlterColumn("dbo.Users", "Dribbble", c => c.String(maxLength: 2083));
AlterColumn("dbo.Users", "Tumblr", c => c.String(maxLength: 2083));
AlterColumn("dbo.Users", "LinkedIn", c => c.String(maxLength: 2083));
AlterColumn("dbo.Users", "Street", c => c.String(maxLength: 1024));
AlterColumn("dbo.Users", "City", c => c.String(maxLength: 128));
AlterColumn("dbo.Users", "State", c => c.String(maxLength: 128));
AlterColumn("dbo.Users", "PostalCode", c => c.String(maxLength: 40));
AlterColumn("dbo.Users", "Country", c => c.String(maxLength: 128));
AlterColumn("dbo.Users", "Company", c => c.String(maxLength: 64));
AlterColumn("dbo.Users", "JobTitle", c => c.String(maxLength: 128));
AlterColumn("dbo.Users", "TelephoneNumber", c => c.String(maxLength: 64));
AlterColumn("dbo.Users", "Fax", c => c.String(maxLength: 64));
AlterColumn("dbo.Users", "HomePhone", c => c.String(maxLength: 64));
AlterColumn("dbo.Users", "MobilePhone", c => c.String(maxLength: 64));
AlterColumn("dbo.Companies", "ResellerCode", c => c.String(maxLength: 64));
AlterColumn("dbo.Companies", "CompanyName", c => c.String(nullable: false, maxLength: 256));
AlterColumn("dbo.Companies", "CompanyCode", c => c.String(nullable: false, maxLength: 64));
AlterColumn("dbo.Companies", "Street", c => c.String(maxLength: 1024));
AlterColumn("dbo.Companies", "City", c => c.String(maxLength: 128));
AlterColumn("dbo.Companies", "State", c => c.String(maxLength: 128));
AlterColumn("dbo.Companies", "ZipCode", c => c.String(maxLength: 40));
AlterColumn("dbo.Companies", "PhoneNumber", c => c.String(maxLength: 64));
AlterColumn("dbo.Companies", "Website", c => c.String(maxLength: 2048));
AlterColumn("dbo.Companies", "AdminName", c => c.String(maxLength: 256));
AlterColumn("dbo.Companies", "AdminEmail", c => c.String(maxLength: 256));
AlterColumn("dbo.Companies", "Country", c => c.String(maxLength: 128));
AlterColumn("dbo.Plans_ExchangePublicFolders", "CompanyCode", c => c.String(maxLength: 64));
AlterColumn("dbo.AuditTraces", "CompanyCode", c => c.String(maxLength: 64));
AlterColumn("dbo.CitrixSecurityGroups", "CompanyCode", c => c.String(nullable: false, maxLength: 64));
AlterColumn("dbo.Contacts", "DistinguishedName", c => c.String(nullable: false));
AlterColumn("dbo.Contacts", "CompanyCode", c => c.String(nullable: false, maxLength: 64));
AlterColumn("dbo.Contacts", "DisplayName", c => c.String(nullable: false, maxLength: 256));
AlterColumn("dbo.Contacts", "Email", c => c.String(nullable: false, maxLength: 256));
AlterColumn("dbo.DistributionGroups", "DistinguishedName", c => c.String());
AlterColumn("dbo.DistributionGroups", "CompanyCode", c => c.String(maxLength: 64));
AlterColumn("dbo.DistributionGroups", "DisplayName", c => c.String(nullable: false, maxLength: 256));
AlterColumn("dbo.DistributionGroups", "Email", c => c.String(nullable: false, maxLength: 256));
AlterColumn("dbo.Domains", "CompanyCode", c => c.String(maxLength: 64));
AlterColumn("dbo.Plans_Citrix", "CompanyCode", c => c.String(maxLength: 64));
AlterColumn("dbo.Plans_ExchangeActiveSync", "CompanyCode", c => c.String(maxLength: 64));
AlterColumn("dbo.Plans_ExchangeActiveSync", "DisplayName", c => c.String(nullable: false, maxLength: 256));
AlterColumn("dbo.Plans_ExchangeArchiving", "DisplayName", c => c.String(nullable: false, maxLength: 256));
AlterColumn("dbo.Plans_ExchangeArchiving", "ResellerCode", c => c.String(maxLength: 64));
AlterColumn("dbo.Plans_ExchangeArchiving", "CompanyCode", c => c.String(maxLength: 64));
AlterColumn("dbo.Plans_ExchangeMailbox", "ResellerCode", c => c.String(maxLength: 64));
AlterColumn("dbo.Plans_ExchangeMailbox", "CompanyCode", c => c.String(maxLength: 64));
AlterColumn("dbo.Plans_Organization", "ResellerCode", c => c.String(maxLength: 64));
AlterColumn("dbo.PriceOverride", "CompanyCode", c => c.String(maxLength: 64));
AlterColumn("dbo.Prices", "CompanyCode", c => c.String(nullable: false, maxLength: 64));
AlterColumn("dbo.Statistics", "ResellerCode", c => c.String(maxLength: 64));
AlterColumn("dbo.Statistics", "CompanyCode", c => c.String(maxLength: 64));
0

It probably is the SamAccountName for the security groups because it is later updated to 64 after it changes to 20:

AlterColumn("dbo.AD_SecurityGroup", "sAMAccountName", c => c.String(maxLength: 64));

Do you have a SamAccountName that is above 20 characters? It is supported but there was a point where it changed to 20 on accident. If thats the case I would have to send you another file to bypass that.

0

If you need help with this let me know and I can connect.

0

Actually download the attached file: [attachment file=”CloudPanel.Database.EntityFramework.zip”]

Copy your current file that this is replacing to your desktop and put this one in its place (in the BIN directory). Then recycle the application pool CloudPanel is using or do an IISRESET and see if this resolves your problem.

0
Topic starter

Hello Jacob,

Replacing the file resolved the problem.

Thanks for your quick reply.

0

Glad to hear! Let me know if you need anything else Patrick 🙂

Share: