This is a script that I have found very helpful when it comes to managing a SQL server without any fancy tools.
It returns a list of the dBs in an instance with the size of the associated MDF and LDF files, as well as their location.
====================
declare @sql varchar(4000)
declare @db varchar(64)
set @db=''
SELECT @db=min(name)
FROM sysdatabases
WHERE name NOT IN ('master','msdb','tempdb') -- all system databases
and name > @db
while @db is not null
begin
set @sql='use '+@db+'
SELECT ''' + @db + ''' as DBName, sysfiles.size * 8/1024 AS SIZE_kb, sysfiles.filename
FROM sysfiles'
exec (@sql)
SELECT @db=min(name)
FROM sysdatabases
WHERE name NOT IN ('master','msdb','tempdb')
and name > @db
end
====================
It returns a list of the dBs in an instance with the size of the associated MDF and LDF files, as well as their location.
====================
declare @sql varchar(4000)
declare @db varchar(64)
set @db=''
SELECT @db=min(name)
FROM sysdatabases
WHERE name NOT IN ('master','msdb','tempdb') -- all system databases
and name > @db
while @db is not null
begin
set @sql='use '+@db+'
SELECT ''' + @db + ''' as DBName, sysfiles.size * 8/1024 AS SIZE_kb, sysfiles.filename
FROM sysfiles'
exec (@sql)
SELECT @db=min(name)
FROM sysdatabases
WHERE name NOT IN ('master','msdb','tempdb')
and name > @db
end
====================