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


Backup location


Backup location

Author
Message
latokiro
latokiro
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 6
Hi Friends,

How we can get the history of the database backed up.

Thank you very much.
dwayne.bace
dwayne.bace
SSC Journeyman
SSC Journeyman (84 reputation)SSC Journeyman (84 reputation)SSC Journeyman (84 reputation)SSC Journeyman (84 reputation)SSC Journeyman (84 reputation)SSC Journeyman (84 reputation)SSC Journeyman (84 reputation)SSC Journeyman (84 reputation)

Group: General Forum Members
Points: 84 Visits: 84
Here's some code that will give you what you want.

SELECT BS1.database_name,
(SELECT sum([size])/128 from sys.master_files
where ((database_id = DB_ID(BS1.database_name)) AND (type_desc='ROWS'))) as database_size_MB,
ISNULL(DateDiff(minute, BS1.backup_start_date,getdate()) , 99999) as minutes_since_last_backup,
BS1.backup_start_date,
BS1.backup_finish_date,
cast(BS1.backup_size /1024/1024 as int) as backup_size_MB,
BF1.physical_device_name
FROM msdb..backupset BS1 join msdb..backupmediafamily BF1
on BS1.media_set_id = BF1.media_set_id join
(
SELECT database_name as database_name,
MAX(backup_finish_date) as backup_finish_date
FROM msdb..backupset BS join msdb..backupmediafamily BF
on BS.media_set_id = BF.media_set_id
WHERE BS.Type='D'
GROUP BY database_name, type
) LB
on LB.database_name = BS1.database_name and LB.backup_finish_date = BS1.backup_finish_date
WHERE BS1.database_name NOT IN ('tempdb')
AND DatabasePropertyEx(BS1.database_name,'Status') = 'ONLINE'
AND DatabasePropertyEx(BS1.database_name,'Updateability') = 'READ_WRITE'
ORDER BY BS1.database_name
Adiga
Adiga
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3280 Visits: 21012
To add to the list, you can make use of the scripts mentioned here

Pradeep Adiga
Blog: sqldbadiaries.com
Twitter: @pradeepadiga
latokiro
latokiro
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 6
Thank you very much Dawne and Adiga!! I really appreciate your help!!
Sree Divya
Sree Divya
SSCrazy
SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)

Group: General Forum Members
Points: 2535 Visits: 421
Thanks Good Scripts for the BACKUP LOCATIONS
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