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 2000 Forums
 SQL Server Administration (2000)
 Log file Errors

Author  Topic 

jai2808
Starting Member

27 Posts

Posted - 2006-10-23 : 01:52:33
Hi All,
I have got an issue with the log file in production environment.The log file grows enormously.How can i control this.Currently I am having a job and in the job i have given the steps to clear log, i just want to check whether the steps i follow is correct
Step1:dump tran xxxxxxx with truncate_only
Step2:DBCC SHRINKDATABASE (N'xxxxxxxx', 0,TRUNCATEONLY).
Is this the correct method to control my log file.If this is wrong could some one please tell me the steps to shrink log file periodically and back up the database.My recovery model is full.

dewacorp.alliances

452 Posts

Posted - 2006-10-23 : 02:37:44
The one that you expalin is for emergency one
For the emergency one:

1. BACKUP LOG [DBNAME] WITH TRUNCATE_ONLY
2. DBCC SHRINKFILE ('LOG_FILE_NAME, SIZE)
3. FULL BACKUP

But ideally you should back up the transaction logs regularly let say 15 minutes or even 5 minutes.

Thanks
Go to Top of Page

jai2808
Starting Member

27 Posts

Posted - 2006-10-24 : 02:34:01
Hi valdyv,
Thanks for the reply, but i have a small doubt.As you had mentioned the steps i am already using as emergency one, but the steps mentioned by you also reads as emergency one.
For the emergency one:

1. BACKUP LOG [DBNAME] WITH TRUNCATE_ONLY
2. DBCC SHRINKFILE ('LOG_FILE_NAME, SIZE)
3. FULL BACKUP
And what should be size when i use DBCC SHRINKFILE ('LOG_FILE_NAME, SIZE) command.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-10-24 : 03:57:48
"The log file grows enormously"

How enormous? More than 120% of the size of the MDF file? If not then that's normal running and probably best to just leave it alone.

If > 120%, and assuming you are a novice (sorry if not!) please check this:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=Why%20is%20my%20LDF%20Log%20File%20so%20big

in general terms you should not shrink the log - bad practice except for exceptional, one off, circumstances - such as "I just deleted a shed load of stale data and want to get the file size back to something more appropriate"

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=Database%20Shrinking,Shrink,Shrinking

Kristen
Go to Top of Page
   

- Advertisement -