Cannot Delete Backup File

SloopJohnBSloopJohnB Posts: 25 Bronze 3
edited November 16, 2012 9:44AM in SQL Virtual Restore 2
I created two virtual DBs off of one backup file (an encrypted sqb). I've deleted both DBs (via SSMS), as I am done with them, but now I cannot delete the sqb file it was based on from the file system. Whenver I attempt to delete it in Windows Explorer I get the message, "The action can't be completed because the file is open in HyperBack Control Service". How can get rid of the file?

Thanks in advance for your help.

Comments

  • Hi SloopJohnB,

    The backup file handle should be released by the HyperBac service around a minute after the last database that uses it has been dropped. Is the file still locked now?

    If it is, the easiest thing to get it deleted would be to stop the HyperBac Control Service. Please ensure that you have no backups/SQL Virtual Restore/SQL Storage Compress databases running/online before you stop the service though as any access to those files would cause errors.

    Hope this helps.

    Thanks,
    Matthew Flatt
    Redgate Foundry
  • I also have a related issue.
    it appears for larger virtual DBs, when I restore over a previous one, hyperbak will only release it's hold after a restart of the entire server.
    --for example: test_virtual then replace Test_virtual by either deleting or restoring with replace.

    if I stop hyperbak, stop sql, restart hyperbak, restart sql around 50% of the time it will fail to recover the DB, or mark it as suspect. but a reboot doesn't have that issue.

    Is there a way to make hyperbak give up its hold on files manually?
  • Hi festernd,

    With the HyperBac service stopped, all open handles to files HyperBac has been using should be closed.

    Have you tried using ProcMon to see what has a handle open to the file and kill it?

    You mention that for larger databases when replacing, which file is not being released? The backup file or the vmdf/vldf files?

    Also, what version does it say if you open you Configuration Manager?

    Thanks,
    Matthew Flatt
    Redgate Foundry
  • The file not being released is the previous SQBs
    Yes, with hyperbac stopped, all file handles are released...but:
    Stopping HyperBac to force it to release old SQB files is not a solution, because when I stop hyperBac( stop sql server, stop hyperbac, start hyperbac, start sql) it frequently doesn't recover the database, or marks them suspect, as I previously stated.

    Also, needing to restart hyperbac/ the entire server isn't a good solution.
    I'd really like to know why hyperbac won't give up it's handles, and how to fix that.
  • Hi festernd.

    What version does it say if you open your Configuration Manager?

    Thanks,
    Matthew Flatt
    Redgate Foundry
  • SloopJohnBSloopJohnB Posts: 25 Bronze 3
    Mine says 5.5.1.10
  • SloopJohnBSloopJohnB Posts: 25 Bronze 3
    Also, I agree with festernd on having a solution other than "restart the service". Realistically, I don't bother with deleting an orphan sqb until the server is rebooted, since this is a production server, and I can't just randomly start/stop things on it. I've taken to keeping a side Excel document with the file names of all the orphaned files, and go about deleting them once the server has been rebooted (e.g., to apply security patches). This is far from an ideal solution, since I don't have endless disk drive space to keep useless backups around.
  • same as Sloop,
    hyperbak version 5.5.1.10 -- configuration manager doesn't seem to list virtual restore specifically.
  • Hi,

    Would you be able to upgrade to version 5.6 of the HyperBac components at your earliest convenience?

    You can download it from the product page.

    This version contains enhanced index clean up and could solve your issue as active indexes can create locks on the various files in an SVR database.

    Thanks,
    Matthew Flatt
    Redgate Foundry
  • DLapointeDLapointe Posts: 3 Bronze 2
    I'm having the same issue.

    I am running HyperBac 5.6.1.1

    I have an sqb file which was used for a virtual restore database. I dropped the database through SSMS - the vldf, vmdf and 2 vndf files dissappeared with the database drop. The sqb remained. I have tried to delete the file with a failure message stating that "It is being used by another preson or program". I have this problem with an sqb which has not been used in 3 weeks.
    I should note that these are all for the same database - different backups of the same database being virtually restored into the same target database.

    I have not had this issue for all of my Virtual Restores.

    Any ideas?

    Thanks
  • Hi DLapointe,

    Can you please locate the file openstatus.dat from your HyperBac installation directory (%:\Program Files (x86)\Red Gate\HyperBac\bin) and send it to support@red-gate.com.

    If you could include the link to this forum post and reference my name that would be great.

    Thanks,
    Matthew Flatt
    Redgate Foundry
  • We've been having the same problem. We run processes that will drop an existing vdb, copy the production sqb down over top of it and then virtually restore the database for development purposes. These processes run every night. And it has been awesome.

    However, on the 2 servers we upgraded to 5.6.1.1 (all of the rest are on 5.4.1.5), we get the file in use errors when trying to delete the old sqb file even though the database has been dropped from SQL Servers perspective. We added a step to our process to attempt to delete the files (vmdf and vldf too) and if it's locked to wait 30 seconds and try again. It runs this loop 3 times until it's successful. Only on the servers run 5.6.1.1, it never is. If we restart the HyperBac service (haven't had to restart SQL Server), we can then remove the old sqb and the restore of the new one works just fine. This is running SQL 2008 SP2 on Windows OS 2008.

    -Jeff
  • Long Path Tool helped me in this situation. http://LongPathTool.com
  • I got the same problem as very annoying and with no explanation as the file names have no visible illegal characters and are not too long and not copied or deleted and found good stuff at http://pathtoodeep.com/ and also over here. Thanks
  • hi
    I am having this problem from very long time but Long Path Tool helped me in this situation.
    http://PathTooDeep.com all u guys must try to fix this problem
  • I have been working offline with DLapointe and after upgrading to HyperBac Service version 5.9 his issue was resolved.

    You can obtain the latest version here:

    http://www.red-gate.com/products/dba/sq ... e/download

    Thanks,
    Matthew Flatt
    Redgate Foundry
Sign In or Register to comment.