How to migrate the site from a database to another

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

3/14/2024 11:00:56 AM
Gravatar
Total Posts 12

How to migrate the site from a database to another

Hi Joe,

I haven't attempted to solve the problem I encountered while upgrading from version 2.7 to 2.9.0.1, as I'm facing another issue with a different site.

This site is running Mojoportal version 2.4.1.0, and the MS SQL version is 3.8.

I need to migrate the site from one MS SQL database to another, both on different servers but using MS SQL. After performing a backup and restore between the databases, Aruba's staff confirmed that the databases are identical. However, I'm encountering an error when I point to the newer server/database in the web.config file.

Welcome to mojoPortal Setup

Verifica del sistema...
Privilegi del File system ok.
MSSQL connessione al database ok.
i privilegi per il database sono sufficienti per modificare lo schema.
lo schema database iniziale gia' esistente.
lo schema centrale del database necessita aggiornamento.
0 sito(i) trovati.
Questo sito sembra operare in un ambiente protetto che usa policy Medium Trust o, almeno, inferiori a Full Trust.

Esecuzione script mojoportal-core - 2.2.1.5 - 00:00:00.0716842

An Error Occurred:Invalid object name 'MSSql7XXXX.mp_SchemaVersion'.

Source:.Net SqlClient Data Provider

Stack Trace at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at mojoPortal.Data.SqlHelper.ExecuteReader(String connectionString, CommandType commandType, String commandText, Int32 commandTimeout, SqlParameter[] commandParameters) at mojoPortal.Data.SqlParameterHelper.ExecuteReader() at mojoPortal.Data.DBPortal.SchemaVersionGetSchemaVersion(Guid applicationId) at mojoPortal.Data.DBPortal.SchemaVersionExists(Guid applicationId) at mojoPortal.Web.UI.Pages.SetupHome.RunUpgradeScripts(Guid applicationId, String applicationName, String pathToScriptFolder, Version versionToStopAt) at mojoPortal.Web.UI.Pages.SetupHome.UpgradeSchema(String applicationName) at mojoPortal.Web.UI.Pages.SetupHome.RunSetup() at mojoPortal.Web.UI.Pages.SetupHome.Page_Load(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

Although I'm not an expert in databases, I believe that the string "MSSql7XXXX.mp_SchemaVersion" is referring to the old database prefix, whereas the current one should be "MSSql2XXXXX".

Upon comparing the tables between the two databases, I noticed that ARUBA's staff  has renamed the new database and tables with the prefix of the new database account name "MSSql2XXXXX" without my consent.

Is this the right approach?

Is there a way I can resolve this issue on my end, or do I need to request Aruba's staff to address it on their end?

Thank you,

Roberto
 

 

 

 

 

   

 

3/14/2024 11:14:30 AM
Gravatar
Total Posts 12

Re: How to migrate the site from a database to another

I've Just found a valid explanation to solve this problem at this page:
https://www.mojoportal.com/docs/migrating-mojoportal-to-a-new-server
 

Steps to Move a Site

Create a backup of your database on the source machine and restore it on the target machine. A common newbie mistake here is that people try to just import the tables from one database to another. That does not work--you lose all primary keys, foreign keys, and indexes; and it fails to get the stored procedures. You must restore the backup using the tools provided by the database platform like SQL Management Studio or whatever tools your host may provide. If for some reason it is not possible to restore a backup, you may also be able to use this tool to script off all the objects and data into a script that can be run on the target machine. Then you could run this script in a new empty database to restore all the database objects and data.


however the link to download the undefined tool required to copy the database is landing on another undefined page over Microsoft site.

 

3/15/2024 10:20:14 AM
Gravatar
Total Posts 2239

Re: How to migrate the site from a database to another

Hi Roberto,

So the "MSSQL 3.8" thing is very odd because the first version of SQL Server for Windows was 4.21 back in 1993. I'm not surprised Aruba is giving you this as a version though because we've had a lot of trouble with Aruba Hosting over the years, especially with their SQL hosting. mojoPortal requires at least MSSQL 2016.

If you'll switch to different hosting, your problems will likely disappear. Our hosting is very good and we'll help you migrate. Hosting with us also helps support the mojoPortal project.

I'm updating the migration article to point to new tools.

Thanks,
Joe