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
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 DB Stats & Information

Author  Topic 

marcus.vanwyk
Starting Member

2 Posts

Posted - 2010-06-15 : 08:53:47
Hi Guys.

Can someone please assist me.

We have SQL Server 2008, this server contain about 40 - 50 DB that have been created over the last few years, and I would like to start consolidating the DB's and getting rid of those we do not use any more.

Can someone help me with a script that will show me the following if possible.

DB Name
MDF Location
LDF Location
DB Data File Size
DB Log File Size
Date Last accessed / Read or Write (If possible)

Any help / pointers would be appreciated.

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-06-15 : 10:36:58
For all but the last, query sys.databases and sys.master_files.

The last access (read/write) to a DB is not logged anywhere in SQL. If you want that, you need some form of trace.

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -