Get most recent backup completed within last week

Hi.  I need your help with this...
I want to get a list of the most recent .bak files created in the last week.  I need to select [database_name] and [backup_finish_date] from msdb..backupset and [physical_device_name] from msdb..backupmediafamily tables. So if any database was backed
up AT LEAST ONCE in the last week, I want to list the most recent .bak file for that database.  If the most recent backup was more than a week old, I'm assuming it isn't being backed up on a regular basis, and I exclude it from the list.  I
think this requires a join of backupset and backupmediamedia tables, and use of MAX function to get the latest file, but I can't put it together.
Thanks!

Try
WITH cte
AS (
SELECT T1.NAME AS DatabaseName
,T2.backup_finish_date AS BackupDate
,T2.user_name AS UserName
,MF.physical_device_name
,RANK() OVER (
PARTITION BY T1.NAME ORDER BY T2.backup_finish_date DESC
) AS Rn
FROM sys.databases T1
JOIN msdb.dbo.backupset T2
JOIN msdb.dbo.backupmediafamily MF ON T2.media_set_id = MF.media_set_id ON T2.database_name = T1.NAME WHERE T2.backup_finish_date >= dateadd(week, - 1, CURRENT_TIMESTAMP)
SELECT *
FROM cte
WHERE rn = 1
ORDER BY DatabaseName
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles

Similar Messages

  • Is there a way to get back a previous iTunes backup file than the most recent Backup?

    I did a manual backup and wanted to restore the iPhone, but iTunes forced me to update the iPhone before allowing me to restore the iPhone...
    After updating, I realised that iTunes created a backup automatically without confirming with me, and now the latest backup file is not the one I wanted.
    Is there a way to get back the backup file I manually backup?

    Is there a way to get back a previous iTunes backup file than the most recent Backup?
    No, to the best of my knowledge the device backup area is simply updated with new information each time the device is backed up so there are no previous versions preserved. Once a backup has been used to restore a device however it gets locked and dated so that you could return back to that snapshot at a later date.
    Your manual backup should have simply updated the backup with any new data since the last automatic backup. Upgrading should not have overwritten a backup taken just before the upgrade with a, presumably, empty state. Have you actually tried to restore the current backup that is available? It may have what you want after all. You might like to try backing up the current state of the device to iCloud first, or if you have access to another computer back it up to that.
    N.b. I always disable automatic syncing of devices so that I am in better control of when data starts to be written, and in which direction it flows.
    ttt2

  • Cant get most recent iphone/itunes backup onto my iphone5

    hi,
    i had an iphone5 that went bad (broken camera), apple sent me a replacement.
    before i sent in bad iphone5 i backed it up to itunes on 04/25/13.
    i then copied over that backup to an old iphone3 (IOS 6.1.3) to use while waiting on iphone5 replacement.
    the new iphone5 arrived and so i backed up the iphone3 to itunes, today: 05/03/13
    i just set up the replacement iphone5 including copying over a backup from itunes.
    instead of copying over the backup i had just made it copied over my backup from 04/25/13 (the date that i had backed up my old broken iphone5)
    while still having the new iphone5 connected to itunes i checked the "last backup" info, it read "date unknown".
    so i plugged in the old iphone3 again to do another backup under assumption i had done something wrong.
    i first looked at the "last back up" info again and it now read todays date: 05/03/13
    this tells me that the most recent backup does exist on my computer somewhere.
    my question is: can anyone assist in telling me how i can locate & get the most recent backup onto my iphone5 please?
    comments:
    1) both phones are running IOS 6.1.3
    2) i placed the original sim card from my broken iphone5 into my new iphone5 and i assume that is playing a role in why itunes only copied over from the 04/25/13 backup date.
    thank you,
    wayne

    from ht4946:
    The folder where your backup data are stored varies depending on the computer's operating system. Make sure the backup folder is included in your periodic data-backup routine.
    iTunes places the backup files in the following places:
    Mac: ~/Library/Application Support/MobileSync/Backup/
    Windows XP: \Documents and Settings\(username)\Application Data\Apple Computer\MobileSync\Backup\
    Note: To quickly access the Application Data folder, click Start, and choose Run. Type %appdata% and click OK.
    Windows Vista and Windows 7: \Users\(username)\AppData\Roaming\Apple Computer\MobileSync\Backup\
    Note: To quickly access the AppData folder, click Start. In the search bar, type %appdata% and press the Return key.
    That should at least help you confirm the existence of the backup you are needing. From there, you may try manually deleting the other unneeded backup.

  • Grrrr. Restoring from backup. Doesn't see most recent backups as "complete"

    Terribly frustrating. Logic board went out on our newish mac mini. While it's in the shop I'm trying to restore the most recent backup to another external HD that I can startup from. The latest backup was completed moments before the mini crashed, but when I go to restore, it shows the most recent "complete" backup was done back in January. What!!! I have been able to get at the important files I need through the Finder, but that's not going to cut it. I want a complete restore of the system.
    1) What Time Machine settings did I have wrong that could have caused this?
    2) What can I do to prevent this from happening again?
    3) Am I going to be able to get into my latest backup?
    Any advice is greatly appreciated!!!

    Hi, and welcome to the forums. (Not the best way to start, is it?)
    Very carefully, look at the most recent backup folder on the TM disk (don't change or delete anything).
    As you probably know, it's inside the folder that has the same name as the computer it's from, and should be at the bottom.
    It should be named with the date and time. If it has ".inProgress" at the end, it means it's not complete; TM hadn't quite finished with it. If so, you can't do anything with it.
    It's also possible the disk was corrupted when the logic board blew. If OSX didn't get a chance to "close it out" properly (via the normal eject process), there's no telling what happened.
    I'd start with a +Repair Disk+ (and maybe even +Repair Permissions+ ). That might help.
    And you should be able to browse the backups from another Mac running Leopard, via the (badly named) +Browse Other Time Machine Disks+ option. That's available either while holding down the Option key while selecting the TM icon in your menubar, or control-clicking (right-clicking) the TM icon in the Dock. This won't show any ".inProgress" files either.

  • I got a new iphone 6.  When I restore my phone from my icloud backup my most recent photos and messages not restored from icloud backup.  How do I get the most recent backup onto my new phone?

    I got a new iphone 6.  When I restore my phone from my icloud backup my most recent photos and messages not restored from icloud backup.  How do I get the most recent backup onto my new phone?

    Hello, Anita.  
    Thank you for visiting Apple Support Communities.  
    I understand that you are wanting to restore your new iPhone 6 from an iPhone 5 backup.  This sounds like the iOS version of your old iPhone 5 may be newer than what was installed on your iPhone 6.  Try going through the steps in the article below.  
    iOS: Unable to restore from backup of a newer device
    I would also check to see the backup dates in iTunes and if the  backup is located on iCloud instead of iTunes.  
    Back up and restore your iPhone, iPad, or iPod touch using iCloud or iTunes
    Cheers, 
    Jason H.  

  • I upgraded to a 4g and the most recent backup (today) is not showing up.  I went ahead and backed up and found that my texts, phone calls and messages did not backup.

    I upgraded to a 4g and the most recent backup (today) is not showing up.  The most recent backup that showed was 3/3/12.  I went ahead and backed up to that date and found that my texts, phone calls and messages are the part that did not backup. 
    Can anyone tell me 1) why my most recent backup did not show in ITunes, 2) why I could not backup using the Cloud (I tried this way first), 3) how I can get all the phone calls, messages and texts from 3/3/12 until today?  Please help if you can...thanks!

    I found the answer on:
    transferring Txt messages from old phone to new iphone 4
    It worked great!

  • How and where do I access the most recent backup of my iTouch's calendar PRIOR to my auto-sync?

    How and where do I access the most recent backup of my iTouch's calendar -- prior to the recent auto-sync which lost 5 yrs. of info. on my calendar? I want to retrieve it.

    All you can do is restore from backup. To do that see the restore topic of:
    iOS: How to back up
    Also, turn off autosyncing so that when you reconnect the iPod to yuor computer the old backup does not get overwritten . To turn off go iTunes>Preferences>Devices and check the box that says "Prevent iPods...".
    iTunes only retains the most recent backup and updates it with the changes.

  • Can I retrieve contacts from a past (not most recent) backup?

    The other day, my iPhone 4 decided to delete 95% of my contacts. Unfortunately when I realized this, my phone had already automatically backed up to iCloud, so the most recent backup didn't include any of my contacts. My Time Machine has been iffy and hasn't backed up recently AND I'm unsure if my contacts were saved to iTunes... I had never done that manually (didn't actually know it was an option until recently) but maybe it automitcally synced my contacts?
    When I right click on my device in iTunes, restore from backup is not an option. Does anyone have any suggestions on how I can restore from a backup from like 5 days ago? Is there a way to see a list of old backups or something? Ah I just want my contacts back! I don't care if I lose the pictures or texts I've sent in the last couple days, any help is greatly appreciated!
    Thanks

    The other day, my iPhone 4 decided to delete 95% of my contacts. Unfortunately when I realized this, my phone had already automatically backed up to iCloud, so the most recent backup didn't include any of my contacts. My Time Machine has been iffy and hasn't backed up recently AND I'm unsure if my contacts were saved to iTunes... I had never done that manually (didn't actually know it was an option until recently) but maybe it automitcally synced my contacts?
    When I right click on my device in iTunes, restore from backup is not an option. Does anyone have any suggestions on how I can restore from a backup from like 5 days ago? Is there a way to see a list of old backups or something? Ah I just want my contacts back! I don't care if I lose the pictures or texts I've sent in the last couple days, any help is greatly appreciated!
    Thanks

  • Long story short....I restored my computer to an earlier point using time machine and now all of the previous back-ups are gone. My question has to do with itunes...is it possible to restore my itunes library to the most recent backup because the restore

    Long story short....I restored my computer to an earlier point using time machine and now all of the previous back-ups are gone. My question has to do with itunes...is it possible to restore my itunes library to the most recent backup because the restore that I did was in march and the latest backup was in may....the reason being is that there were app that i had downloaded that are in my most recent back-up, that were not in the backup I restored to. Is it possible to just restore one application ie)itunes?

    See this post.
    tt2

  • Time Machine most recent backup never changes

    Hi - new to the forums here.
    I have been having issues for some time with my 13" MacBook Pro.  I'm still running Mavericks.  One of the things I am dealing with is that the date of my most recent backup has remained the same for several months now, even though I continue to back things up frequently.  The backups are in the folder, which is all that really matters, I suppose, but I've no idea why it's doing this.   I'd be grateful for any suggestions.  Thanks!

    This simple procedure will clear your Time Machine settings, including exclusions. The backups won't be affected. If you have a long exclusion list that can't be recreated easily, you may prefer a more complicated procedure that preserves the exclusion list. In that case, ask for instructions. Otherwise, do as follows.
    Triple-click anywhere in the line below on this page to select it:
    /Library/Preferences/com.apple.TimeMachine.plist
    Right-click or control-click the highlighted line and select
              Services ▹ Reveal in Finder (or just Reveal)
    from the contextual menu.* A Finder window should open with a file selected. Copy the file to the Desktop. Then move it (the original, not the copy) to the Trash. You'll be prompted for your administrator password. Restart the computer and recreate your settings in the Time Machine preference pane. It will show that you have no backups. Don't worry; your backups haven't been touched. Run a backup to test. The backup may take much longer than usual. If TM now performs as expected, delete the file you copied to the Desktop.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combinationcommand-C. In the Finder, select
              Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.

  • How to determine which drive has the most recent backup?

    I have a few drives that contain backups of files. What would be the easiest way to figure out which of the drives has the most recent backup? When I sort by date, the folder shows one date, though the files inside show a different date? Is there a way to quickly check the drives to find which is the most recent?
    Thanks.

    the folder modification date isn't reliable, as is only tells of changed in the folder, but not in subfolders. there is no efficient way. I however highly suggest Time capsule, it is WAY easier and you can ask it not to sync the System data and/or applications, so it would prevent this hassle.
    You could try this: go to the first drive, type different letters, like a for instance, and see which file is the most recent document/folder.
    do the same thing on the other drives and compare.

  • The touchscreen of my iphone is not working, and I want to backup my most recent photos onto my mac, but I have a passcode that I have changed since my most recent backup around a month ago. What could I do to get my photos back?

    As the title says,
    My iphone touchscreen stopped working around two days ago, so I cannot input my passcode. I am trying to backup my most recent photos as I have been on a trip abroad to phuket the past week, and got back home but did not have time to move my photos from that trip onto my mac before the touchscreen stopped working. I have a problem because I backed up my iphone last around a month ago, but have changed my passcode since so my iphone is not allowing me to back up onto my mac through itunes. I wish I at least hadn't changed the passcode, or had my photos on icloud, but I have so many photos that the icloud storage would cost so much for me to keep them updated.. I am so frustrated right now as it's not that I have forgot my passcode, or that I don't know it at all, but I know it. I wish there was a software that I could use on my mac to enter the passcode or something. Is there a way I could do something about it?!

    So you are not using Photo Stream? If you are, then you can turn on Photo Stream on iCloud on your Mac, and then go to iPhoto or Aperture and the Photo Stream will show under "Web" in the sidebar.
    You can also set up your iPhoto or Aperture preferences to automatically import your Photo Stream, so any photos you take with your iPhone camera will upload and import automatically and will show under events, broken into monthly groupings.
    Photo Stream does not use any of your iCloud storage.
    Here are the Preference Screens I'm referring to:
    iPhoto:
    Aperture:
    One other thing concerning your Touch Screen. Have you tried resetting your device (nothing will be lost) to see if that will get your Touch Screen working again: Hold down the Home and Power buttons at the same time and continue to hold them down until the Apple appears (up to 30 seconds). Once the Home screen redisplays see if your Touch Screen is working.
    Best of luck,
    GB
    Message was edited by: gail from maine

  • HT201269 i backed up my iphone to iTunes and then when i restored the back up info was not from the most recent backup, but from May!!! what can I do to get yesterdays data?1

    i backed up my iphone to itunes and tried restoring the info on to a new iphone and for some reason it used an old back up from last may.  I know that the recent back up worked as I used it to set up another phone a week ago (a phone whihc also had problems and hence I needed to use that same back up again on my second new phone.  Is there anyway I can get the most recent back up information back?

    1. Create a backup of your iPad to iTunes on your computer or to iCloud
    2. Transfer any and all photos & videos on your iPad to your computer.
    3. Erase the iPad and restore the iPhone's iCloud backup to the device.
    4. Transfer any and all photos & videos on your iPad to your computer.
    5. Restore the iPad backup you reated in step #1 back to the iPad.

  • After updating to iOS 5, my most recent backup is gone!  HELP!!

    The iPhone update began Wednesday night; before starting, I attempted to do a backup a few times, and it failed.  As the update began, the backup refused to work then as well. After a couple attempts with errors, I checked the list of backups in "Preferences" to see when the last backup was recorded.  It said "yesterday," which wasn't too far back, so I let the update skip the backup, intending to let my phone restore from the prior day, should it need to.
    Later, when iTunes asked me to select a restore, the one from the prior day was missing.  The latest backup showed June 22.  I let it continue, just wanting to have my phone in a functional state, but somehow hoping that it had it wrong, that it was actually the more recent backup.  After following the iOS 5 setup steps, I checked my text messages - and it showed the last texts were from June 22.
    A little upset, but not yet giving up, I found the hidden folder where backups were stored.  The latest files were also from June 22.
    I also checked the Recycle Bin, which contained an .ipsw file.  It had the word "restore" in the file name ("iPhone2,1_4.3.5_8L1_Restore"), so I attempted to use it to restore my phone to its prior state by holding down SHIFT while clicking the restore button in iTunes (a Google search led me to this).  After 9 attempts at this, I gave up, and brought my phone back to factory settings temporarily, so I could have a working phone before going to school.  I found out afterwards that the file was only an operating system file and contained nothing of my former settings (even though one forum claimed to have found their actual backup located in the Recycle Bin in a similar situation).
    I'd very much like to have all my recent text messages, etc. back on my phone.  I usually backup my phone pretty regularly, so the fact that the "most recent" one goes all the way back to June is positively bewildering.  This is really ruining my experience with the new iOS, and my phone in general.
    Why is my recent iPhone backup missing, and how can I get it back?

    seems if I disable all security it works. Not a very good situation, tells me it's a port that is open that shouldn't be. I imagine it is fine on a mac, but on a pc it is an issue since most corporations use pc's.

  • ITunes folder transferred from old computer is corrupt, so is most recent backup on external disk drive. What can I do?

    I recently had to buy a new PC as the old one was getting very slow. When the technicians tried transferring over files to the new PC they discovered that several files were corrupted, including iTunes. I had made a backup of iTunes on an external hard drive a few months ago, but this appears to be dameged too. What can I do, please?

    Use the tool in this backup tip to copy the files that can be read over to a new known good location. One of SyncToy's strengths is that it will keep on working after coming across a file it cannot copy. Windows copy will just fall over.
    Once you recovered as much media as possible use the following technique to explore any available backups of your library files, and then update it to match your media folder.
    Empty/corrupt library after upgrade/crash
    Hopefully it's not been too long since you last upgraded iTunes, in fact if you get an empty/incomplete library immediately after upgrading then with the following steps youshouldn't lose a thing or need to do any further housekeeping. In the Previous iTunes Libraries folder should be a number of dated iTunes Library files. Take the most recent of these and copy it into the iTunes folder. Rename iTunes Library.itl as iTunes Library (Corrupt).itl and then rename the restored file as iTunes Library.itl. Start iTunes. Should all be good, bar any recent additions to or deletions from your library.
    See iTunes Folder Watch for a tool to catch up with any changes since the backup file was created.
    When you get it all working make a backup!
    tt2

Maybe you are looking for

  • There was a problem reading this document (117)

    Dear Designers I am facing a strange problem while doing test presentment in Adobe output designer. When i do a test presentment with my dat file which is meant for fax (^job newFax   -fform01F.MDF) , i see the pdf (consist of 2 pages ) but as soon a

  • Tables TCURM and T001W inconsistent; notify your systems administrator

    Hi, I'm getting the M3820 error while creating material master. I have assigned the plant to the valuation area but this still occurs. Can anyone help? Thank you! Florian

  • Goes into auto lock every few minutes

    My iPad is getting slower to startup, this last startup was difficult to initiate. Keeps going into auto lock, especially with any handling of the left hand shorter side of the iPad.

  • Can i use a GSM sim on a CDMA iPhone 4S after a CDMA factory unlock?

    I just got an iPhone 4S as a gift from my cousin in Canada. Upon trying to get a factory unlock for it i was informed that it is a CDMA phone. If unlocked can i use a GSM sim with it? Am in South Africa.

  • Installing Desktop Application fails

    Hi, Interesting web app. Very clean interface. Good functionality. I tried the "Install Desktop App" link. It prompts that it needs to download Adobe Air and then after the progress bar is done it reports that an error was found while downloading and