Community   »   Forums
RSS Feed Available AddThis - Bookmarking and Sharing Button Printer Friendly

PrevPrev NextNext

Upgrading ActiveModules.com - Part 3 - Transferring Data

by Will M on 11 Dec 2006 03:33 PM

Sorry it has taken so long to get this posted.  I actually had it completed several weeks ago, but learned a valuable lesson about writing a long article online using the r.a.d. editor.  Part 3 of this series is migrating your data to a new DotNetNuke install.  Please keep in mind that this is not a complete site migration, but more about creating a new DotNetNuke site and migrating your users and Active Forums from a previous install. 

Step 1 – What do you have and what do you want to migrate?
For the new activemodules.com we wanted to start with a fresh DotNetNuke install.  The only items we wanted to keep from the old site were users and data from Active Forums.  We were going to create all new pages and content for those pages.  This article will only cover migrating data relating to Active Forums.  However, you could probably make some adjustments to migrate other data as well. 

Step 2 – Build the site.
We built out all of the pages that we needed for the site and added modules where necessary.  We even added an empty Active Forums module the new page where Active Forums would be loaded.  This is a very important step as you will see later in Step 5.

Step 3 – Prepare old data for transfer.
With ActiveModules.com we had an additional twist.  ActiveModules.com originally started out as a child portal with a portal id of 3.  On the new site we had no intentions of ever installing a child portal and wanted to make sure ActiveModules.com was now portal 0.  This was going to require making some modifications to the data in the old database.  At this point we created another copy of our old database, just to be safe, and will use this database as the import source.  Changing the portal id required making changes to data in several tables.  The tables where you need to change the portal ID are listed below:
 UserPortals
 NTForums
 NTForums_ForumGroups
 NTForums_UserDetails
 NTForums_ForumSubscriptions
 Roles
 RoleGroups
 

Step 4 – Migrating the data.
We used the SQL Server Import Export Wizard to handle the transfer of the data.  Before you begin this step I highly recommend you backup the database on the new site incase any part of this transfer fails.  The backup will give you the ability to restore and make adjustments without losing any of the progress you have made on the new site.

Start the SQL Server Import Export Wizard and choose to transfer data from Tables.   
 We need to specify the following tables for transfer:
Aspnet_Applications
Aspnet_Membership
Aspnet_Profile
Aspnet_Roles
Aspnet_Users
Aspnet_UsersInRoles
Users
UserPortals
Roles
RoleGroups
UsersRoles
ProfilePropertyDefinition
UserProfile
NTForums
NTForums_Attach
NTForums_Filter
NTForums_ForumGroups
NTForums_ForumGroupSettings
NTForums_Forums
NTForums_ForumsRead
NTForums_ForumSubscriptions
NTForums_Posts
NTForums_Ranks
NTForums_Read
NTForums_Subscriptions
NTforums_Templates
NTForums_UserDetails
ActiveForums_PollOptions
ActiveForums_PollResults
ActiveForums_PostRatings
 
 We then need to check the column mappings for each table.  We need to make sure we delete rows in the destination tables and make sure we enable identity insert with one with one EXCEPTION.  DO NOT DELETE ROWS FROM THE NTForums table.  This contains the module id for your new module instance and will need this later.  


Step 5 – Getting your forums back on-line. 
Now that all of you data is transferred, you have one last step to bring the forums back on-line.  If you look at the rows in the NTForums table you should now see two instances of Active Forums.  The first one is your place holder forum the second is from your transfer.  Make note of the Module ID from the first instance and delete that row.  Now change the ModuleId of the transferred instance to the ModuleId of the row you just deleted.  Now you need to update a few other NTForums tables.  You can use the queries below to make things easier.  Make sure you change #NEWMODULEID# to the module Id of your forums instance.
REMEMBER: THIS IS ONLY IF YOU HAVE ONE FORUM INSTANCE
UPDATE NTForums_Filter SET ModuleID = #NEWMODULEID#
UPDATE NTForums_ForumGroups SET ModuleId = #NEWMODULEID#
UPDATE NTForums_Forums SET ModuleId = #NEWMODULEID#
UPDATE NTForums_Ranks SET ModuleID = #NEWMODULEID#
UPDATE NTForums_Templates SET ModuleID = #NEWMODULEID#

Once this is complete you should be able to login to your portal and verify all your settings.  The first thing you should do is open the Active Forums control panel and click Update Settings on the main settings page.  I would also recommend doing this for at least one forum group and forum to make sure the cache has been properly cleared and initialized.


Summary
Backup your database and backup often.  Before beginning a project like this make sure you have a strategy and all the steps mapped out.  Also you want to make sure you have plan incase the something fails along the way.  Please keep in mind that the steps above are for moving one instance of Active Forums from a single portal.  You can still use the steps above to move multiple instances, but you will need to make some adjustments to during the transfer process.  If you need to complete a transfer like this by Monday morning, don’t try and pull everything together Sunday night, unless of course you have done a few test migrations first. 



Will Morgenweck
Active Modules

12 Comments for Upgrading ActiveModules.com - Part 3 - Transferring Data

Mariette KnapUser is Offline
16 Dec 2006 05:27 PM
www.smallbizserver.net
Maybe a dumb question but why do you transfer Aspnet_Profile, Aspnet_Roles, Aspnet_Users, Aspnet_UsersInRoles? I thought those were no longer used in DNN 4.x and higher?


