Hi Sebastian,
Finally I think I got things working after a lot of database restores and trial and error. Here are the steps I pretty much used to get there. I used the Management Studio so my queries have been adjusted.
I ran this first to create the dummy portal 0...
SET IDENTITY_INSERT dbo.Portals ON;
INSERT INTO dbo.Portals (PortalID, AdministratorRoleId, RegisteredRoleID) Values (0, 0, 1);
SET IDENTITY_INSERT dbo.Portals OFF;
INSERT INTO dbo.PortalLocalization (PortalID, CultureCode, PortalName) Values (0, N'en-US', N'dummy Portal');
Next, running this line would not work as there was already a role with the RoleID of 0:
SET IDENTITY_INSERT dbo.Roles ON;
INSERT INTO dbo.Roles (RoleID, PortalID, RoleName, BillingFrequency, BillingPeriod, TrialFrequency, TrialPeriod) Values (0, 0, N'Administrators', N'N', 1, N'N', 1);
SET IDENTITY_INSERT dbo.Roles OFF;
It gave me: Violation of PRIMARY KEY constraint 'PK_Roles'. Cannot insert duplicate key in object 'dbo.Roles'. The duplicate key value is (0).
So I backed out the RoleID part of the insert:
SET IDENTITY_INSERT dbo.Roles ON;
INSERT INTO dbo.Roles (PortalID, RoleName, BillingFrequency, BillingPeriod, TrialFrequency, TrialPeriod) Values (0, N'Administrators', N'N', 1, N'N', 1);
SET IDENTITY_INSERT dbo.Roles OFF;
But then I got this error:
Explicit value must be specified for identity column in table 'Roles' either when IDENTITY_INSERT is set to ON or when a replication user is inserting into a NOT FOR REPLICATION identity column.
So I simply ran the insert without the SET IDENTITY_INSERT dbo.Roles ON and it worked.
Finally I ran your FixDNNRoles733.sql file, and the site is now working after restarting the host!
I guess the actual RoleID does not matter, and I only created the Administrator role.
This was one tough bug, and I hope future updates work with what I got now.
Many thanks for your participation in this!
Steve