Table of Contents

Database objects may be created in the wrong schema during upgrade

Summary

When upgrading a database, the database is accessed using the user account that has launched the command prompt and thus the limefu database upgrade command. If this user has a default schema in the database that is not dbo, database objects may be created in different schemas which makes the system unusable.

Symptoms

Users are not able to log in.

Resolution

Make sure the user accessing the database has dbo as its default schema in SQL Server. If database objects have been created using the wrong schema, use the following T-SQL query to find objects that have the wrong schema and to create ALTER statements to change the schema:

SELECT 'ALTER SCHEMA dbo TRANSFER [' + SysSchemas.Name + '].[' + DbObjects.Name + '];'
FROM sys.Objects DbObjects
INNER JOIN sys.Schemas SysSchemas ON DbObjects.schema_id = SysSchemas.schema_id
WHERE SysSchemas.Name = '<wrong username>'
AND (DbObjects.Type IN ('U', 'P', 'V'));

Example of an ALTER statement:

ALTER SCHEMA dbo TRANSFER lje.lsp_addtemptable;

Affected products

All 12.x versions of Lime CRM Server.

From version 12.16 you will get a warning if the user does not have “dbo” as the default schema.

Questions?

Please contact our support team if you have questions regarding any of the above.