Single User Mode

  • I have put an individual DB into single user mode by executing the following:

    ALTER DATABASE dbName SET SINGLE_USER WITH ROLLBACK IMMEDIATE

    When executed no errors are returned and users are unable to connect to the database. I then tried to recreate the index and repair the db but the job fails with a message of:

    [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.

    Can anyone explain why this is happening? The job also fails if I don't manually set it to single user mode.

    Thanks

  • are you the onlyone working on that issue ?

    Check your db-status again ! (sp_helpdb)

    When putting a db in single-user , I suggest you also check privilagedusers(dbo)-only so you're sure only a dbo can access the db.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Yes, it is our test server and no-one else is connected or working on this.

  • What if you put it all in a single batch:

    ALTER DATABASE dbName SET SINGLE_USER WITH ROLLBACK IMMEDIATE

    go

    DBCC CHECKDB ( 'dbName' ?? REPAIR_ALLOW_DATA_LOSS  | REPAIR_FAST  | REPAIR_REBUILD )

        WITH   ALL_ERRORMSGS

     

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Check Management - Current Activity - Locks / Object in Enterprise Manager to see what else might be going on in the database.

    If all else fails, restart SQL Server and see if it starts to cooperate.

  • Thanks to you both, Alzdba's suggestion is working so I'm using this for the moment until I can determine an exact maintenance plan to utilise.

    Regards

    David

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply