Toad World® Forums

Trying to mount database that has been renamed results in invalid script

Steps to reproduce:

  1. Detach a database.
  2. Rename the physical files.
  3. In Toad, choose option to attach database.
  4. Browse to the .mdf, and select it.

Notice: There is no option to specify the physical location of the .LDF.

Click the SQL Script tab.

Notice: The filename of the .LDF is the old, not renamed filename – it is that way because it got pulled from within the .mdf – which is expected.

The bug is that unlike in SSMS, there is no way to fix the incorrect filename for the LDF.

The work around is to copy the script out to an editor and edit it manually.

Possible solutions:

  • Best: Check the filename: If the filename of the .LDF doesn’t exist, try the SAME name as the .MDF already selected but with a .LDF extension, then try the same filename as the .MDF with _1 prior to the .LDF extension – this may not always work, but if it does work you’ve now saved us the work of having to edit the files manually.
  • Do like SSMS does and show each LDF/NDF listed as their own rows with option to update the filename/path. (This could be in addition to the above).
  • Allow edit of the script on the script tab so that it can be edited prior to clicking OK.
    Darren

Hi Darren,

Thank you so much for your suggestion. And sorry for this cause by an issue:

The Files associated with selected database should be display like SSMS, and they should with option to update the filename/path. But the files display only when select the attach database twice.

We have create an issue TSS-314 for it and will follow it. Thanks again.

Kelly