exec master..dbd_listdb

This function lists the encrypted database names and their access status.
This function is not needed for the core functionality of DbDefence. However, the Client DLL does rely on this feature to define whether or not DbDefence is installed on that server and if there are any encrypted databases. If this function does not list any databases, then the Client DLL will not display any dialog.

Note: On SQL Server Express databases, there is a default option called AUTO_CLOSE ON. This feature is always ON when you attach or create a database. If it is ON then the SQL server unloads unused database from the memory. This behavior may lead to confusion. dbd_listdb will not display unloaded database and Client DLL will not display the login dialog as expected.

To solve this problem, set AUTO_CLOSE OFF for the encrypted database by entering the following command:


You will need to do it every time you attach a new database to the server. You can see the current AUTO_CLOSE status for all the databases by entering the following command:

select name,DATABASEPROPERTY ( name, 'IsAutoClose') from sysdatabases


By default, this option is set to OFF (0) on all SQL Server editions except Express.