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
 Transact-SQL (2008)
 Track the Database Daily growth siz

Author  Topic 

imughal
Posting Yak Master

192 Posts

Posted - 2012-04-18 : 03:18:36
hi,

I need to track the SQL 2008 DB and log , Daily growth Size..,How much it is increasing .....

http://gallery.technet.microsoft.com/scriptcenter/ec6abcda-e451-4863-92ed-8648fdfc67ac

http://gallery.technet.microsoft.com/scriptcenter/f1df9f50-9cd9-4c75-a8d9-e2faba6b8574

i got 2 reference link but they are calculating on month basis i want to know increase on daily basis. pls guid me to get on daily basis, where to update script to get growth daily basis.

thx.

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-04-18 : 07:28:37
Looking at the first script, seems like all you have to do is change the two lines of code where the date calculation and grouping from monthly basis to daily basis:

....
DATEDIFF(dd, @startDate, BS.backup_start_date) AS DaysAgo
....
GROUP BY BS.database_name
,DATEDIFF(dd, @startDate, BS.backup_start_date)
...
However, two things:

a) I have not tested the code, nor have I run it. What I said is based on just looking at it.

b) He is doing static pivoting in the outer query limited to 12 columns. So you will get data only for 12 days if you keep it exactly like that. You may want to avoid the pivoting altogether, or expand it if you need more days.
Go to Top of Page

prett
Posting Yak Master

212 Posts

Posted - 2012-04-19 : 02:02:15
Use following query to check growth size of log file:

sp_helpdb <db_name>
Go to Top of Page

granuharmot
Starting Member

31 Posts

Posted - 2014-09-23 : 05:07:53
unspammed
Go to Top of Page
   

- Advertisement -