When scripting database TOAD for SQL actually changes the name of both the logical file and physical file ??? hmm.... is that a feature???

I stumbled on this issue when I had scripted out a database from ServerA to ServerB. I ran the script generated from ServerA on ServerB and thought nothing of it. Later, I then tried to restore the database backup from ServerA to ServerB using with move because the drive configs are different. Well… it wouldn’t restore because when scripting the database from ServerA Toad changed the logical and physical names. The issue was obvious, it couldn’t find one of the logical names i was using so it failed. The logical files in the backup were not the logical file name that Toad scripted out.

I really do not want TOAD to anything fancy but just script what is there. Why is it going in and changing anything?

See below for example:

Screen shot of database files: (SERVERA)

Toad_DataBase_Issue.jpeg

This is the script it generated: (script created via Toad, SERVERB)

CREATE DATABASE [Test_Toad_Scripting]
ON
PRIMARY
( NAME = N’Test_Toad_Scripting’, FILENAME = N’xxxxx\Test_Toad_Scripting.mdf’, SIZE = 4MB, FILEGROWTH = 1MB ),
( NAME = N’Test_Toad_Scripting_1’, FILENAME = N’xxxxx\Test_Toad_Scripting_1.ndf’, SIZE = 4MB, FILEGROWTH = 1MB )
LOG ON
( NAME = N’Test_Toad_Scripting_log’, FILENAME = N’xxxxx\Test_Toad_Scripting_log.ldf’, SIZE = 1MB, MAXSIZE = 2097152 MB, FILEGROWTH = 10% )
COLLATE SQL_Latin1_General_CP1_CI_AS;

** In the script it rename my logical file from DataFile & DataFile2 to Test_Toad_Scripting & Test_Toad_Scripting_1 respectively. WHY? Am I missing something?

Has anyone else come accross this? Is there a check box anywhere to have Toad just script what it there and not try to figure what it thinks the files should be called?

Hi Ctucker,

I can’t reproduce this issue, here is my step,please check if this is same with your step:

1.Create a database named Test_Toad_Scripting ,and add one more logical data file.

So the server A have the same logical file like yours.

2.Detach this database and copy the 3 files(2 data ,1 log) to Server B

3.Attach Database by this 3 files,

But I can see the correct logical file .

I used the latest TSS 6.6.0.236.

Please tell me if I do something different with yours.,Thanks:)

Cathy.

Thanks for the reply Cathy.

The difference might be that I didn’t attach the files to ServerB. I scripted the database from Toad and ran that script on ServerB. You can also rt click and “View Details” on ServerA database. On the “Files” tab you will see what you expect. Click on the “Script” tab and you will see how Toad interrupts the database script.

I know I could just restore the database without script the “Create Database” but it shocked me that Toad would change the properties, logical file names, of the database.

Having said this, I am using 6.1.0.1759. Where did you get the download for 6.6? Is this the version that is coming out in October?

Hi Ctucker,

Thanks for your information ,I can reproduce it. It’s a bug. I have create TSS-697 for it.

You can download TSS 6.6 Beta here,

www.toadworld.com/…/default.aspx

Thanks,

Cathy.