Recovering from FILESTREAM Orphaned File Error

  • Use this at your own risk!

    My issue happened in a test enviroment of mine where I could restore, so use with caution! I am not sure if this was the best solution or not, but I ran across did the folowing steps to resolve this issue:

    "Table error: The orphaned file "00096072-00000068-0003" was found in the FILESTREAM directory ID 8bdded92-3be3-46ed-8fc6-7e2c862b5bc1 for object ID 2036970383, index ID 1, partition ID 72057594459521024, column ID 4

    Generic error: Table error: The orphaned file 'FILE' was found in the Filestream directory for object ID O_ID, index ID I_ID, partition ID PN_ID, column ID C_ID

    The issue is there are files left over in the FileStream directory that are not in the database for this particular table. I did the following and it worked:

    1. Backed up the database

    2. Scripted all the data in the FILESTREAM table and saved an insert statement to recreate the data.

    3. Moved the contents of the "8bdded92-3be3-46ed-8fc6-7e2c862b5bc1" directory to a backup location.

    4. Deleted all the contents in the FILESTREAM directory "8bdded92-3be3-46ed-8fc6-7e2c862b5bc1"

    5. Reran the insert script.

    Thankfully, I only have one table that has FILESTREAM enabled. If you have multiple tables, I am not sure if they are put into a separte directory or not, so use caution with this workaround!

  • According to the experts in this, either CheckDB with a repair option (probably repair_allow_data_loss) or just delete the file in question. You've got both the file name and the directory in the error message.

    Just make very, very sure to delete the right one, otherwise you'll cause all sorts of worse problems.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Unfortunately, CheckDB cannot fix this error. I tried:)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply