Hi @Gabriel Bulla ,
Changes to the state or options of database 'TasWebPruebas' cannot be made at this time. The database is in single-user mode, and a user is currently connected to it. ALTER DATABASE statement failed. (Microsoft SQL Server, Error: 5064)
Agree with Erland. As this error message mentioned, this database is in single user mode and a user is currently connected to it. There is an active connection to this database. Please follow below steps to resolve this issue.
- Identify the active connection: Run the following command to see which session is connected to the database:
EXEC sp_who2;
Please check the DBName column to look for the session ID (SPID) that is connected to your database.
2.Kill the active connection: Once you have identified the SPID, if possible, you can kill the connection using:
KILL {session_id};
Replace {session_id} with the actual SPID you found in the previous step.
3.We suggest setting database to multi-user mode if there is no need to set it to single-user mode. We can using:
USE master;
ALTER DATABASE TasWebPruebas SET MULTI_USER WITH ROLLBACK IMMEDIATE;
If the answer is helpful, please click "Accept Answer" and kindly upvote it.