This project is read-only.

GoDaddy 1.3 to 1.4.5 restoring data?

Topics: ASP.NET 2.0
Jan 24, 2009 at 5:38 AM
While I am computer saavy, I am new to the area of open source projects like this. I have been using the canned BlogEngine.Net on GoDaddy hosting for about a year now, and recently decided to upgrade my hosting account. Before doing so, I backed up the database file from the blog and I also used FTP to copy the entire BlogEngine.Net folder from the server. Next, I allowed my expiring hosting to lapse, and then set up my new hosting. When I went with the new hosting plan, the version for BlogEngine that is now available is DIFFERENT (no problem, right? new and improved, good). Well, the problem is I can't seem to restore my backed up database or posts - seems that everything I do results in the blog "blowing up" generating code errors, etc. and I keep having to start over.

Part of the problem here may well be I am unfamiliar with pretty much any code tweaking, though I have learned a few things already this week. One thing I learned was to give write permissions to my data folder on the server - now I am able to post NEW posts with no problem.

What I can't seem to figure out though is a way to RESTORE my old posts from the previous year. I have the backup DB and the copy of the folders - but it seems that 1.4.5 doesn't understand the format that 1.3 was using on GoDaddy.

Any input, direction to documentation, etc. would be greatly appreciated... I'm wanting to "learn to fish" here.

Jan 24, 2009 at 5:31 PM
Were your old version 1.3 posts stored in a SQL database, or in XML files within the App_Data folder?  And what about now, are your version 1.4.5 posts stored in a SQL database of XML files?

I looked at the MSSQLUpgradeTo1.4.5.0From1.3.x.sql file that comes with BE 1.4.5.  It's a SQL upgrade script when going from v1.3 to v1.4.5.  There aren't any changes in that file for the be_Posts table.  There are new DB tables in that script (be_DataStoreSettings, be_Profiles, be_StopWords, be_Users, be_Roles, be_UserRoles) and a ParentID column is added to the be_Categories table.  So if your posts are/were stored in a SQL database, it appears that just copying the posts into the be_Posts table should work.

Since there doesn't appear to be any new, modified or deleted columns in the SQL be_Posts table, I'm guessing there also aren't any changes in the data stored in the XML files.  What are the errors you get when you try to restore old data/posts?
Jan 24, 2009 at 9:32 PM
Hello, thanks for the feedback.

The old posts were also in the MSSQL database form I believe. The XML files in the App_Data folder that I was able to backup from the server all seem to be "initial setup placeholders" - I don't think any of the posts are stored in XML. What I do have is a backup of a database bre0814210432037.bak from the previous installation - it is about 3-4MB in size (compared to the new empty one being about 1MB in size) and I believe all of the post data is in there.

The errors I was getting, had to do with "error in line 12" referred to "be_roles" and "be_userroles" being unable to load properly (I failed to copy the exact sequence - I might have to go back in an "blow it up" again to generate the exact errors).

You refer to a v.13 to v1.4.5 upgrade script - maybe that is a direction I need to go - I don't recall doing anything like that. The problem with GoDaddy being so "automatic" about all of this is that when all is done, I don't know how I got there - if it worked, it wouldn't be bad - but since it doesn't I dont particularly know what steps I did that failed the process if that makes any sense.

Jan 24, 2009 at 10:20 PM
So it sounds like your posts, comments and other data is in the SQL database.  Your new database is probably already a BE 1.4.5 database.  I think you have two options ...

You can copy data from your backup into the live DB.  Data would include the posts, comments, categories, pages, tags, profiles, etc.  This probably requires some time to do.

I think the better option would be to restore your backup DB (the BE 1.3 DB) and then run the upgrade script.  I haven't done anything with GoDaddy recently, but I think they have a DB backup/restore option.  If you restore your backup DB, this will delete all your data/tables in your current DB.  Then after restoring, in the online Query Analyzer tool GoDaddy has, you can paste in the contents of the MSSQLUpgradeTo1.4.5.0From1.3.x.sql file and execute it.  If you download BE 1.4.5, you can find this upgrade script in the setup\SQLServer folder.
Jan 24, 2009 at 10:22 PM
I'm coming into this late, but if you have access to the DBs via Management Studio, you could possibly use Red Gates SQL Data Compare and SQL Compare to fix your issue. I believe.

Jan 25, 2009 at 8:02 PM
Below is the first error I get after restoring my old database into the new one - as I re-read the responses above and then I login and look at the actual database tables, I am beginning to (I think) understand what you are saying though - be_Roles is a "new" item in the table of the new database that does not show up in the old - I think... and there are others as you say... this is giving me some tools to work with, or at least think about - THANKS! I will continue to bang away at this, and update if/when I have more specific information


copy of error after restoring old database into current:

Invalid object name 'be_Roles'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'be_Roles'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): Invalid object name 'be_Roles'.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +925466
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800118
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1932
   System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31
   System.Data.SqlClient.SqlDataReader.get_MetaData() +62
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1005
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +122
   System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
   System.Data.Common.DbCommand.ExecuteReader() +9
   BlogEngine.Core.Providers.DbRoleProvider.GetRolesForUser(String username) in DbRoleProvider.cs:175
   System.Web.Security.RolePrincipal.IsInRole(String role) +272
   BlogEngine.Core.Web.Controls.BlogBasePage.OnLoad(EventArgs e) in BlogBasePage.cs:99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436

Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
Jan 25, 2009 at 8:08 PM
Yes, you're right that there are new tables and a modification to an existing table.  You should be able to run that upgrade script in the Query Analyzer tool GoDaddy offers which will make the necessary DB changes.
Jan 26, 2009 at 2:39 AM
OK - I was able to modify the tables with the data from the backup and get things up and running fine.

THANKS! for the tips.