Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Retrieving memory usage from all databases

Author  Topic 

attinder3731
Starting Member

1 Post

Posted - 2011-07-07 : 07:15:17
hi,

I want to retrieve Memory used,available memory and %used by all the databases present.
I am using 'FILEPROPERTY' to get the details, but this is used only for the current database.
I want to retrieve this data form all the databases present.

Kindly suggest something.

Thanks
Attinder.

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-07-07 : 07:39:28
Think you mean disk space rather than memory.
try

EXECUTE sp_msforeachdb 'select * FROM .sys.database_files'


==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

vaari
Starting Member

15 Posts

Posted - 2011-07-07 : 09:45:09
Alternatively you could use the sys.master_files view which can be executed from the context of any database.

And if you are looking for memory usage per database - http://www.johnsansom.com/how-much-memory-is-each-sql-server-database-using/#axzz1RQfSMY6i
Go to Top of Page
   

- Advertisement -