I've got a Python script which accesses two SQLServer 2008 databases. If I run it and take a trace to capture all events that occur as a result of the script, and then put that trace through the Database Tuning Advisor it has the error message "invalid object name" about many of the tables in one of the databases.

I have selected both databases on the first tab of the tuning advisor. It seems that the trace doesn't capture which database the SQL has been run on, and I can't find a place to say that it should.

How can I analyse a trace from this script without these errors?

  • 3
    You need to include DatabaseName and/or DatabaseID as a trace column. See here for details – Martin Smith Feb 27 '12 at 12:15
  • I found where to specify database name in the DTA user interface. (Show all columns, tick name and id) Do you want to make it an answer and get the credit? – paulmorriss Feb 27 '12 at 12:33

With Martin Smith's help I found the answer.

On the dialog where you specify which events to include click Show All Columns. Tick the Database name and Id columns. Then redo the trace. It should import into the Tuning Advisor OK.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.