Issue

During the upgrade you might run into one of the following 2 errors in your Installer trace:

"The object with name '{SMO Name}' already exists.

23:04:50:>> ExecuteSqlScript.Execute: Logged Error: Script execute failed: System.Exception: Script execution exception: Microsoft.SqlServer.Management.Common.ExecutionFailureException: An exception occurred while executing a Transact-SQL statement or batch. ---> System.Data.SqlClient.SqlException: The object with name '{SMO Name}' already exists."

OR:

"System.Data.SqlClient.SqlException: Cannot find the object '{SMO Name}', because it does not exist or you do not have permission."

For more information regarding Installer Traces, please see: http://help.k2.com/onlinehelp/k2five/icg/5.1/default.htm#install/installerlogfiles.htm

Symptoms

There are a couple of scenarios that might contribute to the errors:

  1. There are multiple SmartObjects with the same name being set to be the latest version.
  2. SmartObjects are in an inconsistent state.

    To verify if your SmartObjects are in an inconsistent state, use your SmartObject Tester Utility and expand the SmartObject and the SmartObject Method. If your SmartObject Icons change to red "X" icons, then your SmartObject is in an inconsistent state:
    Image
  3. During the Upgrade to K2 5.1 when the installer moves SmartObjects to the new schema and there is a duplicate table for the SmartObject (e.g. [dbo].[SmartObjectName] & [SmartboxData].[SmartObjectName]).

    For more information regarding the Schema Change please see: https://help.k2.com/onlinehelp/k2five/userguide/5.1/default.htm#Whats-New-Five/Whats-New-Five.htm%3FTocPath%3DWelcome%7C_____2

    Behavioral Changes
    SmartBox schema – Custom created SmartBox objects will now reside in their own dedicated database schema called SmartBoxData. System SmartBox objects will continue to reside in the dbo database schema. In addition, a new SQL role called SmartBoxData_readonly makes it simpler to secure your business data for read-only purposes. When upgrading existing K2 installations, custom SmartBox data will be moved to the new schema and database synonyms will be created to ensure existing stored procedures or functions dependent on those database names will continue to function. Note that the schema change has an impact on Package and Deployment: existing and new packages will be deployed to the [dbo] schema, but after upgrade any new or existing packages are deployed to the new [SmartBoxData] schema.

Troubleshooting Steps

Please contact K2 Support and request the 'Diagnostic Scripts'.

The version specific SQL Script needs to be executed against the K2 Database. Once the script has completed, the output should look like the image below (Depending on the symptom):

Image

SQL Script Output Key:

SmartObjectGUID

SmartObjectSysName

SmartboxObjectGUID

SmartObjectTable

PhysicaTable

Physical Schema

Notes

SmartObjectGUID = {GUID}

SmartObjectSysName = {SMO Name}

SmartboxObjectGUID = {GUID}

SmartObjectTable = {Table Name}

PhysicaTable = NULL

Physical Schema = NULL

Indicates that the physical table of the SmartObject could not be resolved.

SmartObjectGUID = {GUID}

SmartObjectSysName = {SMO Name}

SmartboxObjectGUID = NULL

SmartObjectTable = NULL

PhysicaTable = {SMO Name}

Physical Schema = {Schema}

Indicates that the SmartBox definition of the SmartObject could not be resolved.

SmartObjectGUID = {GUID}

SmartObjectSysName = {SMO Name}

SmartboxObjectGUID = NULL

SmartObjectTable = NULL

PhysicaTable = NULL

Physical Schema = NULL

Indicates that both the physical table and the SmartBox definition of the SmartObject could not be resolved.

SmartObjectGUID = NULL

SmartObjectSysName = NULL

SmartboxObjectGUID = {GUID}

SmartObjectTable = {Table Name}

PhysicaTable = {SMO Name}

Physical Schema = {Schema}

Indicates that the SmartObject definition could not be resolved.

SmartObjectGUID = NULL

SmartObjectSysName = NULL

SmartboxObjectGUID = {GUID}

SmartObjectTable = {Table Name}

PhysicaTable = NULL

Physical Schema = NULL

Indicates that both the SmartObject definition and the physical table could not be resolved.

SmartObjectGUID = NULL

SmartObjectSysName = NULL

SmartboxObjectGUID = NULL

SmartObjectTable = NULL

PhysicaTable = {SMO Name}

Physical Schema = {Schema}

This could indicate that there are duplicate tables across the [dbo] and [SmartboxData] schemas.

SmartObjectGUID = NULL

SmartObjectSysName = NULL

SmartboxObjectGUID = {GUID}

SmartObjectTable = {Table Name}

PhysicaTable = NULL

Physical Schema = NULL

This could indicate that there are multiple SmartBox definitions for a single SmartObject which are claiming to be the latest version of the SmartBox definition.

SmartObjectGUID = NULL

SmartObjectSysName = NULL

SmartboxObjectGUID = {GUID}

SmartObjectTable = {Table Name}

PhysicaTable = NULL

Physical Schema = NULL