|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 12:01 AM
Points: 559,
Visits: 320
|
|
Haidong, thank you for your reply.
I used the extended stored procedure created a couple of trace running on SQL 7, we are in the process of upgrading to SQL 2000.
In SQL 7, there is an extended stored procedure: xp_trace_setqueueautostart which will make the trace automatically started whenever the server is reboot. But i didn't find the same thing in SQL 2000, that's why i asking the question.
I thought the way you mentioned before, it will restart the trace whenever the Agent is restart, but what happen if you only restart the Agent without restarting the SQL Server ?
Again, thank you for your help.
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, January 18, 2013 11:03 AM
Points: 55,
Visits: 60
|
|
awu,
Tracing and profling have been totally redesigned for SQL 2k, that's why you couldn't see xp_trace_setqueueautostart and other extended stored procedures for tracing.
When you start SQL Agent, SQL Server Service will be started automatically, as SQL Agent service is dependent on SQL Server service.
Hope this helps.
Haidong
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 12:01 AM
Points: 559,
Visits: 320
|
|
No, Haidong, I don't agree with you on "When you start SQL Agent, SQL Server Service will be started automatically, as SQL Agent service is dependent on SQL Server service."
For my understanding, it’s true that when you restart SQL Server, the SQL Agent will restarted automatically, but you are able to restart Agent without restart SQL Server, so my question is, If we put a job to run the your script automatically when the Agent is start, then do we need to check if the existing trace still active, and remove it first before we create another one ? I am afraid we may create multi trace in the system.
Again, thank you for your time.
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, January 18, 2013 11:03 AM
Points: 55,
Visits: 60
|
|
awu,
I suggest you DO the following: 1. Stop both SQL Server Service and SQL Server Agent service; 2. Start SQL Server Agent service. Then verify to see if SQL Server service starts automatically; 3. Again, stop both SQL Server Service and SQL Server Agent service. Now start SQL Server Service. Check SQL Agent service and see if it is started.
After you've done the above, assuming you are running Win2K or above and go to Computer Management. Then go to Services. Make sure SQL Agent service's startup type is Automatic. For WinNT, go to Control Panel, then Services.
Yes, you are able to stop and restart SQL Agent without affecting SQL Server service. I don't have time to test that scenario, but I would agree that the existing trace would still be active, if it is not timed out or stopped manually.
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 12:01 AM
Points: 559,
Visits: 320
|
|
Haidong,
You are right in your sense, I think we are just not in the same page for the same question, my original concern is :
if you put the sp in a job and configure it as "Start automatically when SQL Server Agent starts", then what happen if you only restart the Agent without restarting the SQL Server ? I am afraid we may create multiple trace in the system.
And you actually give me the answer by saying:
Yes, you are able to stop and restart SQL Agent without affecting SQL Server service. I don't have time to test that scenario, but I would agree that the existing trace would still be active, if it is not timed out or stopped manually.
And i test it today, it did keeping create new active trace in the system each time you stop and start Agent service, i fixed this simply put the following the first line inside the SP:
IF EXISTS (select * from ::fn_trace_getinfo(0) where property=5 and value=1) Return
But be aware of the fact, this assume you have only one active trace on the server, and it's true in my system.
Just wanna share this with you, again, thank you for your help, it's great script.
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, January 18, 2013 11:03 AM
Points: 55,
Visits: 60
|
|
awu,
I am happy it worked out for you. Glad to be of help.
Haidong
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, September 09, 2008 2:52 PM
Points: 43,
Visits: 3
|
|
Hi, What you say about this trace select into your analyze table - i used SELECT * INTO dbo.Analyze FROM :: fn_trace_gettable('\\MYHOST\SHAREDFOLDER\trace_filename.trc', default) and after giving anyone all access to this folder that works well...
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Friday, June 09, 2006 5:00 AM
Points: 4,
Visits: 1
|
|
| Hello, I have one question. The article was very good, I made changes to the script so I could trace what I needed to. One more thing, I am trying to filter not just by application name (column 10) but also by the name of the application so I will get activity for that particular app and I am not having much luck. I am poblably missing something simple but...could you help please? Thanks a lot Monica
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, February 17, 2009 5:50 AM
Points: 1,
Visits: 12
|
|
| When I stop running trace, I still cannot open trace file. It seems to keep a lock to it.
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Friday, September 17, 2010 6:13 AM
Points: 1,
Visits: 87
|
|
Too cool. 
Thanks.
|
|
|
|