2 Handy SQL Scripts
ForceDatabaseOffline:
USE master
GO
ALTER DATABASE YourDatabaseName
SET OFFLINE WITH ROLLBACK IMMEDIATE
GO
ShowOpenConnections:
SELECT
DB_NAME(dbid) as DBName,
COUNT(dbid) as NumberOfConnections,
loginame as LoginName
FROM
sys.sysprocesses
WHERE
dbid > 0
GROUP BY
dbid, loginame
;
The Tool that is love is SP_Blitz
httpv://www.youtube.com/watch?v=5QAL9itupMA
Do need to do some SQL Maintenance, i have for you some handy URLs:
https://ola.hallengren.com/
https://www.brentozar.com/