Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Reduce the size of Transaction Log FIle


Reduce the size of Transaction Log FIle

Author
Message
Mathew M.Varghese
Mathew M.Varghese
SSC Journeyman
SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)

Group: General Forum Members
Points: 87 Visits: 127

Hi All,

SQL Server Version : SQL Server 2000 8.0.194

My one production database Transaction Log size is more than 10GB. But data file size is only 1 GB.

I try to reduce the side of the logfile using shrink data file, again the size is not reducing.

How can I reduce the size of a log file .

Please advice

Mathew


Ian Yates
Ian Yates
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1056 Visits: 445
Are you using simple or full recovery? If using full, backup the transaction log, or switch to simple recovery mode which will truncate the log at various intervals.



webtekkie
webtekkie
SSC-Enthusiastic
SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)

Group: General Forum Members
Points: 128 Visits: 354

Hi Matthew,

Here is the command you need to run to carry out Ian's suggestion.

backup log <DB Name Here> with truncate_only

After this, you need to consider the backup solution you require for this db, then set the database recovery mode as Ian suggests.

Best regards,

Martin





Mathew M.Varghese
Mathew M.Varghese
SSC Journeyman
SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)

Group: General Forum Members
Points: 87 Visits: 127

I did the following

1. Change the recovery model to simple

2. issue the commnad backup log <DB Name Here> with truncate_only. But this time file size not changed. FIle size is still 10 gb . But uses only 25 MB

3. When i try to reduce the log size using enterprise manager, sql showing message "error 21335, New DB File size must be larger than current size'

Pls explain me how can i reduce the physicial Transaction file size

Mathew


webtekkie
webtekkie
SSC-Enthusiastic
SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)SSC-Enthusiastic (128 reputation)

Group: General Forum Members
Points: 128 Visits: 354

Matthew,

What you have effectively by running the backup log command is emptied the water out of a bucket. The contents of the bucket are gone, but the bucket still remains, if you catch my drift.

To shrink the file, you must now run the following...

dbcc shrinkfile (<virtual file name here> )

and it will then shrink back to it's original size. To find the virtual file name, run sp_helpfile from within the context of the target database.

Hope that helps,

Martin





J Wright
J Wright
Grasshopper
Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)

Group: General Forum Members
Points: 21 Visits: 24

I've found this script to work best for us.

http://www.sqlservercentral.com/scripts/viewscript.asp?scriptid=26

Good Luck!


vambati
vambati
SSC-Enthusiastic
SSC-Enthusiastic (151 reputation)SSC-Enthusiastic (151 reputation)SSC-Enthusiastic (151 reputation)SSC-Enthusiastic (151 reputation)SSC-Enthusiastic (151 reputation)SSC-Enthusiastic (151 reputation)SSC-Enthusiastic (151 reputation)SSC-Enthusiastic (151 reputation)

Group: General Forum Members
Points: 151 Visits: 15

As said in BOL:

USE UserDBGODBCC SHRINKFILE (DataFil1, 7)GO

"Datafill" is the logical file name and u need to difine a size the file needs to be shrinked to. Try with 9000 (GB) to start with. Once the file has been reduced to 9 GB go for another GB less. Seems to be in SQL 2000 if u have less phisical disk space - basically less then the log file DBCC SHRINKFILE takes forever to shrink the log. By reducing it by chunks its more faster and efficient. I had the same issue 2 days ago and this solution took care of it. post a note if this works.

Good Luck.





Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search