Wednesday, March 21, 2012

Run trace script

Hi All,
I really need help to fix this issue. Below is what I am trying to do.
I created a trace template and script it out to be a SQL script file. I
want to run this script when CPU utilizes at over 50 or 60 or higher. I
set up an System Moniter Alert to run this script when CPU runs meet
above threshold. However, when I manipulated data in Query Analyzer to
make CPU utilize at 100% but trace script never get kick off.
The ideal task is, I wanted to capture what is running on my box when
CPU runs at 50% or higher.
Please let me know and provide me any instructions on what I'm missing.
Thanks,
Silaphet,
What's the interval for sampling the perofmance data, in your alert? Could
it be that when the alert is checking the CPU utilisation, the CPU was not
really running above the threshold?
How is the alert supposed to invoke the trace? Are you using a OSQL?
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Silaphet" <kmounkhaty@.cox.net> wrote in message
news:1108700587.482182.134100@.l41g2000cwc.googlegr oups.com...
Hi All,
I really need help to fix this issue. Below is what I am trying to do.
I created a trace template and script it out to be a SQL script file. I
want to run this script when CPU utilizes at over 50 or 60 or higher. I
set up an System Moniter Alert to run this script when CPU runs meet
above threshold. However, when I manipulated data in Query Analyzer to
make CPU utilize at 100% but trace script never get kick off.
The ideal task is, I wanted to capture what is running on my box when
CPU runs at 50% or higher.
Please let me know and provide me any instructions on what I'm missing.
Thanks,
Silaphet,
|||Hi Vyas,
The interval was 2 for sampling data and the unit was seconds. While
the alert was running, I manipulated data to insert into a table in
millions rows from Query Analyzer. At that time, I watched the CPU and
it was 100% for at least 5 seconds to complete. I though, when CPU ran
over the threshold the alert should kick off the trace script file to
capture the SQL statements that I inserted data into table as I
explained above.
In the alert, there is a tab called "ACTION" and has option check box
says 'run this program'. I checked this option with valid path where I
store my strace script file.
Do I need to convert my trace script SQL file to be cmd or executable
file before alert can kick it of?
Please let me know what do I have to do to remedy this issue.
Thanks,
Silaphet,
|||You mean, you provided a path to your .sql file where your sql commands are
stored? Then it will not work. See OSQL in SQL Server Books Online. It can
take your script file and server details as parameters and run your script
against the specified server.
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Silaphet" <kmounkhaty@.cox.net> wrote in message
news:1108736989.524985.277180@.l41g2000cwc.googlegr oups.com...
Hi Vyas,
The interval was 2 for sampling data and the unit was seconds. While
the alert was running, I manipulated data to insert into a table in
millions rows from Query Analyzer. At that time, I watched the CPU and
it was 100% for at least 5 seconds to complete. I though, when CPU ran
over the threshold the alert should kick off the trace script file to
capture the SQL statements that I inserted data into table as I
explained above.
In the alert, there is a tab called "ACTION" and has option check box
says 'run this program'. I checked this option with valid path where I
store my strace script file.
Do I need to convert my trace script SQL file to be cmd or executable
file before alert can kick it of?
Please let me know what do I have to do to remedy this issue.
Thanks,
Silaphet,
|||Vyas,
Let me explain to you clearly now. I have 2 files name below:
1. RunOSQL.SQL
This file has this OSQL syntax below
"OSQL -Sserver\Instance -Usa -Ppassword -iInputfile
The RunOSQL.SQL file is the file I provide the with a valid path on
the Action tab of alert.
2. The input file is the file to create trace when CPU utilization hits
over threshold
Both these files are located in C drive.
But when I inserted millions rows into a temp table the CPU ran at 100%
and the script never get executed. I think, I have to make this SQL
script to be a cmd, exe or bat file before it can call another script
to get executed.
Please let me know what I am missing now.
Thanks,
Silaphet,
|||Name the file containing the OSQL.EXE call as a .BAT file. For example,
RunScript.bat
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"Silaphet" <kmounkhaty@.cox.net> wrote in message
news:1108751013.930610.13850@.c13g2000cwb.googlegro ups.com...
> Vyas,
> Let me explain to you clearly now. I have 2 files name below:
> 1. RunOSQL.SQL
> This file has this OSQL syntax below
> "OSQL -Sserver\Instance -Usa -Ppassword -iInputfile
> The RunOSQL.SQL file is the file I provide the with a valid path on
> the Action tab of alert.
> 2. The input file is the file to create trace when CPU utilization hits
> over threshold
> Both these files are located in C drive.
> But when I inserted millions rows into a temp table the CPU ran at 100%
> and the script never get executed. I think, I have to make this SQL
> script to be a cmd, exe or bat file before it can call another script
> to get executed.
>
> Please let me know what I am missing now.
> Thanks,
> Silaphet,
>
sql

No comments:

Post a Comment