Thursday, August 05, 2004

Wizards and scripts in SQL 2005

The Attach database wizard

Just a little comment on the machine computer interaction during the attach database wizard in SQL2500 when attaching a single file database. The wizard seems happy enough to deal with the fact that the log is missing and uses the correct procedure to attach the database but it needs to be informed that the log is absent. If it detects this for itself by looking in the header of the data file then an error occurs. The wizard correctly renames the physical pointer for the .MDF file but leaves the .LDF file as it would have been when it was orirginally created.

The message is a bit cryptic but it means that the wizard detected that the log was missing but it used the information from the primary device about where the log should have been as a default. If you want to create a brand new log file then simply delete the entry for the log file from the list and click on ok.

Scripting Wizards

One of the problems with using the wizards in the past was that if you had to do the same procedure at a later date or on multiple machines then there was no option of simply re-running a saved script. This could be remedied by scheduling a job and then saving the resultant script, or as many people did, using the profiler to capture the script while the front end called the appropriate stored procedures. It is nice to see that now the script can be generated for the wizard by clicking on the script button. What a nice feature.

No comments: