HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

SQL 2005: Can we determine how much the rebuild index maintenance job can grow database log files?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
canthemuchlogsqlrebuilddatabasemaintenance2005grow

Problem

On SQL server 2005, if all the databases are in Full mode (with hourly transaction log backups), is it possible to determine if rebuilding all indexes of a database can grow log file of a database? And how much can it grow?

If there is no straight answer then any directions would be really appreciated.

Thanks in advance.

Solution

Yes, you should look at the excellent whitepaper on this topic although it refers to the online index rebuild, it still has lot of good info

http://technet.microsoft.com/en-us/library/cc966402.aspx

If the log files are auto growing then you can find that information using the default trace after the action is completed.

DECLARE @filename VARCHAR(255)
SELECT @FileName = SUBSTRING(path, 0, LEN(path)-CHARINDEX('\', REVERSE(path))+1) + '\Log.trc'
FROM sys.traces
WHERE is_default = 1;

--Check if the data and log files auto-growed. Look for tempdb, log files etc.
SELECT
gt.ServerName
, gt.DatabaseName
, gt.TextData
, gt.StartTime
, gt.Success
, gt.HostName
, gt.NTUserName
, gt.NTDomainName
, gt.ApplicationName
, gt.LoginName
FROM fn_trace_gettable gt
JOIN sys.trace_events te ON gt.EventClass = te.trace_event_id
WHERE EventClass in ( 92, 93 ) --'Data File Auto Grow', 'Log File Auto Grow'
ORDER BY StartTime;
--

Context

StackExchange Database Administrators Q#3110, answer score: 9

Revisions (0)

No revisions yet.