Search This Blog

Tuesday, September 21, 2010

DTA will fail to execute if loginname in trace didn't have SHOWPLAN permissions.

Hi,

I came across a question which is as below:

Problem Description
*********************
We have a user named TEST and it has DB_DATAREADER ; DB_DATAWRITER permissions on a database say it as TEST.

We have a query which take long time to execute. We capture Profiler Trace for
this query (executed by TEST user) with below mentioned events:

Stored Procedure : RPC Started
RPC Completed
SP:Started
SP:Completed
SP:StmtStarted
SP:StmtCompleted
TSQL : SQL:BatchStarted
SQL:BatchCompleted
SQL:StmtStarting
SQL:StmtCompleted

We use this Profiler trace and execute Database Tunning Advisor (DTA) but DTA
fails to execute.

Root Cause
***********

When we run DTA on a Trace file that has LOGINNAME column selected in this, if
that user didn't have SHOWPLAN permission on said database then it will fail to
run DTA tasks and as a result will fail with below type of errors.

TITLE: Database Engine Tuning Advisor
------------------------------
An unexpected error occurred. Click Continue to ignore this error and attempt to continue. Click Quit to shut down the application immediately.

For help, click: http://go.microsoft.com/fwlink?
ProdName=Microsoft+SQL+Server+Database+Engine+Tuning+Advisor&ProdVer=9.00.4035.00
;EvtSrc=Microsoft.SqlServer.ExpressManager.SRMainError&EvtID=UnexpectedError&LinkId
=20476
------------------------------
ADDITIONAL INFORMATION:

Cannot select non-existing cell (0, 0, 0, 0).
Parameter name: SelectionBlocks (Microsoft.SqlServer.GridControl)
------------------------------
BUTTONS: &Continue &Quit
------------------------------

Resolution
***********

Either we should provide SHOWPLAN permission to the user who ran that query and
which is in the trace file.

Don't select LOGINNAME column while capturing profiler trace in this case DTA
In this case, the dta impersonate the loginname as sysadmin or dbowner, and tune
all the events captured.

No comments: