473,662 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1627
(je******@globe trotter.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****@sommarsk og.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
30115
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 Windows 2000 server sp3 2.) SQL Server 2000 (Build 2195) sp3 3.) Database Recovery Mode is set to Full 4.) Maintenance Plan for "Transaction Log Backup" is set to remove files older then 1hr.
3
5232
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 still reported that the transaction log file is full. Why can't the log file increase automatically? *** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it!
5
18321
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 (%) Status MY_eems 368.49219 16.034182 0 I made a complete backup of the database and transaction log and then executed this statement: DBCC SHRINKFILE (MYeems_log, 1)
7
5612
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 statements using the same iDB2Connection and iDB2Command. Then I want to Commit() so that either all the data goes in, or not. What happens though is this:
2
1999
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
13216
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 database. Nevertheless the size has increased. I would imagine that a transaction log can be eliminated if we stop the database. Can that be done? Is there a way to completely wipe off the transaction log? Thanks,
3
2696
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 much much smaller as i can see the size of it under enterprise manager. The problem is that the HDD still shows the same size. If i shrink the DB why the and reduce its size why the HDD does not
2
1096
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 large ? Can I delete it ? (Do I need to do backup first ?)
0
1293
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 the file. Is there any way that I can delete the used transaction logs in my LOG File to free some disk space that I need. I cannot delete or add any new files on my database, because the transaction log file is full. My database is set AUTO GROW...
0
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8344
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8546
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7367
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5654
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.