473,396 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Transaction log shrinking... weird behavior?!?!?!?

Hi!

I'm studying to have my MCSE 70-228 certification and I'm trying some
things with backing up transaction logs and shrinking it.

Here's what I do:

There is no activity in the database by the way.

I have a transaction log of 1792 kb...

I do the following command:

BACKUP LOG TestDB TO TestDBBackup
DBCC SHRINKFILE ('TestDB_Log',0)

The transaction log is now 1280 kb

I do the same command and finally my transaction log is now 1024kb...

Any idea why it didn't shrink it at 1024 kb the first time?

Thanks!

Jeff

Jul 23 '05 #1
1 1611
(je******@globetrotter.net) writes:
I'm studying to have my MCSE 70-228 certification and I'm trying some
things with backing up transaction logs and shrinking it.

Here's what I do:

There is no activity in the database by the way.

I have a transaction log of 1792 kb...

I do the following command:

BACKUP LOG TestDB TO TestDBBackup
DBCC SHRINKFILE ('TestDB_Log',0)

The transaction log is now 1280 kb

I do the same command and finally my transaction log is now 1024kb...

Any idea why it didn't shrink it at 1024 kb the first time?


Dunno really. Books Online says that if you don't specify a
target size, the file shrinks to its default size. But I seem to
recall that this is not the true story.

In any case, I think it is a good idea to always specify a target size,
particularly with a transaction log. The log file may have swollen to,
say 1GB, because of some unusual operation. Shrinking it all the way
down to 1024 kB would be a bad idea, because the file grow again, and
the autogrows costs in performance. So shrinking to a reasonable target
size is a better idea.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bucfan1 | last post by:
Hello All, I have been encountering trouble with a SQL Server 2000 Transaction log file, mainly with the constant growth and lack of the autoshrink option. Here are the details: 1.) OS is...
3
by: Daniel Xiao | last post by:
I have set the initial size of the log file for a database to 1M, the maximum size is unrestricted, and the increase rate is 10%. However, when I attempt to delete thousands of rows, the error is...
5
by: BashiraInTrouble | last post by:
Hi Friends, I have tried almost everything but I cant seem to shrink the transaction log. Executing DBCC SQLPERF(LOGSPACE) gives me this info: Database Log Size (MB) Log Space Used (%) ...
7
by: John Bailo | last post by:
I'm seeing some odd locking behavior when using an DB2400 database and running an ado.net transaction. My code -- in simplified form, appears at the bottom. I want to run several INSERT...
2
by: Charles MacLean | last post by:
How can I truncate and shrink the transaction log under SQL 2000? My log is 10 GB in size and I assume most of the transactions are committed. Thanks
4
by: yashgt | last post by:
Hi, We have created a SQL server 2000 database. We observe that the transaction log keeps growing over time. We are now about to run out of space. We have been periodically shrinking the...
3
by: sifrah | last post by:
Hi All, My SQL server transaction log is getting bigger every day and my HDD if running out of space. So i follow the MS KB about how to Shrinking the Transaction Log. After doing so the log is...
2
by: Agnes | last post by:
Recently , I find that there is timeout occur when runing 'select . statement' Some said the Transaction Log too large will make SQL become slowly Now, the transaction log is 14407M , is it too...
0
by: kazper | last post by:
Good day, I have some problems regarding my Hard disk space for my logs in SQL Server 2005. When I try shrinking the database it returns an error not letting me to do anything about the size of...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.