![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
-----Original Message----- How can I schedul my trace to save the result periodicly in SQL Profiler? On Tue, 01 Jul 2003 10:44:23 +0430, M mary2001 (AT) canada (DOT) com> wrote: Hi I 've SQL Server 2000(client/server) and I want to keep and save all activities happening in my databases life,and I found SQL Profiler which trace each steps and show me these activities, but how can I do this everyday?should I physically come and run a new trace in SQL Profiler ? and you know that it can save the result at most in 9999rows table,so when it became to full it's time to define another one, another question:to prevent creating different tables for trace result can we append second and 3th and... result at the end of first one? totally,is it a correct way to save DB activities for SQLAdmin and refer to them in several times? I'd be thankful for your help. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ . |
#3
| |||
| |||
|
|
Hi I 've SQL Server 2000(client/server) and I want to keep and save all activities happening in my databases life,and I found SQL Profiler which trace each steps and show me these activities, but how can I do this everyday?should I physically come and run a new trace in SQL Profiler ? and you know that it can save the result at most in 9999rows table,so when it became to full it's time to define another one, another question:to prevent creating different tables for trace result can we append second and 3th and... result at the end of first one? totally,is it a correct way to save DB activities for SQLAdmin and refer to them in several times? I'd be thankful for your help. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ |
#4
| |||
| |||
|
|
You can automate the profiler via it's system stored procedure APIs. These stored procs changed dramatically between versions 7.0 & 2000 though: For SQL 2000, use: sp_trace_create For SQL 7.0, use: xp_trace_addnewqueue Both of these are documented in the respective version's Books Online. Do follow Ray's advice - it's usually a bad idea to log profiler activity to db tables because you're actually impacting the performance of the db itself whilst doing the logging! This can sometimes be the straw that breaks the camel's back if the server starts approaching resource saturation as the profiler will be consuming resources that the database server really needs to survive. Log profiler activity to a file via the abovementioned APIs (depending on which SQL version you're using) and then log to an offline db table or load into the profiler GUI for offline analysis, away from the production server. HTH Regards, Greg Linwood SQL Server MVP -----Original Message----- How can I schedul my trace to save the result periodicly in SQL Profiler? On Tue, 01 Jul 2003 10:44:23 +0430, M mary2001 (AT) canada (DOT) com> wrote: Hi I 've SQL Server 2000(client/server) and I want to keep and save all activities happening in my databases life,and I found SQL Profiler which trace each steps and show me these activities, but how can I do this everyday?should I physically come and run a new trace in SQL Profiler ? and you know that it can save the result at most in 9999rows table,so when it became to full it's time to define another one, another question:to prevent creating different tables for trace result can we append second and 3th and... result at the end of first one? totally,is it a correct way to save DB activities for SQLAdmin and refer to them in several times? I'd be thankful for your help. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ . |
#5
| |||
| |||
|
|
You can automate the profiler via it's system stored procedure APIs. These stored procs changed dramatically between versions 7.0 & 2000 though: For SQL 2000, use: sp_trace_create For SQL 7.0, use: xp_trace_addnewqueue Both of these are documented in the respective version's Books Online. Do follow Ray's advice - it's usually a bad idea to log profiler activity to db tables because you're actually impacting the performance of the db itself whilst doing the logging! This can sometimes be the straw that breaks the camel's back if the server starts approaching resource saturation as the profiler will be consuming resources that the database server really needs to survive. Log profiler activity to a file via the abovementioned APIs (depending on which SQL version you're using) and then log to an offline db table or load into the profiler GUI for offline analysis, away from the production server. HTH Regards, Greg Linwood SQL Server MVP -----Original Message----- How can I schedul my trace to save the result periodicly in SQL Profiler? On Tue, 01 Jul 2003 10:44:23 +0430, M mary2001 (AT) canada (DOT) com> wrote: Hi I 've SQL Server 2000(client/server) and I want to keep and save all activities happening in my databases life,and I found SQL Profiler which trace each steps and show me these activities, but how can I do this everyday?should I physically come and run a new trace in SQL Profiler ? and you know that it can save the result at most in 9999rows table,so when it became to full it's time to define another one, another question:to prevent creating different tables for trace result can we append second and 3th and... result at the end of first one? totally,is it a correct way to save DB activities for SQLAdmin and refer to them in several times? I'd be thankful for your help. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ . |
#6
| |||
| |||
|
|
I tried following: sp_trace_create -- @traceid = ce_id OUTPUT , @options = 2 , @tracefile = N'f:\ttt.trc' , @maxfilesize = 5 , @stoptime = '9:15' but there was no success,by commenting each row a new error would be appearred related to datatype of each parameters like below: *********** Server: Msg 214, Level 16, State 3, Procedure sp_trace_create, Line 1 Procedure expects parameter '@maxfilesize' of type 'bigint'. Procedure expects parameter '@tracefile' of type 'nvarchar(128)'. what's wrong? any help would be thankful On Tue, 1 Jul 2003 04:30:07 -0700, Greg Linwood <g_linwood (AT) hotmail (DOT) com wrote: You can automate the profiler via it's system stored procedure APIs. These stored procs changed dramatically between versions 7.0 & 2000 though: For SQL 2000, use: sp_trace_create For SQL 7.0, use: xp_trace_addnewqueue Both of these are documented in the respective version's Books Online. Do follow Ray's advice - it's usually a bad idea to log profiler activity to db tables because you're actually impacting the performance of the db itself whilst doing the logging! This can sometimes be the straw that breaks the camel's back if the server starts approaching resource saturation as the profiler will be consuming resources that the database server really needs to survive. Log profiler activity to a file via the abovementioned APIs (depending on which SQL version you're using) and then log to an offline db table or load into the profiler GUI for offline analysis, away from the production server. HTH Regards, Greg Linwood SQL Server MVP -----Original Message----- How can I schedul my trace to save the result periodicly in SQL Profiler? On Tue, 01 Jul 2003 10:44:23 +0430, M mary2001 (AT) canada (DOT) com> wrote: Hi I 've SQL Server 2000(client/server) and I want to keep and save all activities happening in my databases life,and I found SQL Profiler which trace each steps and show me these activities, but how can I do this everyday?should I physically come and run a new trace in SQL Profiler ? and you know that it can save the result at most in 9999rows table,so when it became to full it's time to define another one, another question:to prevent creating different tables for trace result can we append second and 3th and... result at the end of first one? totally,is it a correct way to save DB activities for SQLAdmin and refer to them in several times? I'd be thankful for your help. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ . -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ |
#7
| |||
| |||
|
#8
| |||
| |||
|
|
now I successed to define a trace with following code now how can I start it?and how can I make as an autostart statement when SQL Server will need to autostart? -----------------it returned 12--------- declare @rc int, @TraceID int declare @maxfilesize bigint set @maxfilesize = 5 exec @rc = sp_trace_create @TraceID output, 2, N'e:\esttrace', @maxfilesize, NULL print @rc ----------------- On Tue, 1 Jul 2003 22:18:27 -0700, Kalen Delaney replies (AT) public_newsgroups (DOT) com> wrote: -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ |
#9
| |||
| |||
|
|
now I successed to define a trace with following code now how can I start it?and how can I make as an autostart statement when SQL Server will need to autostart? -----------------it returned 12--------- declare @rc int, @TraceID int declare @maxfilesize bigint set @maxfilesize = 5 exec @rc = sp_trace_create @TraceID output, 2, N'e:\esttrace', @maxfilesize, NULL print @rc ----------------- On Tue, 1 Jul 2003 22:18:27 -0700, Kalen Delaney replies (AT) public_newsgroups (DOT) com> wrote: -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ |
#10
| |||
| |||
|
|
A good way to configure a trace is to use SQL Profiler itself: First create a trace in GUI and pick whatever events and columns you want. Run it manually to verify that it returns what you expect. Once you are happy with it select File|Script Trace|For SQL 2000 menu option. It will create a SQL script that configures and starts a trace that you have just ran. A side note: Please remember that tracing puts a significant burden on a server. There may be other ways of accomplishing what you need. If you really want to go that route, configure your trace so it requests only events and columns that you really need. Hope that helps. Regards, Maciek Sarnowicz ----------------------------- This posting is provided "AS IS" with no warranties, and confers no rights. "M" <mary2001 (AT) canada (DOT) com> wrote in message news prrn7dtg8hu9goh (AT) msnews (DOT) microsoft.com...now I successed to define a trace with following code now how can I start it?and how can I make as an autostart statement when SQL Server will need to autostart? -----------------it returned 12--------- declare @rc int, @TraceID int declare @maxfilesize bigint set @maxfilesize = 5 exec @rc = sp_trace_create @TraceID output, 2, N'e:\esttrace', @maxfilesize, NULL print @rc ----------------- On Tue, 1 Jul 2003 22:18:27 -0700, Kalen Delaney replies (AT) public_newsgroups (DOT) com> wrote: -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ |
![]() |
| Thread Tools | |
| Display Modes | |
| |