My database's .mdf file was lost during the restore process due to changing the logical file name. Now the database is in "RESTORING" state, and I cannot recover the original file, nor do I have a backup. How can I recover the lost .mdf file?

dan dan 0 信誉分
2024-12-16T08:39:07.85+00:00

I encountered an issue during a database restore operation in SQL Server. The process and the problem are as follows:

Restore Process Details:

  • I was trying to restore a database from a backup.
    • During the restore process, I changed the logical file name of the database, but I did not update the database name itself (only the logical file name was modified).
      • The restore process was interrupted when I realized there was a mistake, and I stopped the restore operation.
      Current Symptoms:
      - The database status is stuck in "RESTORING" state.
      
         - The original `.mdf` (primary data file) is now missing.
      
            - The new `.mdf` file created during the restoration is in an incomplete state and cannot be used.
      
               - When I attempt to use the `RESTORE DATABASE [your_database_name] WITH RECOVERY;` command, it reports that the file has not been restored.
      

Key Points:

  • I cannot find the original .mdf file.
  • The restoration process was incomplete, and I stopped it before it could fully complete.
    • There are no backups available for the database.
  1. What I’ve Tried:
    • I tried running the RESTORE DATABASE [your_database_name] WITH RECOVERY; command, but it indicates that the file was not restored.
    • I’ve also used data recovery tools like Recuva and EaseUS Data Recovery to scan for the .mdf file, but I have not been able to locate the original file.

Request for Help:

  • Is there any way to recover the lost .mdf file, especially since the restore operation was interrupted, and the new file overwrote the original one?
  • Is there any SQL Server tool or command that can help recover the missing .mdf file?
    • Can I somehow recover the original database using the incomplete .mdf file created during the restore process?
SQL Server
SQL Server
Microsoft 关系数据库管理和分析系统的一个系列,用于实现电子商务、业务线和数据仓库解决方案。
180 个问题
0 个注释 无注释
{count} 票

1 个答案

排序依据: 非常有帮助
  1. LiHongMSFT-4306 29,516 信誉分
    2024-12-17T02:38:03.87+00:00

    你好,

    因为这里是中文论坛,所以接下来的回答我将使用中文。

    根据你的描述,数据库的主数据文件.mdf 在还原操作期间丢失,并且您没有 .mdf 文件的原始备份,那么将数据库恢复到完整状态的可能性可以说微乎其微。

    如果你能接受数据丢失的风险的话,或许你可以试试RESTORE ... WITH REPLACE,不过我也不确信是否能成功,因为我之前并没有遇到过此类情况。

    所以我还是建议你去开ticket寻求微软官方技术支持的帮助:

    Services Hub (microsoft.com)


    如果答案是正确的解决方案,请点击“接受答案”并投赞成票。如果您对此答案有其他疑问,请点击“评论”。

    0 个注释 无注释

你的答案

问题作者可以将答案标记为“接受的答案”,这有助于用户了解已解决作者问题的答案。