Summary:

Users of Sage CRM may periodically experience a "You may need to recreate views manually" error when using Sage CRM. The issue can only be resolved by carrying out an IIS reset.



Symptoms:

The following error message appears onscreen

    You may need to recreate views manually.


In the eWare system log, the following errror appears:

    Apr 20 2015 11:12:50.559      12096 11744 1     SQLClasses->DatabaseLogin:ERROR:Class does not exist



Cause:

The “You may need to recreate views manually” error message generally refers to an issue raised the eWare DLL attempts to access a metadata object. Most typically, this is due to a connection failure on the database, but it may also be caused by the metadata being missing from the database.

In normal operation, Sage CRM constantly creates and destroys new connections as required. Should it attempt to create a new connection in order to load a metadata object (such as a screen), and SQL Server be unable to allow that new connection, the above error will be returned.



Resolution:

The "Class does not exist" error refers to an inability to establish a new connection to the SQL Server instance. By default, SQL Server will allow many thousands of concurrent connections. However, other applications connecting to the database server may not release their connections, eventually leading to a filure on the part of Sage CRM to connect to the database.

The following SQL statement will return a count of the connections currently open on the database, as well as the database name and the user associated with the connections:

SELECT DB_NAME(dbid) as DBName,
    COUNT(dbid) as NumberOfConnections,
   
loginame as LoginName
FROM sys.sysprocesses
WHERE dbid> 0
GROUP BY dbid, loginame

Using this, it may be possible to determine at a glance if another application is using an excessive number of database connections, or it is progressively using more connectiosn over time.

It is possilbe to derive more information regarding these connections, such as the first and last statements that have been executed on each connection. This may aid in identifying applications in the case where multiple applications are using the same username and password to connect to the database. The stored procedure attached below can be used to inspect connections for the database server at large, or for individual databases.

 

 Download: List all SQL Server connections with statements

 

In general, it is not recommended for external applications to interact with the Sage CRM database, since this may lead to performance issues within Sage CRM. However, it's worth noting that the issue described here may occur as a result of a flood of open connections to a database other than the Sage CRM database, and that it may be caused by commercial software as well as small custom applications.