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


Backup location


Backup location

Author
Message
latokiro
latokiro
SSC Rookie
SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)

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

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

Thank you very much.
dwayne.bace
dwayne.bace
SSC Veteran
SSC Veteran (244 reputation)SSC Veteran (244 reputation)SSC Veteran (244 reputation)SSC Veteran (244 reputation)SSC Veteran (244 reputation)SSC Veteran (244 reputation)SSC Veteran (244 reputation)SSC Veteran (244 reputation)

Group: General Forum Members
Points: 244 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
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11690 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
SSC Rookie
SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)

Group: General Forum Members
Points: 33 Visits: 6
Thank you very much Dawne and Adiga!! I really appreciate your help!!
Sree Divya
Sree Divya
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3107 Visits: 439
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