Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Mathias
Posting Yak Master
119 Posts |
Posted - 2005-02-14 : 02:06:20
|
| I need to run a maintenance plan but I get the following message :[Microsoft][ODBC SQL Server Driver][SQL Server]Repair statement not processed. Database needs to be in single user mode.Is there a way to switch the server by code (eject all users, put in in single user mode), run the maintenance plan and switch back to normal with T SQL code?Thanks, Paul |
|
|
Mathias
Posting Yak Master
119 Posts |
Posted - 2005-02-14 : 02:32:11
|
| I have tried to insert two extra steps but it doesn't seem to work. I have also tried to do it all in one single step but then the 2 alter database desepair when I close the job window.ALTER DATABASE GFS_LUX_DB1 SET SINGLE_USER WITH ROLLBACK IMMEDIATEEXECUTE master.dbo.xp_sqlmaint N'-PlanID 06B51F42-E9C9-4CBB-BA9A-8AB6EFE1976D -RebldIdx 10 'ALTER DATABASE GFS_LUX_DB1 SET MULTI_USER WITH ROLLBACK IMMEDIATEAny idea? |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-02-14 : 11:18:21
|
| As a first step can you try running the first ALTER DATABASE and EXECUTE from Query Analyser to see if that works?I use that syntax when I do a restore, and it seems to work OK.Kristen |
 |
|
|
|
|
|