Database Tool (or dbtool) is a standalone executable distributed with Miranda IM. The file is named dbtool.exe and is located in the Miranda root folder (typically C:\Program Files\Miranda IM\dbtool.exe). The database tool is mainly used for deleting unused space in the database (i.e. profile) thus making it smaller. The database tool can also be used for fixing a number of other database related problems, for example marking multiple events as read.
Database Tool behavior doesn't depend on which protocols or plugins are currently active in the database in question. It doesn't remove any history or settings (unless you tell it to do so or they're corrupted beyond repair).