August 5, 2020 at 9:44 am
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.
DBA
August 5, 2020 at 12:11 pm
Make sure your default db is not MyDBName and use:
WITH ROLLBACK IMMEDIATE
August 5, 2020 at 1:01 pm
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
August 5, 2020 at 5:01 pm
flouage, thank you, I'll try.
DBA
August 5, 2020 at 5:04 pm
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