Does anyone know how to get the size of a dabase that is hosted on a different server? I basicly want to monitor the size of that DB in a Job on my server.
I tried something like:
select db_name(dbid), str(convert(dec(15),sum(size))* 8192/ 1048576,10)
from [LINKEDSERVER].master.sys.sysaltfiles
group by dbid order by 2 desc
For some reason this gives me the data on my current server instead of the remote server.
Also, I’ve read on a forum that the sysaltfiles is only updated at server restarts? This would make it unusable for monitoring, so do you have a better option instead?
try this one , it works i checked