Question Locked

Automating SQLServer2000 DB maintenance in single user mode

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

We have a job that does the 'standard DB maintenance' ie "EXECUTE master.dbo.xp_sqlmaint N'-PlanID E4AB00A1-28E3-4A08-947F-61E6DD75D4B9 -To "Owen Evans" -Rpt "d:\data\MSSQL\LOG\DB Maintenance Plan12.txt" -WriteHistory -CkDBRepair '" from within normal Enterprise Manager.

However, I'm getting a message saying I need to do this in single user mode.

Not a problem to do manually! However, I want to modify the Maintenance Job to automate.

for example:
Step1...stop Sqlsrvr
Step2...start Sqlsrvr -m
Step3...start the maintenance job <

4 replies

by paultinnz

Thanks Peconet,

But what I want is the command line statement to stop "SQLServr" once it's in standalone mode.

Or is this facility made available on the understanding that it is an operator required function?

by paultinnz

As I'm only interested in non-system DB's I will use:
ALTER DATABASE dbname
SET SINGLE_USER

Now I will run the 'Integrity' Plan.

However, how do I stop other applications connecting and preventing my command being executed?

This discussion is closed to new replies.