|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 2:37 PM
Points: 983,
Visits: 2,924
|
|
Does any one know a simple query that would give following information about all databases on an insance? 1. Database Name 2. Created Date 3. Modified date (if any changes made to any table in a particular db) 4. Size of the DB Name. 5. Database last read (NOTE: i do weekly backups so wanted to make sure i am not pulling backup date instead of read date)
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Yesterday @ 12:37 PM
Points: 5,
Visits: 62
|
|
Hi, try the following query, hope it helps.
SELECT * FROM sys.databases
Regards, Asa_M
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Yesterday @ 7:29 AM
Points: 765,
Visits: 328
|
|
For a starter in relation to DB_Name, Create date and size the following will work. This looks only at the 1st data file and ignores the log files but can be amended if you have multiple data files by adding the additional file to the in statements
SELECT sd.name, sd.create_date, (sm.size*8)/1024 AS SizeMB from sys.databases sd JOIN sys.master_files sm on sd.database_id = sm.database_id where sm.file_id IN (1)
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Yesterday @ 12:37 PM
Points: 5,
Visits: 62
|
|
| hs24, the SizeMB is the size for what exatly? the whole database?
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Yesterday @ 7:29 AM
Points: 765,
Visits: 328
|
|
| The sizeMB is for the size of the data file
|
|
|
|