Groups | Blog | Home
all groups > sql server (alternate) > october 2004 >

sql server (alternate) : Newbie backup Question


Greg D. Moore (Strider)
10/31/2004 4:12:06 AM

[quoted text, click to view]

The Full will only be complete up through any committed transaction at the
time of its finish.

Now, if you do a full once a day (say at 1:00 AM), you can restore to that
point.

But let's say your DB crashes at 11:00 PM. You've lost 22 hours worth of
transactions.

If you do a transaction backup say every hour, you could restore up through
the 10:00 PM log and lose less data.

[quoted text, click to view]

See above.

[quoted text, click to view]
size.

Right.

You have a couple of options here.

If you don't care about transaction log backups (i.e. do the "restore once a
day, don't care if I lose lots of data") then set the DB to simple recovery
mode.

However, generally you DO care about transaction log backups, which means
you should do them.

In that case your log will generally stay much smaller and you can then
shrink it to a reasonable size.

Hope that helps some.


[quoted text, click to view]

Dan Guzman
10/31/2004 12:55:46 PM
To keep your log size manageable in the future, either backup the
transaction log periodically (FULL or BULK_LOGGED recovery model or set the
recovery model to SIMPLE so that committed transactions are periodically
removed from the log. The proper choice depends on your recovery plan as
described by Greg. Once you've setup log backups or use the SIMPLE model,
you'll only need to shrink the log when the log grows unusually large due to
an large transaction.

--
Hope this helps.

Dan Guzman
SQL Server MVP

[quoted text, click to view]

Fred
10/31/2004 2:58:19 PM
I have a table in sql 2000 that is storing Financial Tick data. The database
size now appears at about 30GB and I have decided to backup the database and
store the data offsite.

Here is where I am confused about whether only a Database (complete) backup
is necessary or whether I must also include a Transaction log backup for the
most recent data.

1. If I use a complete Database backup only, will all my data be stored on
this? (Even if I have never done a Transaction log backup)

2. My Database size Data.MDF is 500MB and the Log.LDF is 30GB. If I complete
a database Backup can I now get rid of this Log file, or is it also storing
data that is necessary???? I noticed on Books online that it states
following a log file backup that it truncates the inactive portion of the
transaction log, which would hopefully decrease this enormous log file size.

Thank you for your help

Fred
10/31/2004 3:34:00 PM
Thank you, starting to make sense now.

I just did a transaction log backup but unfortunately the Log.LDF is still
30GB. I was hoping that it would be extremely small now.

I am assuming that the Log.LDF has all my transactions going back for the
last two months since the databse was created. Is there some method for me
to reduce this file to say on the last couple days of transactions?

Why would SQL not have the option for this huge transaction log to be wiped
when I did the full database backup. Am I missing somethting here on the log
files purpose?

Thanks.



[quoted text, click to view]

Fred
10/31/2004 4:29:46 PM
I managed to find the information here.
http://support.microsoft.com/default.aspx?scid=kb;en-us;272318

Backed up the log with TRUNCATE _ONLY and then ran DBCC SHRINKFILE.

Worked like a charm.


[quoted text, click to view]

Erland Sommarskog
10/31/2004 4:29:54 PM
Fred (Fred@hotmail.com) writes:
[quoted text, click to view]

It is quite clear that it you have a 500 MB data file and a 30 GB log file
that you have not full understanding of the purpose transaction log, yes.

The normal procedures is to backup log at least as frequently as often
you backup the database. Often more frequently. If you do this, the log
will not grow to 30 GB for a database of your size.

SQL Server does not shrink the log automatically, because shrinking
something that will grow again is not a good idea, since growing takes
machine power.

As noted by Greg and Dan, you should make the decision whether you want
full/bulk-logged recovery or simple. If you choose simple, you don't have
to bother about the transaction log, but if the database crashes in the
afternoon, you lose all ticks for that day, assuming that you took a
full backup at midnight. So my guess is that you should stick with full
recovery and backup the translog regularly.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
AddThis Social Bookmark Button