473,804 Members | 3,271 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BACKUP LOG questions

aj
SQL Server 2005 SP2

Using SSMS, I've just backed up my transaction log (which is around 314
megs) on a smallish database. I purposely generated a bunch of dummy
transactions to grow the trans log.

I scripted the action in SSMS, and it said this:

BACKUP LOG [test] TO DISK = N'C:\data\test. trn' WITH NOFORMAT, INIT,
NAME = N'test-Transaction Log Backup', SKIP, NOREWIND, NOUNLOAD, STATS
= 10
GO

However, when its done, my trans log is still 314 megs. Shouldn't the
BACKUP LOG command truncate the log?

I used DBCC LOGINFO to figure out where the VLF w/ status=2 is, and its
at the bottom of the many VLF's which I think explains why the trans log
is not being truncated.

Why is this happening? How do I actually truncate the log?
When/Why would I use DBCC shrinkfile rather than relying on BACKUP LOG
to decrease the size of the log file?

Thanks in advance for any help..

aj

Jul 8 '08 #1
3 3728
aj
Some more info:

dbcc opentran says I have no open transactions

dbcc sqlperf(logspac e) says that I am using 4% of my log space for this
DB, w/ a log size of around 314 megs...

aj wrote:
SQL Server 2005 SP2

Using SSMS, I've just backed up my transaction log (which is around 314
megs) on a smallish database. I purposely generated a bunch of dummy
transactions to grow the trans log.

I scripted the action in SSMS, and it said this:

BACKUP LOG [test] TO DISK = N'C:\data\test. trn' WITH NOFORMAT, INIT,
NAME = N'test-Transaction Log Backup', SKIP, NOREWIND, NOUNLOAD, STATS
= 10
GO

However, when its done, my trans log is still 314 megs. Shouldn't the
BACKUP LOG command truncate the log?

I used DBCC LOGINFO to figure out where the VLF w/ status=2 is, and its
at the bottom of the many VLF's which I think explains why the trans log
is not being truncated.

Why is this happening? How do I actually truncate the log?
When/Why would I use DBCC shrinkfile rather than relying on BACKUP LOG
to decrease the size of the log file?

Thanks in advance for any help..

aj
Jul 8 '08 #2
The log file size does not change when it is backed up. The data
inside the log is truncated internally, and that space in the file is
now free. You can shrink the log (DBCC SHRINKFILE) but before you do
that you have to read the article:

http://www.karaszi.com/sqlserver/info_dont_shrink.asp

Roy Harvey
Beacon Falls, CT

On Tue, 08 Jul 2008 12:27:06 -0400, aj <ro****@mcdonal ds.comwrote:
>SQL Server 2005 SP2

Using SSMS, I've just backed up my transaction log (which is around 314
megs) on a smallish database. I purposely generated a bunch of dummy
transactions to grow the trans log.

I scripted the action in SSMS, and it said this:

BACKUP LOG [test] TO DISK = N'C:\data\test. trn' WITH NOFORMAT, INIT,
NAME = N'test-Transaction Log Backup', SKIP, NOREWIND, NOUNLOAD, STATS
= 10
GO

However, when its done, my trans log is still 314 megs. Shouldn't the
BACKUP LOG command truncate the log?

I used DBCC LOGINFO to figure out where the VLF w/ status=2 is, and its
at the bottom of the many VLF's which I think explains why the trans log
is not being truncated.

Why is this happening? How do I actually truncate the log?
When/Why would I use DBCC shrinkfile rather than relying on BACKUP LOG
to decrease the size of the log file?

Thanks in advance for any help..

aj
Jul 8 '08 #3
aj
Thanks for clarifying this, Roy. I believe I grok it now, and for me,
the key was to understanding the difference between allocated space and
used space. I was mixing the 2 up.

DBCC SHRINKFILE is used to shrink the /allocated/ space, assuming that
there is available non-used (free) space in the file. The allocated
space is the total size of the file on the file system.

A BACKUP LOG is used to back up, and then truncate the /used/ space that
is within the allocated space. This does not change the size of the
allocated space - it only affects how much of that allocated space is
actually used.

A trans log can be 100 megs in size, and you can be using only a few
megs of actual space in it. You can check this w/
DBCC SQLPERF(LOGSPAC E).

thanks

aj
Roy Harvey (SQL Server MVP) wrote:
The log file size does not change when it is backed up. The data
inside the log is truncated internally, and that space in the file is
now free. You can shrink the log (DBCC SHRINKFILE) but before you do
that you have to read the article:

http://www.karaszi.com/sqlserver/info_dont_shrink.asp

Roy Harvey
Beacon Falls, CT

On Tue, 08 Jul 2008 12:27:06 -0400, aj <ro****@mcdonal ds.comwrote:
>SQL Server 2005 SP2

Using SSMS, I've just backed up my transaction log (which is around 314
megs) on a smallish database. I purposely generated a bunch of dummy
transactions to grow the trans log.

I scripted the action in SSMS, and it said this:

BACKUP LOG [test] TO DISK = N'C:\data\test. trn' WITH NOFORMAT, INIT,
NAME = N'test-Transaction Log Backup', SKIP, NOREWIND, NOUNLOAD, STATS
= 10
GO

However, when its done, my trans log is still 314 megs. Shouldn't the
BACKUP LOG command truncate the log?

I used DBCC LOGINFO to figure out where the VLF w/ status=2 is, and its
at the bottom of the many VLF's which I think explains why the trans log
is not being truncated.

Why is this happening? How do I actually truncate the log?
When/Why would I use DBCC shrinkfile rather than relying on BACKUP LOG
to decrease the size of the log file?

Thanks in advance for any help..

aj
Jul 8 '08 #4

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

Similar topics

1
16232
by: Andrew E | last post by:
I just took over DBA responsibilities for an Oracle 8i database running on Linux. Although I've been working with relational databases for some time, I'm a bit green on Oracle so forgive me. My first task was to implement a backup strategy (currently there is none). I did a great deal of research both on this board and using the Oracle Press 8i handbook. I made a cold backup (with oracle shutdown) and sucessfully moved it from my...
1
1530
by: John S | last post by:
Hi All, I have several questions about checking backup file : a. When SQL Server receive a command : BACKUP DATABASE test to DISK = '\\pc1\netdb\BTEST', does it verify BTEST file before ending the job ? b. Is there any special command for checking / verifying a backup file ? c. If I send a restore command using a file infected
4
1474
by: Jay | last post by:
I've recently inherited a position where I am responsible for the well-being of some DBs. 2 (much) more important than others. The current recovery model, from what I can tell, is to do a full db/log backup overnight. This .bak file is then written to tape as well as saved on the disk for 2 days. Both these dbs are used fairly extensively 8-5pm and losing data would not be good.
2
2113
by: Matt | last post by:
I run SQL Server 2000 and use thier database maintenance plans to backup my databases. My questions is what happens if a change is being made to a database table while a backup is running? Should I be locking the databases before the backup begins? Scenario: 1) Database Plan begins backup at 7:00 PM. 2) At 7:01 PM a web user updates their password while the backup is taking place.
5
2310
by: jag | last post by:
hi, I am thinking about backup strategy. I have couple of questions for my db2 community brothers. 1. Can i use full online or offline database backup as base for incremental backup for tablespace? For example, if i take backup of database A which contain tablespace X1,X2, can i take full offline or online backup of A and then take incremental backup of X1,X2?
3
4381
by: dcruncher4 | last post by:
It is possible that we may be asked to restore a production tape, say 3 yrs later. We would prefer redirect restore for that. I am documenting a process to do a redirect restore. We take production backups via Legato. The big question is that how to get information about tablespace and containers from the tape backup. A search on this told me that db2ckbkp is the command to go for. I tested it on a backup residing on unix file system...
5
4996
by: abelbfilho | last post by:
I have a backup image with name DADOSADV.0.DB2.NODE0000.CATN0000.20060812230006.001 and I want to restore it on Windows (in another server). In Windows Server I created this folder structure: D:\DADOSADV.0\db2\NODE0000\CATN0000\20060812\ and rename the backup image file to 230006.001 When I type (Prompt DOS) db2ckbkp -H 230006.001 and I receive this result ===================== MEDIA HEADER REACHED:
4
20504
by: aj | last post by:
DB2 LUW v8.2 FP 14 RHAS 2.1 I have a DB2 online DB backup that was done w/ the INCLUDE LOGS option. I am interested in restoring that backup, and rolling forward ONLY the logs contained in the backup and no more, then bringing the DB online. I do not want to use a userexit to try and retrieve additional logs - I only want to roll forward the logs in the backup. (In case you haven't guessed, I am restoring a test version of my
1
4489
by: ARC | last post by:
Does anyone know if you can add your own items to the round office button in the top left? I'm guessing the answer is no, and that you can only hide the default items, but it would be great if you could add your own. Reason being, I have a setup options screen, and a backup utility that would go perfectly there for my custom app. As it stands, I'm not quite sure where to put them, or where to put an old-style "File, Register..." type screen...
2
3704
by: clilush | last post by:
I've been working with db2 8.2fp14 for over a year now and was wondering what is a "standard" way of doing a backup to provide 24/7 operations with disaster recovery capabilities? My thoughts were an offline backup once per quarter, followed by a monthly online backup, followed by daily backups of the logfiles. BUT it's the details of each that I'm wondering... 1- how can i tell what logfiles need to be backedup? is there a way to "trim"...
0
9576
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
10568
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...
0
10323
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10074
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...
1
7613
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
6847
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
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4292
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.