Avatar
Will MUser is Offline
18 Dec 2006 10:55 AM
www.activemodules.com
Not a dumb question at all. DotNetNuke may no longer be using those tables, but their still may be a few third party modules using the tables. Also, if they have any other integrated ASP.NET applications they would want to preserve that data.


Avatar
Salman ShuaibUser is Offline
27 Dec 2006 03:52 AM

Will, thanks for this very useful post.

Now, just a quick question, can this procedure be used to migrate DIRECTLY from Active Forums 3.6.5 (running on DNN 4.0.3) to the latest Active Forums version on a new DNN 4.4.0 install? In other words, are the tables for 3.6.5 and 3.6.10 compatible for being copied over?
Avatar
Robert AxfordUser is Offline
27 Dec 2006 10:20 PM

I'll probably have to do this some time in future so I'm beginning to look around and ensure that I have all the information onhand should the need arise.

I believe my license says that I can use AF on a single portal and any sub-portals on that. I host on a remote host (Webhost4Life) and would be attempting to transfer all the forum data from any subportals on one DNN instance to equivalent subportals on a fresh DNN instance on the same server. In order to do so, I'd need to be able to install and run AF on the new DNN instance whilst it is still present and running on the old DNN instance.

So my question is... what happens when I install AF on the new instance... is there a mechanism that disables the other one or will they both run fine during the transfer?

Rob


Avatar
Will MUser is Offline
29 Dec 2006 09:56 AM
www.activemodules.com
Now, just a quick question, can this procedure be used to migrate DIRECTLY from Active Forums 3.6.5 (running on DNN 4.0.3) to the latest Active Forums version on a new DNN 4.4.0 install? In other words, are the tables for 3.6.5 and 3.6.10 compatible for being copied over?

I would suggest upgrading the copy of your old site to 3.6.10 and DNN 4.4 before you begin the transfer.

I believe my license says that I can use AF on a single portal and any sub-portals on that. I host on a remote host (Webhost4Life) and would be attempting to transfer all the forum data from any subportals on one DNN instance to equivalent subportals on a fresh DNN instance on the same server. In order to do so, I'd need to be able to install and run AF on the new DNN instance whilst it is still present and running on the old DNN instance.

Very good question. You are correct on the licensing. Yes, you will be able to run both sites during the transfer.


Thanks,
Will


Mike HortonUser is Offline
01 Jan 2007 09:32 PM
http://dnn.gmss.org
Hey Will I've tried this a few times over the last couple of days and can't get it to work. The majority of the time I get foreign key errors or duplicate key errors. Any ideas?


Avatar
Will MUser is Offline
02 Jan 2007 05:56 PM
www.activemodules.com
Mike, what tables are giving you the errors? You need to make sure you have the following checked for each table.
http://www.activemodules.com/Portals/0/images/Wizard03.jpg

Let me know if that helps.

Thanks,
Will


Mike HortonUser is Offline
06 Jan 2007 01:25 AM
http://dnn.gmss.org
Oops sorry Will. I got caught up getting things done at work before the students come back on Monday and forgot to check this thread.

Yup did all that. I'll give it another shot tomorrow or Sunday and give you a list of the ones that are erroring out but if memory serves I get my first FK error on the Aspnet_Applications table and then it never really goes from there. Did you transfer all the tables at once or one at a time? I wonder if something changed in the db structure from 4.3.5 to 4.4.0?


Mike HortonUser is Offline
12 Jan 2007 12:48 AM
http://dnn.gmss.org
Hey Will

I got some time this evening to take another look at it. The first error I'm getting is on the Aspnet_Applications table and it's the following:

Cannot truncate table 'DNN_MG_New.dbo.Aspnet_Applications' because it is being referenced by a FOREIGN KEY constraint.

For giggles I tried to set it up so that it wouldn't delete rows in the destination table and got a duplicate key error.

Any ideas?


Avatar
Will MUser is Offline
12 Jan 2007 05:24 PM
www.activemodules.com
Mike, I did transfer all the tables at once. I wonder if it would help to manually truncate the destination aspnet tables?

I haven't tested this process for 4.4.0, but at a quick glance I don't see any differences.


Mike HortonUser is Offline
12 Jan 2007 05:45 PM
http://dnn.gmss.org
I can't remember if I tried that or not but I'll try to take a look at it tonight. It's a wee bit of a PIA as my SQL Express on my dev system seems to be missing the DTS Wizard even though it's been updated to SP1 and I've found posts on the internet where it was supposed to show up after the SP1 update. I've been connecting straight off the SQL 2005 install on my production server to test this. Not a big deal but it forces me to do things at home in the evenings rather than when I've got down time at work.


Mike HortonUser is Offline
17 Jan 2007 06:17 PM
http://dnn.gmss.org
I couldn't get it to work no matter how many times I tried. I ended up using a meld of what you did and what I looked at doing a few months ago. I used BulkUserManager to move the users over to the new portal, wizard copied the NTForums tables over like you did, and then used scripts to change the userids.

Another user here mentioned to me that he used the same process but was able to fool the .csv exported by BulkUserManager so that the users would have the same UserID when imported into the new database but it was a manual process and with > 4000 users it would've taken to long for me.


Quick Reply
toggle
  Username:
Subject:
Body:
Security Code:
Enter the code shown above in the box below

Submit
Active Forums 4.1
Copyright 2008 by Active Modules, Inc.
Social Networking |  Home |  Products |  Services |  Community |  Company |  Buy Now