SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Check Backups


Check Backups

Author
Message
SQLSACT
SQLSACT
SSCarpal Tunnel
SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)

Group: General Forum Members
Points: 4922 Visits: 2969
Comments posted to this topic are about the item Check Backups
ffarouqi
ffarouqi
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1115 Visits: 1409
Hi,

I would really appreciate if you could write a code which will get results from all the servers through linked servers, and could mail the DBA's with a really nice html formatted report.

Regards,
Faisal
The Wizard Of Oz
The Wizard Of Oz
Mr or Mrs. 500
Mr or Mrs. 500 (529 reputation)Mr or Mrs. 500 (529 reputation)Mr or Mrs. 500 (529 reputation)Mr or Mrs. 500 (529 reputation)Mr or Mrs. 500 (529 reputation)Mr or Mrs. 500 (529 reputation)Mr or Mrs. 500 (529 reputation)Mr or Mrs. 500 (529 reputation)

Group: General Forum Members
Points: 529 Visits: 314
A set-based, non-loopy way of doing a similar thing:


SELECT
DB_NAME(d.database_id)'DB',
ISNULL
('Backed up '+CAST(DATEDIFF(day,b.backup_start_date,GETDATE()) as varchar(10))+' days ago.',
'Never been backed up!'
)'Backup Info'
FROM sys.databases d
LEFT JOIN
(SELECT database_name,MAX(backup_start_date)'backup_start_date'
FROM msdb.dbo.backupset
GROUP BY database_name
)b ON b.database_name=DB_NAME(d.database_id)
WHERE DB_NAME(d.database_id)<>'tempdb'
ORDER BY 2 DESC, 1


DLathrop
DLathrop
SSC-Addicted
SSC-Addicted (498 reputation)SSC-Addicted (498 reputation)SSC-Addicted (498 reputation)SSC-Addicted (498 reputation)SSC-Addicted (498 reputation)SSC-Addicted (498 reputation)SSC-Addicted (498 reputation)SSC-Addicted (498 reputation)

Group: General Forum Members
Points: 498 Visits: 219
It's a good idea to check that the server_name column of msdb.dbo.backupset matches the server you are checking.

When you do a restore, if the backup set being restored isn't already in msdb.dbo.backupset, an entry will be created for it. This will be constructed based on the backup file's header and will have the name of the server and database that was actually backed up and the backup date. There will be a restorehistory record that references this backupset record, and will reflect the database that was restored to (possibly with a different name) and the restore date.

There are also some GUIDs and LSNs in a table called master.sys.database_recovery_status which can be compared with msdb.dbo.backupset to check if a backup set actually corresponds with the current database with the same name. Look in BOL under "Recovery Forks" for an explanation of what these mean.

If you do a restore, you typically should do a full backup right away. However, without some of this additional checking in msdb.dbo.backupset queries, it's easy to mistake the restore for a backup.

David Lathrop
DBA
WA Dept of Health
Iwas Bornready
Iwas Bornready
SSC-Insane
SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)

Group: General Forum Members
Points: 22330 Visits: 885
Thank you for your script.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search