SqlException error after moving to a new server

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.

This thread is closed to new posts. You must sign in to post in the forums.
11/30/2011 5:28:29 PM
Gravatar
Total Posts 63

SqlException error after moving to a new server

I moved my site to a different server with the same structure and after I transferred all files and ran scripts to created all databases and stored procedures on the new server, I got this error:

Probing system...
File system permissions ok.
MSSQL database connection ok.
database permissions are sufficient to alter schema.
database initial schema already exists.
database core schema needs upgrade.
0 site(s) found.
Running script mojoportal-core - 2.2.1.9 - 00:00:00.5460000
System.Data.SqlClient.SqlException (0x80131904): Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at mojoPortal.Data.SqlHelper.ExecuteNonQuery(SqlTransaction transaction, CommandType commandType, String commandText, Int32 commandTimeout, SqlParameter[] commandParameters) at mojoPortal.Data.DBPortal.DatabaseHelperRunScript(String script, String overrideConnectionInfo) at mojoPortal.Data.DBPortal.DatabaseHelperRunScript(FileInfo scriptFile, String overrideConnectionInfo) at mojoPortal.Business.DatabaseHelper.RunScript(Guid applicationId, FileInfo scriptFile, String overrideConnectionInfo) - 00:00:01.3884000
Note: This page shows some information that is helpful during setup and upgrades but for security it would be best not to show any information when the system is up to date. You can disable setup and suppress all information on this page by setting DisableSetup=true in Web.config. When you need to upgrade, you can set this back to false. If you are logged in as Administrator setup will run and you will be able to see this page even if it is disabled in Web.config so you can easily leave it disabled and just login before upgrading. But if you are not logged in you will need to enable setup in Web.config.

Can someone help me to fix  the error?

Thanks,

Jeffrey

12/1/2011 6:32:19 AM
Gravatar
Total Posts 18439

Re: SqlException error after moving to a new server

How did you move the database, what specific steps? What did you use to generate the scripts?

What version of SQL server did you migrate from and what version did you migrate to?

Is the user in your connection string dbo?

Do all the objects still have dbo as part of the name?

What is happening is it knows it isn't a clean install because it detects the presence of the mp_Sites table, but it is not detecting the installed version correctly from the mp_SchemaVersion table so it is trying to run very old upgrade scripts that it should not run. On a new installation it starts with script 2.3.4.8, those older scripts are only for upgrading very old versions.

Actually it should not run any scripts if you are just moving a site and not trying to upgrade to a new version at the same time (it is better not to try that, best to move first make sure it works then upgrade). There are tools linked from our article Moving an Installation of mojoPortal to a Different Server that can script it correctly, the only other correct way is to create a backup and restore the backup. 

12/1/2011 8:20:50 AM
Gravatar
Total Posts 63

Re: SqlException error after moving to a new server

I moved two sites with the same method, and one of them worked well, but this one gave me the exception error.

I use SQL Management Studio to connect to my old database (SQL Server 2008) to generate scripts, then I connect to the new database (2008) and create the same username as the old database, then run the script to create all tables, stored procedures, etc. Then I use FileZilla to upload all web site files to the new server (they have the same structure).

I will try to kill the database and regenerate the whole thing one more time to see what is going to happen.

Could it also be possible that not all files were uploaded to the new server?

12/1/2011 8:49:41 AM
Gravatar
Total Posts 18439

Re: SqlException error after moving to a new server

Missing files would cause some errors but not affect the database and not manifest as errors on the setup page unless you are complicating the move by trying to upgrade at the same time. It should not run any scripts at all on the setup page if you just move a site and db is migrated correctly. The only time it should run an scripts is when upgrading or doing a new installation.

12/1/2011 9:11:37 AM
Gravatar
Total Posts 63

Re: SqlException error after moving to a new server

No, I am not doing upgrade at the same time, just moving the site to the new server. 

I tried again, but no success, the same error came up. All tables have dbo as part of the name.

12/1/2011 2:36:02 PM
Gravatar
Total Posts 63

Re: SqlException error after moving to a new server

I finally got Arvixe support team to detach my old database and attach it to the new server, now everything is back to normal. It seems that the script generated by SQL Management Studio is not working for this particular site, though it worked for another site of mine.

Thanks for you help.

You must sign in to post in the forums. This thread is closed to new posts.