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.
| Author |
Topic |
|
thj
Starting Member
8 Posts |
Posted - 2008-09-17 : 06:12:33
|
| Hi.I need to report the total size of all databases (including log), on all SQL servers in a domain.How can I get the total size of all databases on a single server?I've tryed "EXEC sp_MSforeachdb 'EXEC sp_spaceused'", and that kinda works but I need to sum all the sizes so I will get one number for the size of all databases.Could someone help me do that?Thanks in advance.Tommy. |
|
|
ranganath
Posting Yak Master
209 Posts |
Posted - 2008-09-17 : 06:38:15
|
| Hi,try with this EXEC sp_databases; |
 |
|
|
thj
Starting Member
8 Posts |
Posted - 2008-09-17 : 06:45:57
|
| Thank you.So now I've got this:CREATE TABLE #server_databases ( DATABASE_NAME nvarchar(200), DATABASE_SIZE int, REMARKS nvarchar(200))INSERT INTO #server_databases EXEC sp_databasesSELECT SUM(DATABASE_SIZE)/1024/1024 FROM #server_databasesDROP TABLE #server_databasesHow can I do this for each server (stored in a table), and return server_name and total size? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-17 : 07:11:47
|
quote: Originally posted by thj Thank you.So now I've got this:CREATE TABLE #server_databases ( DATABASE_NAME nvarchar(200), DATABASE_SIZE int, REMARKS nvarchar(200))INSERT INTO #server_databases EXEC sp_databasesSELECT SUM(DATABASE_SIZE)/1024/1024 FROM #server_databasesDROP TABLE #server_databasesHow can I do this for each server (stored in a table), and return server_name and total size?
One method is to use SSIS package to loop through server names from table and use sql task to connect to each and calculate the size. |
 |
|
|
|
|
|