Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Posts
    32

    Unanswered: Backing up log when recovery set to Simple

    I have a job that I created that backs up transaction logs on a server that has many databases on it. If a db recovery model is set to simple, I want the job to skip over that database, rather then trying to backup the log.

    It would be easy to just let it try, and fail, however, the job status will show failed, even if it backs up all database logs, and only fails on one. Is there a way to easily programatically detect if a db is set to simple, and then I can skip backing up that db log?

    Thanks
    Tommy

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    SELECT DATABASEPROPERTYEX('Northwind','Recovery')
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Sep 2003
    Posts
    32
    Thanks brett, that's what I needed, in case anyone else is interested, here's the syntax I'm using:

    Declare @Recovery_Model nvarchar(20),
    Select @Recovery_Model = CONVERT(nvarchar(20), DATABASEPROPERTYEX( @Database_Name , 'Recovery' ))
    if (@Recovery_Model = 'SIMPLE')
    PRINT 'Simple Mode so skip'
    else
    PRINT 'do the needful'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •