We have two servers each running SQL7. I cannot run a trace on one server from the other. Whatever server name I enter in the drop down box, the trace only records activity on the server that profiler is running on. Even if I put a non-existent server name in the box (!), the trace accepts the name but still only runs on the host server.
How on earth can a Profile Trace be run where SSE 2005 is installed??? In the past, with MSDE, we always installed the 'tools' on a local workstation, so that we had EnterPrise Manager and its suite of tools...no problem. Yet, with Management Studio Express (err...Distress?), there's no way to do this! I've scoured the net, and I see threads where people have done it, yet, no one seems to be clear...including Microsoft...on how to obtain this MOST IMPORTANT of all tools for an SQL deployment.
I am attempting to create a new trace but I get the following error message: "failed to start a new trace".
I have been doing some digging and as I understand it, I had to find the directory Profiler uses for temporary files. So, I typed the following in the command window "SET TMP" and I received the following reply:
C:UsersRossAppDataLocalTemp
Now, according to the forum: [URL] ...
I am supposed to check that the system folder pointed to by the TMP environment variable exists and is not crammed with files.
Well, when I went to the directory C:UsersRossAppDataLocalTemp, it is indeed full of both files and directories. The size is 16.3 MB and has 133 files and 63 folders.
When I had a look at the Environment Variables window and chose TMP the value is "%USERPROFILE%AppDataLocalTemp" which according to my limited understanding is the equivalent to C:UsersRossAppDataLocalTemp.
So, what I am wondering is am I supposed to totally clear out this directory? I am not too keen on doing this because I don't want to stuff my PC up.
This is for SQL Server 2005 SP4 Build 5266. We have been having performance issues in production. There are tight deadlines to be met and it is important that they are solved promptly.
Yesterday we replicated the situation in the acceptance testing environment. The jobs take 8 hours to run and we started at 2:00 PM.
Just before the jobs ran I set up an SQL Server Profiler trace to catch processes with a duration of longer then 12 seconds. I set it to save the results to a database table.
Last night I checked the table at 5:00 PM and there were entries in the table. However, I could be mistaken.
At 9:00 PM I checked the table and it was empty.
This morning I arrived at work and checked SQL Server Profiler. The trace was running and within SQL Server Profiler, there are 100s of results. I stopped the trace. However, checking the table, it is empty.
I thought I would be able to save the trace results to a file. When I chose "Save As" from the file menu, all the options are greyed out (trace file, trace template, trace table, etc).
The results are there but there is no way of saving them and no way of exporting them. How could this have happened?
Is there a location, where SQL Server Profiler saves the results in a temporary space. I may be able to open them and retrieve them. How can I save the results? Why are all my options greyed out?
Set up a trace with the events RPC:Completed, SQL:BatchCompleted, SQL:BatchStarting, and SQL:StmtCompleted.
When I issue the statement: SELECT * FROM XyzView there is nothing captured in Profiler. If I script out the view and then execute the select statement that defines the view, it does show up in Profiler.
I've tried adding a lot of the other events, i.e. SP:StmtCompleted and the various other StmtStarting events and the trace still does not capture anything.
Am I capturing the wrong events or is this known behavior? My goal is to see what the overhead is for using a view versus persisting the results of the view as a table and referencing that instead. The view in question is against static data, joins 9 tables, and is referenced a lot.
I can use the stats generated when I execute the select that defines the view but I still find this to be curious behavior so I assume I'm doing something wrong.
I am going over the output of a Profiler trace and I've found that the duration for many occurrences of EventClass 15 (Logout) is several seconds, up to a maximum of 20 seconds. That seems excessive just to complete a logout, so my question is, does the duration figure reflect only the time to complete the logout operation or does it include the total time that the connection has been active for?
Anyone can tell me how I can take out the events which produce SSMS? (open query windows create three rows). I don't see anythinq filter for SSMS in filter events of profiler. I'm doing at trace and this is not confortable.
im trying to understand how the profiler works. so i started 2profilers,one listen to another and I saw the profiler is running:exec sp_trace_create @P1 output, 1, NULL, NULL, NULLwhich means @tracefile = NULLso where from the profiler read the results?!
HiI want read a trace file generated by SQL Server 2005 througr SQLServer 2000.But fn_trace_gettable function in SQL 2000 does not recognize the fileas of proper format.If there is some other tool or utility available through which i canread the file generated by SQL Server 2005.Or if I can get the file format of the file then I will write my owntool.ThanksPushkar
Greetings,I have been attempting to develop a useful and functional template fordatabase tracing/profiling that will enable me to collect metrics forperformance tuning. The database is used as an OLTP database as well asrunning reports. Below is a list of my trace properties and data columns.I would be interested to see other examples and strategies for the Profiler.thanxPerformanceExecution planSecurityAudit LoginAudit LogoutSessionsExisting ConnectionStored ProceduresRPC: CompletedTSQLSQL:Batch completedDATA COLUMNSEvent classtextdataapplication nameNTUsernameLoginNamesCPUreadwritedurationclient proc idSPIDStarttime
If a table has a trigger on it, and I am profiling.. on StmtCompleted... no filters... all teh stored proc code comes up, but, is there any way at all to see the same for trigger statements? I want to trace thru the proc and thru all trigger code also. Any ideas on work-around to trace trigger code, if Profiler can't do it? Thanks, Bruce
Can anyone provide with an example of how to script a profiler trace to have the data wind up in a SQL Table. The scripting mechnism that comes with SQL Server will not allow you to put the results in a table.
I've set the Duration of my trace to "Greater than or Equal to: 1000". However when I start my trace the Duration column is now empty. Prior to the setting, there were values showing in this column. Any ideas on how to fix this?
Is there a way to setup a trace to show only direct TSQL statements triggered on my server? note I don't want to capture Procedure calls or the statements called within the procs.
Actually many people are firing direct SQL statements on server. And some are coming from entity framework as well. I just want to capture those.
I have discovered trace output in MSSQLDATAMSSQL.1MSSQLLOG that I have not kicked off. It is at various times and limited to 20MB. So that tells me a server event is kicking off a pre-defined trace. The trace contains mostly hash warnings and sort warnings. I have looked through my Agent Jobs, Agent Alerts, and perfmon and don't find anything that is set up to kick off a trace under a specified condition. I have checked the job activity, SQL error logs, SQL server logs, and the server's event viewer for any odd events or event times that correlate with the times of the traces. I have checked each database's sys.sql_modules for a definition containing '%sp_trace%'. Where else can I check to find what would be triggering these traces?
Our app logins don't have permissions high enough to run traces, I verified:
You do not have permission to run 'SP_TRACE_CREATE'
I am the DBA, not a .NET programmer -- so I am lacking experience if there's anything on the .NET side.
This is SQL 2005 64-bit running active/passive on a Win2003 clustered pair.
With SQL Server 2005 there is an option to grant a person access to Profiler for tracing SQL. This is done with the "GRANT ALTER TRACE" statement. The statement has to be executed at server level i.e. the master database.
The user in question only has access to certain databases on that server. The security problem that arises is that with the Profiler rights active, he can see the sql commands that are executed on the databases he has no rights for. Those SQL commands are executed by others users.
How do I configure security rules so that the person in question can use Profiler, but can only see the SQL statements that are executed on the databases he has the rights for? TIA!
I am trying to load all the MDX queries that run on a Analysis Server instance into a database for further analysis. A SQL Profiler is setup which captures the MDX queries, and when I am loading the Profiler info to database, some of the queries are not coming up in full length.The TextData field doestn't show full MDX query. When loading to the database, the field is next data type. Is there any workaround to get the complete MDX query?
Hi there - can anyone advise on the following issue. We have recently performed some server side tracing on a particular SQL instance over 24hr period. We are now attempting to load these into a database for analysis. Here lies the problem.
When we are loading the profiler trace files (one at a time) into the database the transaction log is growing at an excessive rate. Even though the database is in SIMPLE mode.
We are loading the traces using the command:
INSERT INTO sqlTableToLoad SELECT * FROM ::fn_trace_gettable('MytraceFileName', DEFAULT)
Can anyone advise how we could possibly get round this issue as we're running out of space due to the transaction log.
Hi I have a problem in my SQL Server 2005. This morning I got a message of "Low Disk Space" in the drive "C" of a virtual machine, when I looked at the directory: C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12DataMSSQL.4MSSQLData I found 454 sql server profiler - trace data files in that folder, one of them like this one: audittrace20080207220657_13.trc takes 204,800KB, and totally takes 89GB in that folder. That's why I got "Low Disk Space" I know that we need profiler to troubleshoot data, view the event...but these kind of .trc files were keep created in the "Data" folder in every 2 hours everyday and soon it will takes all the hard drive in the server. Is there anything I can set in SQL Server 2005 or other settings to delete the profile over 1 week or so automaticlly to free the space in the server?
I am working with 3 sql 7.0 servers (Servers A, B, C) and am trying to create a trace via profiler to run against server B.
Every trace that I create keeps pointing to server A even though I have server B defined in the properties of the trace - (when I edit the trace properties it REALLY does show server B). I have server B defined in the screen where you 'Select the SQL Server to run the trace on'. I even used the wizard to run one of the canned traces and it still points to server A. Every trace I set up runs against server A. Can anyone think of what the heck I'm doin' wrong? Is is a configuration setting somewhere?
I have created a server-side procedure which captures evenst for audit purposes and save to a file onto the SQL Server. This procedure has been defined as an autoload so that when the server is restarted, this procedure automatically loads.
However, there is a fundemental flaw with this routine. When the procedure attempts to execute, it will abort due to the fact that the trace file already exists.
I have two choices:-
1. When the procedure restarts, append to existing file or 2. Make a folder which comprise of today's day ie 20080128 and move trace file/s to this folder.
Option 2 is preferred.
How can I make this achievable?
Please note I'm using SQL Server 2005.
Ken
Below is a sample of my Code
-- Create a Queue -- Declare Control Variable declare @ReturnCode int declare @Rc int -- Declare Option Variable declare @TraceID int declare @maxfilesize bigint declare @ColumnId int declare @LogicalOperator int declare @ComparisonOperator int declare @Value int declare @Option int declare @on bit declare @Event int -- Set Option Variables set @maxfilesize = 100 -- Maximum file size in megabytes set @Option = 6 -- TraceFileRollOver and ShutdownOnError set @on = 1 -- True set @ReturnCode = 0 -- No Error exec @Rc = sp_trace_create @TraceID output, @Option, N'\Server_named$SQLTraceActivity', @maxfilesize, NULL select @ReturnCode=@@Error if @ReturnCode <> 0 Begin if @ReturnCode = 1 Print 'Error 1 - Unknown error.' if @ReturnCode = 10 Print 'Error 10 - Invalid options. Returned when options specified are incompatible.' if @ReturnCode = 12 Print 'Error 12 - Cannot create tracefile - check if file already exists, or this trace already running' if @ReturnCode = 13 Print 'Error 13 - Out of memory. Returned when there is not enough memory to perform the specified action.' if @ReturnCode = 14 Print 'Error 14 - Invalid stop time. Returned when the stop time specified has already happened.' if @ReturnCode = 15 Print 'Error 15 - Invalid parameters. Returned when the user supplied incompatible parameters.' else Print 'Unexpected and Unknown error In creating trace - Please review' Goto ErrorHandler End -- Set Events -- Trace NTDomainName for Object:Altered event exec sp_trace_setevent @TraceID, 164, 7, @on -- Trace HostName for Object:Altered event exec sp_trace_setevent @TraceID, 164, 8, @on -- Trace IndexID for Object:Altered event exec sp_trace_setevent @TraceID, 164, 24, @on -- Trace RequestID for Object:Altered event exec sp_trace_setevent @TraceID, 164, 56, @on -- Trace SessionLoginName for Object:Altered event exec sp_trace_setevent @TraceID, 164, 64, @on -- Trace ClientProccessID for Object:Altered event exec sp_trace_setevent @TraceID, 164, 9, @on -- Trace IntegerData for Object:Altered event exec sp_trace_setevent @TraceID, 164, 25, @on -- Trace LogionSid for Object:Altered event exec sp_trace_setevent @TraceID, 164, 41, @on -- Trace RequestID for Object:Altered event exec sp_trace_setevent @TraceID, 164, 49, @on -- Trace NTUserName for Object:Altered event exec sp_trace_setevent @TraceID, 164, 6, @on -- Trace ApplicationName for Object:Altered event exec sp_trace_setevent @TraceID, 164, 10, @on -- Trace StartTime for Object:Altered event exec sp_trace_setevent @TraceID, 164, 14, @on -- Trace ObjectID for Object:Altered event exec sp_trace_setevent @TraceID, 164, 22, @on -- Trace ServerName for Object:Altered event exec sp_trace_setevent @TraceID, 164, 26, @on -- Trace ObjectName for Object:Altered event exec sp_trace_setevent @TraceID, 164, 34, @on -- Trace XactSequence for Object:Altered event exec sp_trace_setevent @TraceID, 164, 50, @on -- Trace DatabaseID for Object:Altered event exec sp_trace_setevent @TraceID, 164, 3, @on -- Trace LoginName for Object:Altered event exec sp_trace_setevent @TraceID, 164, 11, @on -- Trace NTDomainName for Object:Altered event exec sp_trace_setevent @TraceID, 164, 35, @on -- Trace EventSequence for Object:Altered event exec sp_trace_setevent @TraceID, 164, 51, @on -- Trace TransactionID for Object:Altered event exec sp_trace_setevent @TraceID, 164, 4, @on -- Trace SPID for Object:Altered event exec sp_trace_setevent @TraceID, 164, 12, @on -- Trace ObjectType for Object:Altered event exec sp_trace_setevent @TraceID, 164, 28, @on -- Trace IsSystem for Object:Altered event exec sp_trace_setevent @TraceID, 164, 60, @on -- Trace EventSubClass for Object:Altered event exec sp_trace_setevent @TraceID, 164, 21, @on
I have created a server-side procedure which captures evenst for audit purposes and save to a file onto the SQL Server. This procedure has been defined as an autoload so that when the server is restarted, this procedure automatically loads.
However, there is a fundemental flaw with this routine. When the procedure attempts to execute, it will abort due to the fact that the trace file already exists.
I have two choices:-
1. When the procedure restarts, append to existing file or
2. Make a folder which comprise of today's day ie 20080128 and move trace file/s to this folder.
Option 2 is preferred.
How can I make this achievable?
Please note I'm using SQL Server 2005.
Ken
Below is a sample of my Code
-- Create a Queue
-- Declare Control Variable
declare @ReturnCode int
declare @Rc int
-- Declare Option Variable
declare @TraceID int
declare @maxfilesize bigint
declare @ColumnId int
declare @LogicalOperator int
declare @ComparisonOperator int
declare @Value int
declare @Option int
declare @on bit
declare @Event int
-- Set Option Variables
set @maxfilesize = 100 -- Maximum file size in megabytes
set @Option = 6 -- TraceFileRollOver and ShutdownOnError
There is a bug in one of the service packs where Profiler (7.0) only traces one server (regardless of the server you tell it to trace). Can anyone tell me how to fix this or point me to a KB article? I thought this was fixed in SQL 7 SP 3, however I'm experiencing this problem with SP3 installed.
We have several SQL servers in our network. When we try to connect to any of these servers with SQL profiler, the connection is always made with the same server, irrespective of the servername we use. There is no default server name used in the setting of SQL profiler application.
I am trying to create a trace that informs me when a stored proc is created, modified or dropped in a particular database. The trace event I have selected is TSQL->SQL:StmtCompleted. The only filter I have in place is on database ID. The ID value is set to the database containing the stored proc's I want to monitor.
If I drop a proc, I get an entry in the Profiler. However, if I add or modify a proc, I get nothing. Does anyone know what I might be doing wrong?
BTW, adding another filter on object ID (1 for sysobjects or 8 for syscomments) doesn't help either.
Is the security granularity in SQL Server 2005 good enough that I can allow certain users to have permissions to use Profiler ONLY on their database with out granting them sysadmin privilege? I know that it uses the master database which makes it complex. Thanks in advance.
I am trying to access SQL Server Profiler while connected via a VPN. I am able to connect while I am physically on the network but when I connect via the VPN it gives me the following error:
Cannot connect to xxx.xxx.xxx
Additional Information:
Login timeout expired An error has occured while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. Named Piped Provider: Could not open a connection to SQL Server [53]. (pfutil90)
I am able to access the database and browse tables/run queries/etc. But only when I try to create a trace I get the error. Does SQL Profiler act funny when going through a VPN?