I have MS SQL 2008 R2, 500 databases. What is the most efficient, easiest and \'modern\' way to query all databases sizes.
The output should have columns:
All this examples work fine on most of my database servers. However if you have 1 server with multiple instances and all those servers those query's give you no result.
For instance the first query gives a result like:
name DataFileSizeMB LogFileSizeMB
master NULL NULL
tempdb NULL NULL
model NULL NULL
msdb NULL NULL
So the databases are selected from sys.databases
, however the table sys.master_files
seems to be empty or gives no result.
Even a simple query as select * from sys.master_files
has a result of 0 records.
You don't receive any errors but no records are found.
On my servers with only 1 database instance this works fine.