SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Ho do I know if a DB has ever been backed up?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mitin
Yak Posting Veteran

81 Posts

Posted - 12/10/2012 :  15:18:40  Show Profile  Reply with Quote
Hi, I have a SQL server 2000 DB on my network and I need to know if the database has ever been backed up, and/or if these backups occur on a regular basis.

The DB is using the full recovery model, so I guess if there are backups being performed these would be full, differential and transaction log (although I suppose you can still choose which of these you want to occur with the full recovery model, maybe?).

Anyway, I need to know, I'd like to know how to do this through both the GUI and SQL queries, but either way will do to get the job done, from googling, it seems pretty hard to find a concrete answer.

Hope you don't mind this question, thanks for any help :)

Edited by - mitin on 12/10/2012 15:19:52

tkizer
Almighty SQL Goddess

USA
37157 Posts

Posted - 12/10/2012 :  16:35:26  Show Profile  Visit tkizer's Homepage  Reply with Quote
Take a look at the backup* system tables in the msdb database.

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

Subscribe to my blog
Go to Top of Page

jackv
Flowing Fount of Yak Knowledge

United Kingdom
2067 Posts

Posted - 12/11/2012 :  01:56:40  Show Profile  Visit jackv's Homepage  Reply with Quote
The relevant tables are : backupset, and backupmediafamily . They join on the "media_set_id" column

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page

mitin
Yak Posting Veteran

81 Posts

Posted - 12/11/2012 :  05:16:36  Show Profile  Reply with Quote
Thanks guys, I can see in the backupset family that one backup has been taken before, that is all, looks like this wasn't scheduled and just a manual backup when required that one time.

If scheduled backups occurred, say every week for example, then there would be an entry for each of these in this table right?

thanks for the info!
Go to Top of Page

jackv
Flowing Fount of Yak Knowledge

United Kingdom
2067 Posts

Posted - 12/11/2012 :  07:11:12  Show Profile  Visit jackv's Homepage  Reply with Quote
Yes , there would be entries. Unless someone clears down the tables
Use this query for view the backup history - http://www.sqlserver-dba.com/2012/06/display-sql-backup-history-for-a-single-database.html
Jack Vamvas
--------------------
http://www.sqlserver-dba.com

Edited by - jackv on 12/12/2012 01:50:25
Go to Top of Page

shiyam198
Yak Posting Veteran

94 Posts

Posted - 12/11/2012 :  11:04:02  Show Profile  Reply with Quote
I usually go to the database and run this

SELECT TOP 100
s.database_name,
m.physical_device_name,
CAST(CAST(s.backup_size / 1000000 AS INT) AS VARCHAR(14)) + ' ' + 'MB' AS bkSize,
CAST(DATEDIFF(second, s.backup_start_date,
s.backup_finish_date) AS VARCHAR(4)) + ' ' + 'Seconds' TimeTaken,
s.backup_start_date,
CAST(s.first_lsn AS VARCHAR(50)) AS first_lsn,
CAST(s.last_lsn AS VARCHAR(50)) AS last_lsn,
CASE s.[type]
WHEN 'D' THEN 'Full'
WHEN 'I' THEN 'Differential'
WHEN 'L' THEN 'Transaction Log'
END AS BackupType,
s.server_name,
s.recovery_model
FROM msdb.dbo.backupset s
INNER JOIN msdb.dbo.backupmediafamily m ON s.media_set_id = m.media_set_id
WHERE s.database_name = DB_NAME() -- Remove this line for all the database
ORDER BY backup_start_date DESC, backup_finish_date
GO

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000