Question

Locked

Automating SQLServer2000 DB maintenance in single user mode

By paultormey ·
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 <<????
Step4...stop Sqlsrvr
Step5...start Sqlsrvr

Any examples or advice greatly appreciated.

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Read more here...

http://searchsqlserver.techtarget.com/tip/1,289483,sid87_gci1112905,00.html#

Please post back if you have any more problems or questions.

Collapse -

Automation of SQLServr -m with subsequent shut

by paultormey In reply to Read more here...

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?

Collapse -

Set DB to single user

by paultormey In reply to Automation of SQLServr -m ...

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?

Back to IT Employment Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums