You can prevent access to the database needed to be compacted in serveral ways.
If it is a mail database stop the "Router task".
The "Agent manager" Task can be stopped too.
The "HTTP" task may also cause issues and can be stopped.
The Indexing tasks can be stopped too.
Make sure backup software isn't running, and that the virus scanner isn't doing a deep scan.
On the console use "drop all", or "drop user", or "drop path\database".
Make sure program documents are not configured to run at that time.
This can all be done using program documents or by hand.
This works very well.
Sincerely
Douglas Bryant
email@dbryant.de
www.dbryant.de