检查超过7天未备份的db


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58
SELECT  
dbs.[name] AS DatabaseName 
FROM    master.sys.databases dbs
where dbs.database_id <> 2  
AND dbs.[name] NOT IN		
	(	SELECT 
		bus.database_name as 'name'
		FROM msdb.dbo.backupset bus
		INNER JOIN msdb.dbo.backupmediafamily bume ON bus.media_set_id = bume.media_set_id
		WHERE 
		dbs.database_id <> 2 
		AND dbs.is_in_standby = 0 
		AND dbs.source_database_id IS NULL 
		AND dbs.[state] <> 1 
		AND bus.backup_finish_date >= DATEADD(d, -7, GETDATE())
	
	)