| title | Permissions Required |
|---|---|
| titleSuffix | SQL Server Profiler |
| ms.prod | sql |
| ms.prod_service | sql-tools |
| ms.reviewer | |
| ms.technology | profiler |
| ms.topic | conceptual |
| ms.assetid | 5c580a87-88ae-4314-8fe1-54ade83f227f |
| author | markingmyname |
| ms.author | maghan |
| ms.custom | seo-lt-2019 |
| ms.date | 03/14/2017 |
[!INCLUDEappliesto-ss-xxxx-xxxx-xxx-md]
By default, running [!INCLUDEssSqlProfiler] requires the same user permissions as the Transact-SQL stored procedures that are used to create traces. To run [!INCLUDEssSqlProfiler], users must be granted the ALTER TRACE permission. For more information, see GRANT Server Permissions (Transact-SQL).
Important
Users who have the SHOWPLAN, the ALTER TRACE, or the VIEW SERVER STATE permission can view queries that are captured in Showplan output. These queries may contain sensitive information such as passwords. Therefore, we recommend that you only grant these permissions to users who are authorized to view sensitive information, such as members of the db_owner fixed database role, or members of the sysadmin fixed server role. Additionally, we recommend that you only save Showplan files or trace files that contain Showplan-related events to a location that uses the NTFS file system, and that you restrict access to users who are authorized to view sensitive information.
Replaying traces also requires that the user who is replaying the trace have the ALTER TRACE permission.
However, during replay, [!INCLUDEssSqlProfiler] uses the EXECUTE AS command if an Audit Login event is encountered in the trace that is being replayed. [!INCLUDEssSqlProfiler] uses the EXECUTE AS command to impersonate the user who is associated with the login event.
If [!INCLUDEssSqlProfiler] encounters a login event in a trace that is being replayed, the following permission checks are performed:
-
User1, who has the ALTER TRACE permission, starts replaying a trace.
-
A login event for User2 is encountered in the replayed trace.
-
[!INCLUDEssSqlProfiler] uses the EXECUTE AS command to impersonate User2.
-
[!INCLUDEssNoVersion] attempts to authenticate User2, and depending on the results, one of the following occurs:
-
If User2 cannot be authenticated, [!INCLUDEssSqlProfiler] returns an error, and continues replaying the trace as User1.
-
If User2 is successfully authenticated, replaying the trace as User2 continues.
-
-
Permissions for User2 are checked on the target database, and depending on the results, one of the following occurs:
-
If User2 has permissions on the target database, impersonation has succeeded, and the trace is replayed as User2.
-
If User2 does not have permissions on the target database, the server checks for a Guest user on that database.
-
-
Existence of a Guest user is checked on the target database, and depending on the results, one of the following occurs:
-
If a Guest account exists, the trace is replayed as the Guest account.
-
If no Guest account exists on the target database, an error is returned and the trace is replayed as User1.
-
The following diagram shows this process of checking permission when replaying traces:

SQL Server Profiler Stored Procedures (Transact-SQL)
Replay Traces
Create a Trace (SQL Server Profiler)
Replay a Trace Table (SQL Server Profiler)
Replay a Trace File (SQL Server Profiler)