You are here:   Home
  |  Login
DotNetNuke Core Team
Microsoft MVP
 Bookmark this article!
delicious.com delicious.com
digg digg
technorati technorati
reddit reddit
stumbleupon stumbleupon
facebook facebook
google bookmarks google bookmarks
yahoo bookmarks yahoo bookmarks
slashdot slashdot
live live
twitter twitter
DotNetKicks DotNetKicks

Tags

  1. 1 items are tagged with Admin settings
  2. 1 items are tagged with AJAX Extensions
  3. 1 items are tagged with ASP.NET
  4. 2 items are tagged with BBeyond
  5. 1 items are tagged with Caching
  6. 1 items are tagged with Cambrian
  7. 1 items are tagged with CBO
  8. 2 items are tagged with Codeplex
  9. 1 items are tagged with debugging
  10. 1 items are tagged with DotNetNuke
  11. 2 items are tagged with DotNetNuke 5
  12. 1 items are tagged with Email
  13. 1 items are tagged with email validation
  14. 1 items are tagged with GMail
  15. 1 items are tagged with Google
  16. 1 items are tagged with Google Apps
  17. 1 items are tagged with IBaseEntity
  18. 2 items are tagged with IdentitySwitcher
  19. 1 items are tagged with IHydratable
  20. 1 items are tagged with Inline Skin Object
  21. 2 items are tagged with Installation
  22. 1 items are tagged with Installer
  23. 1 items are tagged with intellisense
  24. 1 items are tagged with IPropertyAccess
  25. 1 items are tagged with Language
  26. 1 items are tagged with Manifest
  27. 1 items are tagged with moving
  28. 1 items are tagged with OpenForce
  29. 1 items are tagged with Permissions
  30. 1 items are tagged with Profile Properties
  31. 1 items are tagged with PropertyEditorControl
  32. 1 items are tagged with recent projects
  33. 1 items are tagged with regex
  34. 1 items are tagged with Sample Module
  35. 1 items are tagged with Search Results
  36. 2 items are tagged with Skin Object
  37. 1 items are tagged with Skinning
  38. 6 items are tagged with SQL
  39. 1 items are tagged with SQL Server
  40. 1 items are tagged with SQL Server 2008
  41. 1 items are tagged with Table Functions
  42. 2 items are tagged with TellCo
  43. 1 items are tagged with TokenReplace
  44. 2 items are tagged with Too Good to be True
  45. 1 items are tagged with Twitter
  46. 2 items are tagged with UPC
  47. 2 items are tagged with Upgrading
  48. 1 items are tagged with Users
  49. 2 items are tagged with visual studio
  50. 1 items are tagged with Visual Studio 2008

My Twitter Feed...

Thu, 29 Jul 2010 16:45:45 +0200

erikvb: Gettin unhealthy food. Yummy!

Thu, 29 Jul 2010 07:06:10 +0200

erikvb: RT @mashable: Google Makes Custom Web Typography Ridiculously Easy - http://ow.ly/2i8DG

Wed, 28 Jul 2010 05:05:48 +0200

erikvb: @Alyssa_Milano cool, you have a clone AND you are followed by @wilw . I can only dream of achieving the same...

Tue, 27 Jul 2010 22:20:49 +0200

erikvb: http://bit.ly/bwCZdB (Popularity is Everything: A new approach to protecting passwords from statistical-guessing attacks)

Tue, 27 Jul 2010 16:51:58 +0200

erikvb: RT @Telerik: Win an iPad or Telerik Ultimate licenses. Contest details at http://bit.ly/99ep9O [please RT]

Tue, 27 Jul 2010 10:06:20 +0200

erikvb: RT @TimoBreumelhof: Small bugfix for Style Helper #DNN #skin object posted: http://dnnskinextensions.codeplex.com/releases/view/47234

Mon, 26 Jul 2010 18:39:00 +0200

erikvb: @jbrinkman have fun playing with it :)

Mon, 26 Jul 2010 18:34:22 +0200

erikvb: @schotman als het maar droog blijft

Mon, 26 Jul 2010 17:51:38 +0200

erikvb: RT @christoc: RT @DNNCorp Get new insights from #DotNetNuke CEO Navin Nagiah at CMS Critic: http://bit.ly/aqkKwm

Sun, 25 Jul 2010 20:35:09 +0200

erikvb: RT @Heuserkampf: This will be interesting: Facebook lets publishers contact “likers”: http://bit.ly/9orOQN

Preparing for an upgrade

Last Updated 10/26/2008
By: Erik van Ballegoij

Today I had to upgrade an old DNN 3.2.2 multiportal installation to DNN 4.8.1. There are 3 major areas that changed in the past DotNetNuke versions:

  1. New contstraints and unique indexes on Files table
  2. DNN Membership provider
  3. Consolidation of http handlers in one assembly

In order to smoothly pass the third change, I always do a 2-step upgrade. First to DNN 4.5.5, then to the last available version, 4.8.1 in this case. The consolidation of http handlers happened in DNN 4.6.0.

When upgrading from DNN versions prior to 3.3.x / 4.3.x, the upgrade process will upgrade the data in the DNN Database from almost pure asp.net membership, to the more loosely coupled DNN Membership. Major changes are: switch from unique ApplicationID / Name per portal to one ApplicationId / name per DNN installation, and DNNMembership no longer uses the aspnet roles and profile tables. However, even though all data is upgraded, no essential data is deleted. In order to finalize the upgrade, you can manually delete the old data using the following SQL:

