Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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