Hi All,
Query to find the size of the database and database file is a simple and most common requirement. There are many ways & techniques to do this. Here are ‘just’ some of them:
Technique 1:
sp_helpdb
Gives you the database size and certain more properties of it:
Technique 2: For a specific database:
sp_helpdb'adventureworks'
And you get the following output: (this one gives you the database and data file information for a specific database)
Technique 3: be in the context of the database and run sp_spaceused
sp_spaceused
This is what you get:
Technique 4: use sys.master_files
SELECTDB_NAME(database_id)AS DatabaseName, Name AS LogicalName, size*8/1024 Size_in_MB, max_size FROMsys.master_files WHEREDB_NAME(database_id)='AdventureWorks' GO
HTH !
If there are more ways, do post a comment, would like to learn more. Thanks !
Regards
Rahul Sharma
Like us on FaceBook | Follow us on Twitter | Join the fastest growing SQL Server group on FaceBook
Follow me on Twitter | Follow me on FaceBook
Hi,
One more way is to use sp_databases.
http://msdn.microsoft.com/en-us/library/ms176070.aspx
thanks
Can some body tell me about ad hoc Queries? and wat it needs..
select * from sys.dm_db_file_space_usage
select*from sysfiles
select * from sys.dm_db_file_space_usage will only return the information for tempdb. This is by design
HI All,
I want to know the size of my SSAS database, the above queries will not give any info regarding SSAS databases and cubes.
Please help