I have W2k3 SBS running SQL 2005. I want to delete a SQL db. How can I tell if it is being used?
Thanks.
I have W2k3 SBS running SQL 2005. I want to delete a SQL db. How can I tell if it is being used?
Thanks.
You can use
select db_name(dbid) [database],T0.* from master..sysprocesses T0 WHERE db_name(dbid)='your database'
To see users and process connected to the database.
You let the server run for long enough to catch any activity, then you look into the last_user_xxx
columns in sys.dm_db_index_usage_stats for tables in your database. Any SELECT or INSERT/UPDATE/DELETE on any table during the lifetime of a server process will leave its imprint on those columns.