Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Transaction logs

Author  Topic 

denkide
Starting Member

3 Posts

Posted - 2008-08-18 : 12:16:31
I have a question that i cannot find an exact answer to in other posts. I apologize if this is covered elsewhere.

I am trying to get a handle on my logs. I currently do a full backup and a log backup each night. I am trying to backup my log files each hour, but keep getting the error message that says that there is not a current valid database backup.

If i change the hourly backups to include a differential backup first, i can then backup the log files.

Am i doing this correctly or is there some better way of doing this?

I have read through many of the things that Kristen posted here (http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=How%20Backup%20works,What%20type%20of%20backup%20should%20I%20use,Automating%20Backups,Backup) but didn;t find an answer that will work for me.

thanks for any help.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-08-18 : 12:26:56
Are you truncating the transaction log at some point? If so, you are breaking the log chain, hence the error.

Do not truncate the logs, just backup the tlog more frequently to manage the tlog size.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

denkide
Starting Member

3 Posts

Posted - 2008-08-18 : 13:00:57
hi tara,

Thanks for the quick reply.
I changed the job to look like this

This is the nightly backup
-----------------------------------

BACKUP DATABASE [dbX]
TO
DISK = N'F:\VectorData_Files\PROD\backup\dbX.bak'
WITH
NOFORMAT,
INIT,
SKIP,
REWIND,
NOUNLOAD,
STATS = 10


BACKUP LOG [dbX]
TO
DISK = N'F:\VectorData_Files\PROD\backup\dbX_transaction.bak'
WITH
NOFORMAT,
INIT,
SKIP,
REWIND,
NOUNLOAD,
STATS = 10



This is the hourly backup
-------------------------------------

DECLARE @now char(14)
DECLARE @fileName varchar(200)

SET @now = REPLACE(REPLACE(REPLACE(CONVERT(VARCHAR(50), GETDATE(), 120), '-', ''), ' ', ''), ':', '')

SET @fileName = 'F:\VectorData_Files\PROD\backup\dbX_TRANS_' + @now + '.bak'

BACKUP LOG [dbX]
TO
DISK = @fileName
WITH
NOFORMAT,
INIT,
SKIP,
REWIND,
NOUNLOAD,
STATS = 10


So far it has worked.
I suppose time will tell ... unless you see anything that jumps out at you.

thanks for the help, Tara.
david
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-08-18 : 13:02:36
If you want a more flexible script, you can use mine:
http://weblogs.sqlteam.com/tarad/archive/2008/05/21/60606.aspx

Here are all of my database maintenance routines:
http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx

A new version of isp_Backup is coming out in a couple of weeks. I'm currently in the testing phase with the code changes.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-08-18 : 13:03:22
One more...here's how my production environments are setup:
http://weblogs.sqlteam.com/tarad/archive/2008/06/30/SQL-Server-jobs-on-production-instances.aspx

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

denkide
Starting Member

3 Posts

Posted - 2008-08-18 : 13:20:24
thanks!
Go to Top of Page

tanu
Yak Posting Veteran

57 Posts

Posted - 2008-08-18 : 17:31:21
Thanks, tara. Now I will use your stored procedure for mybackup routine.
I can create a tsql job that can run every day.

Right now I do one backup in the night and 8 transaction and 2 differential backup.
Do i need to take some precautions?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-08-18 : 17:33:44
I wouldn't recommend running 2 diffs during the day. Typically you run a diff so that you don't need to do a full backup daily. So some people will run full backups once per week and then differentials the other 6 days of the week.

I don't run any differential backups as part of my backup scheme. We've got the disk space to run fulls each night.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -