aj (ro****@mcdonalds.com) writes:
In SQL Server, it looks as if the notion of transaction log backup is
based on /time/ rather than log size. When I use Maintenance Plans to
create a log backup plan, it wants to know WHEN to back the log up.
When the I/O in the database is not consistent, this can make the size
of your logs vary quite a bit. For example, on Sundays, when my
database is fairly quiet, I see /really/ small transaction log backups..
Well, it is a good idea to ask yourself *why* you take transaction log
backups. If the only reason is to keep the transaction log down in
size, you should consider simple recovery.
The normal reason to backup the transaction log is to be able to
restore to a point in time in case of a catastrophic failure. It may
be a quiet day in terms of transaction log growth, but 1000 new orders
were inserted and then your log disk goes capoot. If the data disk
fails, you can still back up the translog, but if the log disk you
are in trouble. And since it was a quite day, you find that the
log-size threshold you set up was never reached, and those 1000 orders
are lost.
I think the question most businesses ask is: how many minutes of data can
we afford to lose in case of a failure?
This leads to a few questions:
1. Is it possible to back up SQL Server transaction logs based on size
rather than time?
You could set up an Agent job that checks the log size, and goes to
sleep again if the limit has not been exceeded. But that's a more complex
operation that just backing up the transaction log in the first place.
2. Even if there is, is this a good idea?
No.
3. Is there another method to back up transaction logs other than maint
plans/Agent? Perhaps one that uses size as its determination?
Well, you can use Windows Task Scheduler, if you dislike Agent for some
reason. You could also define a startup procedure that perfoms:
WHILE 1 = 1
BEGIN
WAITFOR DELAY '00:10:00'
BACKUP LOG db TO ...
END
Whatever, since log backups should be taken regularly, there is all
reason to schedule them. But you don't need maintenenance plans. The
advantage with maintenance plans is that the name the files uniquely,
and delete them after a while. If you were to run BACKUP LOG directly
from an Agent job, you would have to cater for this yourself. Then
again, that is not exactly rocket science.
SQL Server SP2 9.0.3042 64-bit
Beware! There is a very serious bug with maintenance plans in that version
which causes DBCC CHECKDB to run in the same database when you schedule
it for many.
Get hold of version 9.0.3073 which is publically available. It also includes
two security fixes, whereof one looks quite serious.
--
Erland Sommarskog, SQL Server MVP,
es****@sommarskog.se
Links for SQL Server Books Online:
SQL 2008:
http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005:
http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000:
http://www.microsoft.com/sql/prodinf...ons/books.mspx