Error. Could not load file or assembly (or enumerating SQL databases). Error in SQL server plug-in

On this page

Error message

Message logs in the Management Console of the Backup & Disaster Recovery appliance show one of the following errors related to Microsoft SQL Server backup:

MSSQL: error: backup of database `XXX` on `XXXXX` server instance failed unexpectedly: Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=9.0.242.0, Culture=neutral, PublicKeyToken =89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
MSSQL: error: unexpected System.IO.FileNotFoundException exception while attempting backup: Could not load file or assembly 'Microsoft.SqlServer.Smo, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

SQL Backup tab within RVXConfig may also show:

Error enumerating sql databases: Could not load file or assembly 'Microsoft SqlServer.Smo, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

Steps to resolve

This error means that the necessary version of the SQL Server assemblies are not available on the client computer.

If the error indicates you are looking for version 10 the client version is newer than 3.4 and you will want the SQLServerCompatibility2008 file.

If the error indicates we are looking for version 9 (in the above example, Version=9.0.242.0), the client version is 3.4 or earlier, and you will want the SQLServerCompatibility file.

The version of the Shared Management Objects (SMO) that you need to install is based on the backup agent, not the version of SQL you are running. If the client you are running is 3.4 or later, you will need to install the 2008 SMO, if the client you have is earlier than 3.4 you will need the 2005 SMO.

Please note that loading the 2005 SMO (version 9) on a 2008 SQL Server is in no way downgrading. Also, while the 2008 entire pack is not compatible with a 2005 SQL server, the SMO alone are compatible and should not cause any problems with the SQL Server.

The SQLServerCompatibility2008 file SMO require the Microsoft System CLR Types for SQL Server 2008 R2 SQLSysClrTypes.msi file be installed as a prerequisite for installing the Microsoft SQL Server 2008 R2 SMO.

It turns out SQL 2008 R2 Reporting Services SharePoint 2010 Add-in will make the 2005_Xmo.msi install fail with an error Higher version already installed. This may affect you if you have Small Business Server, as SharePoint comes bundled with this system.

Uninstalling the reporting services will resolve this issue.