
i got an error while executing a database maintenance plan. looking into it closer, revealed that the plan was performing an integrity check with the repair option set.
here's a sample of the log file...
Microsoft (R) SQLMaint Utility (Unicode), Version Logged
on to SQL Server '1s' as 'NT AUTHORITY\SYSTEM' (trusted)
Starting maintenance plan 'DB Maintenance Plan1' on
7/31/2003 2:00:02 AM
[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 5070:
[Microsoft][ODBC SQL Server Driver][SQL Server]Database
state cannot be changed while other users are using the
database 'r'
[Microsoft][ODBC SQL Server Driver][SQL Server]ALTER
DATABASE statement failed.
[Microsoft][ODBC SQL Server Driver][SQL Server]sp_dboption
command failed.
[1] Database rbcs: Check Data and Index Linkage...
[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 7919:
[Microsoft][ODBC SQL Server Driver][SQL Server]Repair
statement not processed. Database needs to be in single
user mode.The following errors were found:
[Microsoft][ODBC SQL Server Driver][SQL Server]Repair
statement not processed. Database needs to be in single
user mode.
** Execution Time: 0 hrs, 0 mins, 1 secs **[2] Database t: Check Data and Index Linkage...
** Execution Time: 0 hrs, 0 mins, 2 secs **
you get this error because the maintenance plan is trying to put the database into single user mode. it fails because there is a user (or at least an open transaction) in the database. (it's attempting to do this so it can
perform a 'dbcc checkdb with repair').
if you want the integrity check to complete without reporting this error, remove the repair option.