Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

check full recovery dbs have tran log backups Expand / Collapse
Author
Message
Posted Sunday, September 23, 2007 9:29 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, November 22, 2013 8:54 AM
Points: 1,108, Visits: 204
Comments posted to this topic are about the item check full recovery dbs have tran log backups
Post #401813
Posted Wednesday, October 31, 2007 4:19 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, August 5, 2014 10:41 PM
Points: 1, Visits: 71
a nifty little script, I installed the SP on a couple of boxes and straightaway found some little databases no-one cared about enough to monitor that were on 'full recovery' but had no tran-log backups setup.
Post #417343
Posted Friday, November 2, 2007 8:42 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Friday, November 22, 2013 8:54 AM
Points: 1,108, Visits: 204
Hi,
that's exactly why i wrote it, people often forget to remove full recovery mode when they copy from a production environment, so it has caused me issues in the past.

Thanks

Paul
Post #417962
Posted Monday, December 17, 2007 7:13 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, November 11, 2013 9:08 AM
Points: 144, Visits: 200
/*
Why are you using temp table and using subquery? A subquery is not as efficient as a join or a derived table or an exists. The latter being the most optimal. This would have been far more efficient in typing and execution.

You have allocated a data type varchar(50) for the database name when this should have been syname or nvarchar(128) as per the system tables that you are refering to. This would fail for database with a name > 50 characters

I would like to have had the date of the last backup if I'm checking.
*/

DECLARE
@num_of_days int

SELECT @num_of_days = 7

SELECT
a.[name]
,b.DateLogLastBackedUp
,CASE
WHEN b.DateLogLastBackedUp IS NULL THEN 1
ELSE 0
END AS TransactionLogNeverBackedUpIndicator
FROM
master.dbo.sysdatabases a
LEFT JOIN
( -- gets the latest available transaction log backup if exists
SELECT
database_name
,MAX(backup_start_date) AS DateLogLastBackedUp
FROM
msdb.dbo.backupset
WHERE
type = 'L' -- Log backups only
AND
DATEDIFF(dd,backup_start_date,GETDATE()) > @num_of_days
GROUP BY
database_name
) b ON a.[name] = b.DateLogLastBackedUp
WHERE
DATABASEPROPERTYEX(a.[name],'Recovery') = 'FULL'
Post #433857
Posted Friday, February 20, 2009 9:42 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, September 8, 2014 3:55 PM
Points: 17, Visits: 840
The LEFT JOIN for the derived table in the example from stuart.adair should be on b.database_name (not b.DateLogLastBackedUp):

) b ON a.[name] = b.database_name




Post #661451
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse