Latest backup size - max(backup_finish_date)

Why does this query return multiple rows per database?
select database_name, backup_size, max(backup_finish_date)
from msdb.dbo.backupset
where database_name = 'Ditest' and type='D'
group by database_name, backup_size
order by backup_finish_date desc
SQL Server 2008r2, enterprise edition
Dianne

Hmm, ROW_NUMBER() was introduced in SQL Server 2005, so as long as it's not SQL 2000, the above query should work fine. Otherwise there are other ways to get the top row and as I said, if you're looking for particular database, then just use top 1 query.
If you want this to work for all DBs, then check Tibor's query.
You can also see these blogs 
http://social.technet.microsoft.com/wiki/contents/articles/19670.t-sql-useful-links.aspx#Select_Top_N_Rows_per_Group
and pick up any of other solutions from these blogs that work in lower versions of SQL Server.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles

Similar Messages

  • Limiting Time Machine backup Size with WD MyBookLive and 10.8

    I cannot take credit for the any part of this solution; merely for merging and clarifying how the solutions discovered by 2 Apple Support Communities contributors much smarter than I (namely “Pondini” – Florida and  “himynameismarek”) - worked perfectly for my situation. All cudo’s to these two!
    I have about average or better PC skills, but am an absolute newbie with Apple. This week I got a new iMac. Having a number of home PC’s all sharing files and back up space on a Western Digital MyBookLive (“WD MBL”) 3TB network drive (NAS), naturally I wanted to use it to backup the new Mac rather than rushing out to buy an Apple Time Capsule.
    There are hundreds of threads on limiting size of a Time Machine (“TM”) backup, many of which required entries in “Terminal” or were devised on older versions of OSX. I’m running OSX Mountain Lion 10.8, so was concerned they may not work.
    The issues I wanted to resolve were:
    Time Machine will use up all of the space on my WD MBL if left to it’s own devices.
    The WD MBL is compatible with Mac and PC’s… which is good… but unlike a back up in Windows 7 Pro which will allow you to make backups in a mapped “share” you create yourself, Apple TM Backups will not; they end up in a hidden folder on the NAS (much like PC backups done with WD Smartware)
    At first I thought maybe I could limit the size of a share created in the MBL, but not possible, at least not that I've seen and I have searched for days.
    The solutions:
    First make sure you have the latest firmware for the WD MBL as of today it is MyBookLive 02.11.09-053. From what I’ve read Western Digital fixed the compatibility issues with 10.8 Mountain Lion just recently.
    Next you need to start TM so that it starts to create a back up. You can stop the back up once you see files being copied. Do this before you walk thru the video tutorial by my Marek below. WD MBL will create the hidden folder you need to find for TM Backups. This folder is called “TimeMachine” but it is not visible even in the “MBL_NAME-backup” folder in Finder.
    Open safari and type “ afp://xxx.xxx.x.xxx ” but use your own ip address of your MBL. Mine was 192.168.1.120, yours will be different.
    It will ask how you want to connect. CHOOSE AS A GUEST even if your MBL is protected… I’m not sure why it works but it does. Then a window will come up asking which share you’d like to mount. You will see all of your own shares plus one called software and now one called “TimeMachine”. Choose that one.
    Now in “Finder” you will see a mounted shared item called “YOUR_MBL_NAME-“ (the same as the one that is probably already there but with a dash(-) at the end). You’ll also see a new “device” in the device list called “Time Machine Backups” (If you already have watched the video tutorial by Marek, you’d know you are looking for a file called “YOUR_MACHINE_NAME.sparsebundle”. Well if you browse the folder “Backups.backupdb” in the Time Machine Backups device you won’t find it… again I don’t know why but you won’t. It resides in the hidden folder called “TimeMachine” that is now visible in the thing you just mounted in step 4)
    NOW watch this video tutorial http://youtu.be/Nq7mSizqUSI and follow it step by step.
    Voila... issues resolved. Thank you Pondini and Marek!

    Try Use Terminal to limit Time Machine sparcebundle size on timecapsule,
    should work to limit Time Machine backup size on any NAS or external disk (or not...)
    sudo defaults write /Library/Preferences/com.apple.TimeMachine MaxSize 500000
    to return to ilimited
    sudo defaults delete /Library/Preferences/com.apple.TimeMachine MaxSize
    if you want to reclame deleted files space shrink it use
    hdiutil resize -size 500g -shrinkonly /Volumes/TimeMachineYOURNAME/YOURNAME.sparsebundle/
    Regards

  • DB read_only backup size increase

    Hi Experts,
    Have below 3 queries. Kindly enough throw some light
    1) I have 1 database which is read_only. tlog backup size daily fluctuates how this is possible please...
    2)another question related to another problem
    backupset table of 1 database shows 65 MB full readonly database backup(named: abcd)  daily. here i am somply taking backup from litespeed.
    when i run backup database abcd to disk="c:\abcd.bak" with copy_only,checksum,init (in read only mode) it shows size of 57 MB only. Why there's gap as database is in read_only mode.
    3) buffercount and maxtransfersize are safe if i have x64bit machine and 100 GB RAM. restore verify completed successfully.
    Regards
    Manish

    1) Why are you taking a backup of a read only database every day ?
    Since nothing is changing just stick with the backup you already have. As for fluctuations you may be taking a backup that's added on the latest backup so it'll increase over time.
    2) There is no direct correspondence between size in BAK and MDF/LDF. You could have compressed tables or compressed backup, empty space etc etc
    3) Changing buffercount and maxtransfersize are safe to change. But first measure for what you gain from changing them since increasing them will have a higher impact on cpu time.
    Here are some benchmarks on those:
    http://www.mssqltips.com/sqlservertip/2539/options-to-improve-sql-server-backup-performance/
    "If there's nothing wrong with me, maybe there's something wrong with the universe!"

  • RMAN backup with smallest backup size

    Oralce 11g2 on Redhat 5. The diskspace is our tightest resource, and we want to an incremental backup with level0 on Sunday and level 1 every week days and Saturday. I am to use the comamnds to do the job--Sunday
    backup incremental level 0 tag 'level_0' database plus archivelog;
    --Other days
    backup incremental level 1 database plus archivelog delete all input;I do not think this is the best practice nor produce smallest backup files.
    What are you comments and opinions. Thanks

    Pavan, Thank you for reply. Here are the info requested
    what is size of DB ??
    ~250GB, including UNDO and TEMP. It is a dev database and not very big. But we have total 800GB disk space. After setting some housekeeoing folders, and allow some space for data growth, it leaves 180GB for flash_recovery_area.
    what would be max size of archive logs generated per day ??
    Variable from less than 1 GB to 12 GB
    Are you taking backups to tape or Disk ??
    Disk. In the 180GB flash_recovery_area, Current backup size is 152GB. If a backup fails to delete obsolete files, the next backup will fill the flash_recovery_area.
    Provide the Rman configuration information ??
    RMAN> show all;
    RMAN configuration parameters for database with db_unique_name TDEV2 are:
    CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
    CONFIGURE BACKUP OPTIMIZATION ON;
    CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
    CONFIGURE CONTROLFILE AUTOBACKUP ON;
    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F';
    CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
    CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
    CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
    CONFIGURE MAXSETSIZE TO UNLIMITED; # default
    CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
    CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
    CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
    CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
    CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_tdev2.f'; # default

  • How to reduce the backup size?

    HI there,
    I am syncing an iPad 32 GB and an iPhone 64 GB via icloud. Photos are not backed, no photostream activated. Apps which are allowed to upload to icloud for backup are very limited. Mail is not syncing to iCloud as well. Still, my backup size is for each device about 2.3 and 2.6 GB big. I want to stay under the 5Gb limit. Any idea, what might take up such a huge amount of backup space?  I already deleted the backup via settings --> icloud in each device, but that didn't help much.
    Both devices are running the latest iOS.
    Thank you very much!

    iCloud backup has an on/off switch, so tell me how you think you have managed to exclude things?
    FYI, Photostream and Photos are not part of an iCloud backup.
    Here’s what iCloud backs up:
    Purchase history for music, movies, TV shows, apps, and books Your iCloud backup includes information about the content you have purchased, but not the purchased content itself. When you restore from an iCloud backup, your purchased content is automatically downloaded from the iTunes Store, App Store, or iBooks Store. Some types of content aren’t downloaded automatically in all countries, and previous purchases may be unavailable if they have been refunded or are no longer available in the store. For more information, see the Apple Support article iTunes in the Cloud availability by country. Some types of content aren’t available in all countries. For more information, see the Apple Support article Which types of items can I buy in my country?.
    Photos and videos in your Camera Roll
    Device settings
    App data
    Home screen and app organization
    iMessage, text (SMS), and MMS messages
    Ringtones
    Visual Voicemail

  • Time Machine gives different full backup sizes

    After this recent Time Machine update I am no longer able to back up. When Time Machine computes the backup it tells me that it is 320GB, which is larger than my backup drive, so it can't back up. However, when I go into the Time Machine preferences it computes the estimated backup size as 272.52GB. Before this Time Machine update was applied my backups were happening with no issues.

    Mark Trolley wrote:
    Thank you. They must have changed the amount of extra space required with this latest patch
    It's been 20% since the early days of Leopard.
    because it was working fine up until that point.
    It may be a combination of things: the drive is clearly too small; while it varies widely depending on how you use your Mac, our general "rule of thumb" is that TM needs at least twice the space of the data it's backing-up.
    If you're like most of us, the amount of data on your system has been growing.
    And apparently Time Machine is doing a full backup, so it just got beyond the capacity of the disk to hold it all.
    Looks like I need a larger Time Machine disk.
    Yup. The good thing is, they continue to get less and less expensive.

  • Not enough space on my new SSD drive to import my data from time machine backup, how can I import my latest backup minus some big files?

    I just got a new 256GB SSD drive for my mac, I want to import my data from time machine backup, but its larger than 256GB since it used to be on my old optical drive. How can I import my latest backup keeping out some big files on the external drive?

    Hello Salemr,
    When you restore from a Time Machine back up, you can tell it to not transfer folders like Desktop, Documents. Downloads, Movies, Music, Pictures and Public. Take a look at the article below for the steps to restore from your back up.  
    Move your data to a new Mac
    http://support.apple.com/en-us/ht5872
    Regards,
    -Norm G. 

  • I am trying to update my time machine backup on time capsule, but time machine keeps trying to create an entirely new backup (evidenced by the 200GB backup size). How can I get time machine to modify my old backup rather than create a new one?

    I am trying to update my time machine backup on time capsule, but time machine keeps trying to create an entirely new backup (evidenced by the 200GB backup size). How can I get time machine to modify my old backup rather than create a new one?

    It must have found the old backup corrupt.. so you will more than likely have little choice. You can archive off the old backup if it is still useful.
    You can also verify it. See A5 http://pondini.org/TM/Troubleshooting.html
    He also has some info on this problem. eg C13.

  • Backup size says 2.0 GB, but I have all backup options turned off. Why is my backup size still 2.0 GB?

    I had an iPhone 4 updated to the iOS 7.1.2 version, and I recently purchased an iPhone 5s. When I got the 5s, I transferred all of my camera roll pictures from my 4 to my PC in a file folder and deleted all the photos from my 4 camera roll. I also turned off the "camera roll" backup option in my iCloud storage settings. However, my backup size still said I had a large backup size, so I turned off all the apps in the backup options under the iCloud storage tab. Along with all the apps, I turned off the backup for the Mail, Contacts, Calendars, Reminders, etc. Yet, my backup size on my 4 still said 2.0 GB, and my 5s needs more backup storage without purchasing any extra storage.
    I'm not sure if I should completely delete my 4 backup or if there is a solution without completely deleting its backup. If there is a possible solution to decrease my backup size without deleting the backup, what is that solution? If deleting the 4 backup is the best option, what are the "risks" of deleting the backup? Like would I lose anything I restored onto my 5s from the 4 backup, etc.? 

    Hi girdster,
    Thanks for using Apple Support Communities. Based on what you stated, it sounds like you need to manage your iCloud storage. I would recommend that you read this article, This tells you how to manage and how to delete a backup. 
    Manage your iCloud storage - Apple Support
    Cheers,
    Mario

  • TS2518 I recently had to get a new hard drive on my MacBook Pro because of a crash. I was able to restore to my latest backup, but now when I need to upload to an application like DropBox, iMovie, and such, it won't acknowledge Aperture. I have Lion OS.

    I recently had my hard drive crash on my MacBook Pro (OS Lion 10.7.5).  I was able to restore my new hard drive from my latest backup, but since then have been unable to access Aperture Library from another application.  When I 'request' an upload --- like to Drop Box, iMovie, or anything --- and it drops down the window for you to choose which library you want to choose from, Aperture is not acknowledged.  It will show my iPhoto Library and Photo Booth. 
    I can export from Aperture to Facebook and Flicker, but not from the other direction.  Any ideas on how to resolve this issue?
    Thanks,
    Brenda

    Brenda,
    Do you mean, the Media Browser is not showing the Aperture Library? What version of Aperture 3 do you have, and where is your Aperture library stored, on your system drive or an external drive?
    For the Aperture Library to be visible in the Media Browser you need to have enabled the generation of previews in the Aperture "Previews" preferences. Do you have the option enabled "Share Previews with iLife and iWorks"? And have you the generation of previews enabled?
    One other reason for Aperture not showing in the Media Browser could be a corrupted Aperture library. I suggest you try the "Aperture Library First Aid Tools" and repair your Aperture Library. Start with reapairing permissions, then try the other options, if necessary. See:
    Repairing and Rebuilding Your Aperture Library: Aperture 3 User Manual
    Another reason may be a corrupted preferences file; remove your Aperture preferences from your User Library, see Aperture 3: Troubleshooting Basics, the paragraph on removing preferences.
    Regards
    Léonie

  • Time Machine no longer displays "Latest Backup" time

    I have been using Time Machine since 10.5 came out and it worked perfectly.
    I recently purchased a Time Capsule and (in common with a lot of others it seems), I have faced various issues (very slow initial backup, very long "preparing..." messages etc.) but they all seem to have been resolved (albeit somewhat mysteriously).
    However, one problem occurred recently that I haven't seen mentioned before: in the drop-down menu under the time-capsule icon in the menu bar, the "Latest Backup" time is always shown as "--" Time Machine preferences shows the same, both for the initial backup and the latest backup.
    Time Machine runs hourly as it should, and a cursory examination of the files in the Time Machine interface seems to show that all is in order. The "sparsebundle" disk image also passes verification.
    For what it's worth, my MacBook Pro (also 10.5.2) appears to be just fine and shows the Latest Backup time correctly.
    I looked in the system log but couldn't see a message that I thought was relevant.
    Does anyone have any ideas about what might be up and how to correct this? I have considered deleting the Time Machine sparsebundle for the Mac Pro and starting again (since I haven't had the Time Capsule long enough to be terribly concerned about the history on the drive - yet). But I'm hoping someone has an idea what might be up and how I can correct it first.
    I must say Time Capsule isn't exactly filling me with confidence. My offsite SuperDuper backups are going to be updated very regularly until my faith in Time Machine has been restored.
    This only

    This may not pertain to your issue, but might be worth considering if you use virus software. Time machine has been hanging, not showing time-stamps, and not giving me access to backups since I installed Intego Virus software and Leopard 10.5.2. I finally tracked down the Intego problem yesterday browsing this forum for answers. When I added my Time Machine disk to Intego Virus software's trusted items, Time Machine began behaving normally again (and other problems cleared up-such as hang on shut-down). Good luck with your issue. David

  • HT4847 I am only backing up camera roll and a my media app which are 890 MB and 414 MB, i backup everynight why is it full it says my backup size is 4.7 GB when I only have those 2 things?

    I am only backing up camera roll and a my media app which are 890 MB and 414 MB, i backup everynight why is it full it says my backup size is 4.7 GB when I only have those 2 things?

    The back up is supposed to be a rolling back up and therefore may still contain data from previous back ups. To free up space you may wish to delete the back up and start again.

  • HT3275 Why does my Time Machine say No Latest Backup even though I ran a backup?

    I have backed up my MacBook Pro several times to an external drive by following all the directions. But, the Time Machine says "Oldest Backup: None" Latest Backup: None, Next Backup: Today 11:19 AM. I have selected the drive and turned it on. Has it backed up? Shouldn't it say there was a latest backup?

    Enter Time Machine, via the application, to see if it has backed up. If not try C2/A4 in the first linked article.
    Time Machine Troubleshooting
    Time Machine Troubleshooting Problems

  • I need to recover deleted data from my iPhone 4S but don't have a recent backup. I thought by pressing sync on my macbook this would back up-but I was wrong. There are no backups on my macbook and the latest backup on iCloud was Jan 2012. Please help

    I need to recover deleted data from my iPhone 4S but don't have a recent backup. I thought by pressing sync on my macbook this would back up…but I was wrong. There are no backups on my macbook and the latest backup on iCloud was Jan 2012. My mum died in May and I had lots of text messages that I wanted to keep. I really want to get them back. Is there any way at all I can get that deleted data from the phone?

    Since it has always been very basic to backup your computer and all it's data, Apple provides no way for you to transfer music from your iPhone back to your computer.  As you know, you can re-download all iTunes purchases, but music that you ripped yourself you'll have to just re-rip again.
    You can try and find 3rd party applications that might help you.  I'm sure you'll pay, however.
    Let this be a very important lesson learned.
    Best.

  • I forgot the passcode to turn off restrictions. I have restored my iPad back to the factory settings and then synced it with the latest backup. The restrictions are still on and it is asking for the passcode. Can someone tell me how to get that off.

    I forgot the passcode to turn off restrictions. I have restored my iPad back to the factory settings and then synced it with the latest backup. The restrictions are still on and it is asking for the passcode. Can someone tell me how to get that off.

    The only option is to wipe the device clean and restore it to factory settings.  Hope you have a backup.
    Follow the instructions in  iOS: How to back up your data and set up your device as a new device http://support.apple.com/kb/HT4137 to restore the device to factory settings.
    Once you have setup the device as a new one, you can then sync it back with your iTunes account and all your music, apps, contacts and any other content sync'ed with iTunes will be loaded on the device. Any content that is stored only on the device and not sync'ed with iTunes, like app logins or data, will be lost during this process. Be forewarned that this is a long process and can take a couple of hours or more to complete. This can be painful, but it is necessarily so to prevent users from working around the security settings. After the restore is complete, you can setup a new Restrictions passcode. Make a note of the passcode to avoid this situation in future.
     Cheers, Tom

Maybe you are looking for