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
 General SQL Server Forums
 New to SQL Server Programming
 Reports for Database's!

Author  Topic 

Zoma
Yak Posting Veteran

76 Posts

Posted - 2008-11-04 : 02:53:11
Hi all

Does any one has an Idea how to create a Logs size graphs for a Database. Monthly or weekly. Maybe its different to other DBA's but i have to create a monthly report for all my checklist of the log files since October.

If any one has a clue how to do that or a tool you can use to do that Please Help!

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2008-11-04 : 03:22:12
If you create a daily job that stores size of log file with date in a table, you will get at the end of the month for whole month growth of log file.


DBCC SQLPERF(LOGSPACE)
GO


you put this code in scheduled job and when creating report, use data from this table and show growth of log file in graph.
Go to Top of Page

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2008-11-04 : 03:42:30
put this code in daily scheduled job (same time everyday)

/*
create table log_table
(
database_name nvarchar(255)
,log_size_MB decimal(10,3)
,log_space_used decimal(10,3)
,status char(10)
,date_time smalldatetime
)

*/

USE MASTER
GO
USE TEST
GO

declare @log_table table
(
database_name nvarchar(255)
,log_size_MB decimal(10,3)
,log_space_used decimal(10,3)
,status char(10)
)

insert into @log_table
execute sp_executesql N'dbcc sqlperf(logspace)'


insert into log_table
select
*
,getdate() as date_time
from @log_table


select * from dbo.log_table



and then create report (with graphs) -> it's very straightforward.
Go to Top of Page

Zoma
Yak Posting Veteran

76 Posts

Posted - 2008-11-04 : 07:18:19
Thanks a lot guys...can you be able to that for data size as well??

cOZ NOW THEY JUST ASKED ME TO GET A DATA TREND AGAIN!!
Thank you
Go to Top of Page
   

- Advertisement -