Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Import Data to New Portal Causes SQL errorImport Data to New Portal Causes SQL error
Previous
 
Next
New Post
7/4/2017 9:09 PM
 

In DNN Version=9.1.0.367 SQL Server 2012, Windows Server 2016

I am trying to create a gold master portal to build additional portals from.  I can successfully export one portal.  I create a new portal and try to Import the gold master to the site

Selecting Users or (Roles and Groups)  causes the import to hang on assets.  When I look in the Admin Logs  this is the error:

:Cannot insert duplicate key row in object 'dbo.FolderPermission' with unique index 'IX_FolderPermission_Users'. The duplicate key value is (107, 2526, 5). The statement has been terminated.

Does anyone know why this is trying to duplicate the folder permissions?  It should be changing the portalID to the new portal


 
New Post
7/22/2017 3:28 PM
 

I was really hoping someone would have a suggestion or a common problem.

Can anyone try to duplicate this issue?

Use the Import/Export function.

Export a portal

Create a new portal

Import the backup to the new portal.

 

 
New Post
7/23/2017 1:37 PM
 
this seems to be bug in import, please report into the public issue tracker at support.dnnsoftware.com.
As a workaround, you may use a modified version of AddFolderPermission stored procedure by executing the following code in Settings > SQL window of the PersonaBar:
IF EXISTS (SELECT * FROM sys.Procedures WHERE object_id = OBJECT_ID(N'{databaseOwner}[{objectQualifier}AddFolderPermission]'))
    DROP PROCEDURE {databaseOwner}[{objectQualifier}AddFolderPermission]
GO

CREATE PROCEDURE {databaseOwner}[{objectQualifier}AddFolderPermission]
    @FolderID           Int, -- not Null!
    @PermissionID       Int, -- not Null!
    @RoleID             Int, -- might be negative for virtual roles
    @AllowAccess        Bit, -- false: deny, true: grant
    @UserID             Int, -- -1 is replaced by Null
    @CreatedByUserID    Int  -- -1 is replaced by Null
AS
    DECLARE @ID         Int;
BEGIN
    SET NoCount ON;
    MERGE INTO {databaseOwner}[{objectQualifier}FolderPermission] AS T
    USING (SELECT @FolderID                     AS FolderID,
                  @PermissionID                 AS PermissionID,
                  CASE WHEN IsNull(@UserID, -1) != -1 AND @RoleID = -1 THEN Null ELSE @RoleID END AS RoleID,
                  @AllowAccess                  AS AllowAccess,
                  NullIf(@UserID, -1)           AS UserID,
                  NullIf(@CreatedByUserID, -1)  AS CreatedByUserID,
                  GetDate()                     AS CreatedOnDate
           ) AS S ON T.FolderID = S.FolderID AND T.PermissionID = S.PermissionID AND IsNull(T.RoleID, -1) = IsNull(S.RoleID, -1) AND IsNull(T.UserID, -1) = IsNull(S.UserID, -1)
    WHEN MATCHED THEN UPDATE 
     SET @ID                    = T.FolderPermissionID, 
         T.AllowAccess          = S.AllowAccess,
         T.LastModifiedByUserID = CASE WHEN T.AllowAccess = S.AllowAccess THEN T.LastModifiedByUserID ELSE S.CreatedByUserID END,
         T.LastModifiedOnDate   = CASE WHEN T.AllowAccess = S.AllowAccess THEN T.LastModifiedOnDate   ELSE S.CreatedOnDate   END
    WHEN NOT MATCHED THEN INSERT 
    (   [FolderID],
        [PermissionID],
        [RoleID],
        [UserID],
        [AllowAccess],
        [CreatedByUserID],
        [CreatedOnDate],
        [LastModifiedByUserID],
        [LastModifiedOnDate]
    ) VALUES
    (   S.FolderID,
        S.PermissionID,
        S.RoleID,
        S.UserID,
        S.AllowAccess,
        S.CreatedByUserID,
        S.CreatedOnDate,
        S.CreatedByUserID,
        S.CreatedOnDate
    );
    SELECT IsNull(@ID, SCOPE_IDENTITY());
    SET NoCount OFF;
END; -- Procedure
GO

Cheers from Germany,
Sebastian Leupold (Microsoft MVP)

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Import Data to New Portal Causes SQL errorImport Data to New Portal Causes SQL error


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out