ALTER DATABASE Issue

  • Hello,

    I faced  very strange issue.

    When I try from management studio to put the specific database to RESTRICTED_MODE, the operation succeeded,

    but when I try to do it from the operation script, I receive a message :

    "Msg 5070, Level 16, State 2, Line 3

    Database state cannot be changed while other users are using the database 'MyDBName'

    Msg 5069, Level 16, State 1, Line 3

    ALTER DATABASE statement failed."

    Thank you.

     

    • This topic was modified 3 years, 8 months ago by  genadyd.

    DBA

  • Make sure your default db is not MyDBName and use:

    WITH ROLLBACK IMMEDIATE

  • many times it is due to the fact that your query is running against the MyDBName database and so there is an open connection.

    Frank

  • flouage, thank you, I'll try.

    DBA

  • Hi,

    WITH ROLLBACK IMMEDIATE option did not helped me.

    But your suggestion about "default db is not MyDBName", I will try it.

    Thanks.

     

    DBA

Viewing 5 posts - 1 through 4 (of 4 total)

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