I'm with a simple task to migrate databases.
I'm doing the backup in the primary database, setting it to OFFLINE, and then, migrating it to the secondary.
No problem at all.
but I notice something strange.
I check if someone is using the database with
sp_WhoIsActive, and it shows nothing.
Then I use
alter database X set offline.
Then it doesn't change it at all, and the query keeps running. Then I check again to see if something is using the database, and for my surprise, it shows something running for 22hrs, 20hrs, or 44min.
sp_WhoIsActive show it?
Alter etc etc set offline. Then it locks, and I check again with
Bam. Something running.