DELETE FROM dbo.aspnet_UsersInRoles

DELETE FROM dbo.aspnet_Profile

DELETE FROM dbo.aspnet_Roles

DELETE FROM dbo.aspnet_Membership
WHERE ApplicationId <> (SELECT ApplicationId FROM dbo.aspnet_Applications WHERE ApplicationName='DotNetNuke')

DELETE FROM dbo.spnet_Users 
WHERE ApplicationId <> (SELECT ApplicationId FROM dbo.aspnet_Applications WHERE ApplicationName='DotNetNuke')

You can run this script from SQL Management Studio, or from Host > SQL (select run as script). NB: Always make a backup of your database prior to executing this SQL!

 

The reason upgrades fail mostly have to do with the first change: new constraints and unique indexes on the files table. Problems arise from duplicate files in the files table, and files in the files table without a corresponding folder in the folders table. Even though the DNN upgrade sql tries to handle a few cases, in my experience, there are often cases that are not handled. Today i created the following sql which fixed all upgrade issues for me:

ALTER TABLE [dbo].Files ADD FolderID int NOT NULL CONSTRAINT DF_Files_FolderID DEFAULT 0

GO

UPDATE [dbo].Folders
SET    FolderPath = FolderPath + '/'
WHERE  FolderPath <> '' AND RIGHT(FolderPath, 1) <> '/'

GO

UPDATE [dbo].Files
SET    FolderID = FO.FolderID
FROM   [dbo].Files F, [dbo].Folders FO
WHERE F.Folder = FO.FolderPath
    AND ( ( F.PortalID = FO.PortalID ) OR ( F.PortalID is NULL AND  FO.PortalID is NULL ) )
GO

INSERT INTO [dbo].[Folders] (PortalId, FolderPath)
SELECT     TOP 100 PERCENT F.PortalId, F.Folder
FROM         [dbo].Files F LEFT OUTER JOIN
                      [dbo].Folders FO ON F.FolderID = FO.FolderID
WHERE     (FO.FolderID IS NULL)
GROUP BY F.Folder, F.PortalId
ORDER BY F.PortalId, F.Folder

GO



-- delete duplicates from folders table
DELETE FROM [dbo].Folders
  WHERE FolderId in (
    SELECT FolderId  
    FROM [dbo].Folders FO 
      join (SELECT PortalId, FolderPath
            FROM [dbo].Folders 
            GROUP BY PortalId,FolderPath 
            HAVING COUNT(*) > 1) DUP 
      ON DUP.FolderPath = FO.FolderPath AND (DUP.PortalId = FO.PortalId OR ( FO.PortalID is NULL AND  DUP.PortalID is NULL ))
      WHERE FO.FolderId NOT IN 
        (SELECT FolderId=MIN(FolderId)
         FROM [dbo].Folders 
         GROUP BY PortalId,FolderPath 
         HAVING COUNT(*) > 1))

GO

Delete from Files 
WHERE FileID in (
    SELECT FileID
    FROM [dbo].Files F 
      join (SELECT FolderId, FileName
            FROM [dbo].Files 
            GROUP BY folder,FolderId,FileName 
            HAVING COUNT(*) > 1) DUP
      on DUP.FolderId = F.FolderID and DUP.FileName = F.FileName
    WHERE F.FileID NOT IN
     (SELECT FileID = MIN(FileId)
            FROM [dbo].Files 
            GROUP BY folder,FolderId,FileName 
            HAVING COUNT(*) > 1))

ALTER TABLE [dbo].Files
    DROP CONSTRAINT DF_Files_FolderID
GO

ALTER TABLE [dbo].Files DROP COLUMN FolderId

GO

This script will do the following:

  • make sure that all foldernames in the files table exist in the folders table (add if neccesary)
  • delete duplicates from folders table
  • delete duplicates from files table.

Of course.. there is a risk. Because the final step is to delete duplicate files, links to that files will seize to work. It will be necessary to do a manual check of your site, to see if this happened on your site.

You can run this script from SQL Server management studio, or from Host >SQL (if you are using a non standard databaseowner and/or an object qualifier, you will need to edit this script to meet your needs) and again: Always make a backup of your database prior to executing this SQL!

(this post is crossposted at dotnetnuke.com)

Rate this:
Recent Comments
There are currently no comments. Be the first to make a comment.

Powered By

DotNetNuke Powered! This site is proudly powered by DotNetNuke.

 

(Advertisements)

My other blogs

Thu, 21 May 2009 18:41:00 +0200

Fri, 01 May 2009 14:57:00 +0200

Wed, 29 Apr 2009 16:11:00 +0200

Mon, 27 Apr 2009 20:33:05 +0200

Wed, 21 Jan 2009 20:13:00 +0100

Mon, 05 Jan 2009 23:00:00 +0100

Fri, 05 Dec 2008 16:45:08 +0100

Sun, 05 Oct 2008 22:23:00 +0200

Wed, 17 Sep 2008 14:07:00 +0200

Sun, 24 Aug 2008 21:23:00 +0200