Showing posts with label log. Show all posts
Showing posts with label log. Show all posts

Friday, March 30, 2012

Performance Tuning SQL query in Trigger

i am using sql server 2000. I have written update trigger on CORP_CAGE table to log the details in

CORP_CAGE_LOG_HIST table,if any changes in EMP_SEQ_NO column.

please find the structure of CORP_CAGE table:

1.CORP_CAGE_SEQ_NO
2.RECEIVED_DATE
3.EMP_SEQ_NO

CORP_CAGE table is having 50,000 records. the trigger "Check_Update" is fired when i am executing the following

query from application which updates 10,000 records.

UPDATE CORP_CAGE SET EMP_SEQ_NO=NULL WHERE EMP_SEQ_NO=111

please find below the trigger,in that, trigger can easily find whether any UPDATE done in EMP_SEQ_NO column by using

UPDATE FUNCTION.
But,when it come to insert part, it takes more time(nearly 1 hour or sometimes it will hang.).For minimum

records,this trigger is working fine.


Create trigger Check_Update ON dbo.CORP_CAGE FOR UPDATE AS
BEGIN
IF UPDATE(EMP_SEQ_NO)
BEGIN
INSERT CORP_CAGE_LOG_HIST
(
CAGE_LOG_SEQ_NUM,
BEFORE_VALUE,
AFTER_VALUE,
ENTRY_USER,
FIELD_UPDATED
)
SELECT
i.CAGE_LOG_SEQ_NUM,
d.RECEIVED_DATE,
i.RECEIVED_DATE,
i.UPDATE_USER,
"EMP_SEQ_NO"
FROM
inserted i,
deleted d
WHERE
i.CAGE_LOG_SEQ_NUM = d.CAGE_LOG_SEQ_NUM
END

END

please help me on this for performance tuning the below query.

I don't have the schema of your table, which in this case is critical. However, if this statement:

Code Snippet

UPDATE CORP_CAGE SET EMP_SEQ_NO=NULL WHERE EMP_SEQ_NO=111

is updating 10,000 records then your join is going to cause an update that is the cross product of 10,000 x 10,000 or 100,000,000 logical records. This cannot be right. Look at your trigger WHERE condition:

Code Snippet

WHERE
i.CAGE_LOG_SEQ_NUM = d.CAGE_LOG_SEQ_NUM

since you are updating ONLY for SEQ_NO = 111 and you are joining the INSERTED pseudo table -- with 10,000 records -- with the DELETE pseudo table -- also with 10,000 records -- and since all records of the DELETED pseudo and all records of the DELETED pseudo have the same SEQ_NO -- specifically 111 you end up with the cross product. You need to linclude the KEY information as part of the join condition.

sql

Wednesday, March 28, 2012

Performance Related Question

I am doing a performance counter for the CPU usage and
recording the output to a log file.
What i want to know is a way where I can say that the max
CPU usage say 80% occured for x amount of time, the
perfmon does not tell me how long was the maximum time
was for.
so i want something like CPU usage max value 80% was for
9 seconds.
Any ideasapok
In the Performance Monitor you can set up a range of intervals , i mean from
9am to 11am and see how CPU behaved since.
Also, If I rememeber well there are some classes in .NET framework you can
use to get the info from PM.
"apok" <anonymous@.discussions.microsoft.com> wrote in message
news:15aa01c535b7$e327f0a0$a501280a@.phx.gbl...
> I am doing a performance counter for the CPU usage and
> recording the output to a log file.
> What i want to know is a way where I can say that the max
> CPU usage say 80% occured for x amount of time, the
> perfmon does not tell me how long was the maximum time
> was for.
> so i want something like CPU usage max value 80% was for
> 9 seconds.
> Any ideas

Performance Related Question

I am doing a performance counter for the CPU usage and
recording the output to a log file.
What i want to know is a way where I can say that the max
CPU usage say 80% occured for x amount of time, the
perfmon does not tell me how long was the maximum time
was for.
so i want something like CPU usage max value 80% was for
9 seconds.
Any ideasapok
In the Performance Monitor you can set up a range of intervals , i mean from
9am to 11am and see how CPU behaved since.
Also, If I rememeber well there are some classes in .NET framework you can
use to get the info from PM.
"apok" <anonymous@.discussions.microsoft.com> wrote in message
news:15aa01c535b7$e327f0a0$a501280a@.phx.gbl...
> I am doing a performance counter for the CPU usage and
> recording the output to a log file.
> What i want to know is a way where I can say that the max
> CPU usage say 80% occured for x amount of time, the
> perfmon does not tell me how long was the maximum time
> was for.
> so i want something like CPU usage max value 80% was for
> 9 seconds.
> Any ideassql

Performance Related Question

I am doing a performance counter for the CPU usage and
recording the output to a log file.
What i want to know is a way where I can say that the max
CPU usage say 80% occured for x amount of time, the
perfmon does not tell me how long was the maximum time
was for.
so i want something like CPU usage max value 80% was for
9 seconds.
Any ideas
apok
In the Performance Monitor you can set up a range of intervals , i mean from
9am to 11am and see how CPU behaved since.
Also, If I rememeber well there are some classes in .NET framework you can
use to get the info from PM.
"apok" <anonymous@.discussions.microsoft.com> wrote in message
news:15aa01c535b7$e327f0a0$a501280a@.phx.gbl...
> I am doing a performance counter for the CPU usage and
> recording the output to a log file.
> What i want to know is a way where I can say that the max
> CPU usage say 80% occured for x amount of time, the
> perfmon does not tell me how long was the maximum time
> was for.
> so i want something like CPU usage max value 80% was for
> 9 seconds.
> Any ideas

Wednesday, March 7, 2012

Performance of backup across network

I am hoping someone with experience can help me with this.
I have been doing differential and log backups across a network to a device
specified by a UNC path for some time. The backup sizes have been small
enough that performance was no issue. Full backups, which total about 250
GB, I have been doing to a RAID set on the local machine, then doing a copy
(literally the command line copy from a batch script) to the same UNC path
as the diff and logs. The backup itself takes about 2.5 hours, and the copy
another 4 hours. The network is dedicated gigabit. The target machine uses
RAID 10 and can do local I/O at >= 60 MB/s. The network can definitely
sustain 30 MB/s with an app that has a clue about the network. xcopy can
sometimes hit that pace, but it and copy more typically do 17 MB/s.
Because I want to use the disk space on the SQL Server box for something
other than backups, I now want to do full backups directly across the
network, using the UNC path as for diff and log. My problem is that this is
dog slow (no insult to dogs, most of which run much faster than I,
intended). I am getting about 7 MB/s, which means the full backup is about
10 hours! Considering that the performance from copy (17 MB/s) is hardly
exemplary, I find SQL Server performance pretty embarassing.
The only useful tip I found on the net was to backup to multiple devices.
When I do this, my network throughput actually *drops* to about 6.5 MB/s
(for 2, 3 or 4 devices). The same tip suggested that multiple devices might
not help if max worker threads is not bumped up. I have not had a chance to
restart SQL Server (this is a 24x7 public database), but we typically have
100-120 connections, so I am not sure that bumping this up will do anything,
anyway.
Does anyone have experience with network backups and is getting better
throughput? I have considered forcing opportunistic locking in the
redirector, but this seems like blind hope.
Do I need to use something with a clue about networks, like the Veritas SQL
Agent? We use Veritas to spin our tapes, but we abandoned SQL Agent 2 years
ago when we could not get it to work.
Help with backing up directly over the network would be much appreciated.
Comments from SQL Agent users are also welcome.
TIA
--
Scott NicholHi Scott
Have you looked at SQL Litespeed? It's all about optimising backup
performance.
http://www.imceda.com/LiteSpeed_Description.htm
Regards,
Greg Linwood
SQL Server MVP
"Scott Nichol" <reply_to_newsgroup@.scottnichol.com> wrote in message
news:u%23NuPnBaEHA.3596@.tk2msftngp13.phx.gbl...
> I am hoping someone with experience can help me with this.
> I have been doing differential and log backups across a network to a
device
> specified by a UNC path for some time. The backup sizes have been small
> enough that performance was no issue. Full backups, which total about 250
> GB, I have been doing to a RAID set on the local machine, then doing a
copy
> (literally the command line copy from a batch script) to the same UNC path
> as the diff and logs. The backup itself takes about 2.5 hours, and the
copy
> another 4 hours. The network is dedicated gigabit. The target machine
uses
> RAID 10 and can do local I/O at >= 60 MB/s. The network can definitely
> sustain 30 MB/s with an app that has a clue about the network. xcopy can
> sometimes hit that pace, but it and copy more typically do 17 MB/s.
> Because I want to use the disk space on the SQL Server box for something
> other than backups, I now want to do full backups directly across the
> network, using the UNC path as for diff and log. My problem is that this
is
> dog slow (no insult to dogs, most of which run much faster than I,
> intended). I am getting about 7 MB/s, which means the full backup is
about
> 10 hours! Considering that the performance from copy (17 MB/s) is hardly
> exemplary, I find SQL Server performance pretty embarassing.
> The only useful tip I found on the net was to backup to multiple devices.
> When I do this, my network throughput actually *drops* to about 6.5 MB/s
> (for 2, 3 or 4 devices). The same tip suggested that multiple devices
might
> not help if max worker threads is not bumped up. I have not had a chance
to
> restart SQL Server (this is a 24x7 public database), but we typically have
> 100-120 connections, so I am not sure that bumping this up will do
anything,
> anyway.
> Does anyone have experience with network backups and is getting better
> throughput? I have considered forcing opportunistic locking in the
> redirector, but this seems like blind hope.
> Do I need to use something with a clue about networks, like the Veritas
SQL
> Agent? We use Veritas to spin our tapes, but we abandoned SQL Agent 2
years
> ago when we could not get it to work.
> Help with backing up directly over the network would be much appreciated.
> Comments from SQL Agent users are also welcome.
> TIA
> --
> Scott Nichol
>

Performance of backup across network

I am hoping someone with experience can help me with this.
I have been doing differential and log backups across a network to a device
specified by a UNC path for some time. The backup sizes have been small
enough that performance was no issue. Full backups, which total about 250
GB, I have been doing to a RAID set on the local machine, then doing a copy
(literally the command line copy from a batch script) to the same UNC path
as the diff and logs. The backup itself takes about 2.5 hours, and the copy
another 4 hours. The network is dedicated gigabit. The target machine uses
RAID 10 and can do local I/O at >= 60 MB/s. The network can definitely
sustain 30 MB/s with an app that has a clue about the network. xcopy can
sometimes hit that pace, but it and copy more typically do 17 MB/s.
Because I want to use the disk space on the SQL Server box for something
other than backups, I now want to do full backups directly across the
network, using the UNC path as for diff and log. My problem is that this is
dog slow (no insult to dogs, most of which run much faster than I,
intended). I am getting about 7 MB/s, which means the full backup is about
10 hours! Considering that the performance from copy (17 MB/s) is hardly
exemplary, I find SQL Server performance pretty embarassing.
The only useful tip I found on the net was to backup to multiple devices.
When I do this, my network throughput actually *drops* to about 6.5 MB/s
(for 2, 3 or 4 devices). The same tip suggested that multiple devices might
not help if max worker threads is not bumped up. I have not had a chance to
restart SQL Server (this is a 24x7 public database), but we typically have
100-120 connections, so I am not sure that bumping this up will do anything,
anyway.
Does anyone have experience with network backups and is getting better
throughput? I have considered forcing opportunistic locking in the
redirector, but this seems like blind hope.
Do I need to use something with a clue about networks, like the Veritas SQL
Agent? We use Veritas to spin our tapes, but we abandoned SQL Agent 2 years
ago when we could not get it to work.
Help with backing up directly over the network would be much appreciated.
Comments from SQL Agent users are also welcome.
TIA
Scott Nichol
Hi Scott
Have you looked at SQL Litespeed? It's all about optimising backup
performance.
http://www.imceda.com/LiteSpeed_Description.htm
Regards,
Greg Linwood
SQL Server MVP
"Scott Nichol" <reply_to_newsgroup@.scottnichol.com> wrote in message
news:u%23NuPnBaEHA.3596@.tk2msftngp13.phx.gbl...
> I am hoping someone with experience can help me with this.
> I have been doing differential and log backups across a network to a
device
> specified by a UNC path for some time. The backup sizes have been small
> enough that performance was no issue. Full backups, which total about 250
> GB, I have been doing to a RAID set on the local machine, then doing a
copy
> (literally the command line copy from a batch script) to the same UNC path
> as the diff and logs. The backup itself takes about 2.5 hours, and the
copy
> another 4 hours. The network is dedicated gigabit. The target machine
uses
> RAID 10 and can do local I/O at >= 60 MB/s. The network can definitely
> sustain 30 MB/s with an app that has a clue about the network. xcopy can
> sometimes hit that pace, but it and copy more typically do 17 MB/s.
> Because I want to use the disk space on the SQL Server box for something
> other than backups, I now want to do full backups directly across the
> network, using the UNC path as for diff and log. My problem is that this
is
> dog slow (no insult to dogs, most of which run much faster than I,
> intended). I am getting about 7 MB/s, which means the full backup is
about
> 10 hours! Considering that the performance from copy (17 MB/s) is hardly
> exemplary, I find SQL Server performance pretty embarassing.
> The only useful tip I found on the net was to backup to multiple devices.
> When I do this, my network throughput actually *drops* to about 6.5 MB/s
> (for 2, 3 or 4 devices). The same tip suggested that multiple devices
might
> not help if max worker threads is not bumped up. I have not had a chance
to
> restart SQL Server (this is a 24x7 public database), but we typically have
> 100-120 connections, so I am not sure that bumping this up will do
anything,
> anyway.
> Does anyone have experience with network backups and is getting better
> throughput? I have considered forcing opportunistic locking in the
> redirector, but this seems like blind hope.
> Do I need to use something with a clue about networks, like the Veritas
SQL
> Agent? We use Veritas to spin our tapes, but we abandoned SQL Agent 2
years
> ago when we could not get it to work.
> Help with backing up directly over the network would be much appreciated.
> Comments from SQL Agent users are also welcome.
> TIA
> --
> Scott Nichol
>

Performance of backup across network

I am hoping someone with experience can help me with this.
I have been doing differential and log backups across a network to a device
specified by a UNC path for some time. The backup sizes have been small
enough that performance was no issue. Full backups, which total about 250
GB, I have been doing to a RAID set on the local machine, then doing a copy
(literally the command line copy from a batch script) to the same UNC path
as the diff and logs. The backup itself takes about 2.5 hours, and the copy
another 4 hours. The network is dedicated gigabit. The target machine uses
RAID 10 and can do local I/O at >= 60 MB/s. The network can definitely
sustain 30 MB/s with an app that has a clue about the network. xcopy can
sometimes hit that pace, but it and copy more typically do 17 MB/s.
Because I want to use the disk space on the SQL Server box for something
other than backups, I now want to do full backups directly across the
network, using the UNC path as for diff and log. My problem is that this is
dog slow (no insult to dogs, most of which run much faster than I,
intended). I am getting about 7 MB/s, which means the full backup is about
10 hours! Considering that the performance from copy (17 MB/s) is hardly
exemplary, I find SQL Server performance pretty embarassing.
The only useful tip I found on the net was to backup to multiple devices.
When I do this, my network throughput actually *drops* to about 6.5 MB/s
(for 2, 3 or 4 devices). The same tip suggested that multiple devices might
not help if max worker threads is not bumped up. I have not had a chance to
restart SQL Server (this is a 24x7 public database), but we typically have
100-120 connections, so I am not sure that bumping this up will do anything,
anyway.
Does anyone have experience with network backups and is getting better
throughput? I have considered forcing opportunistic locking in the
redirector, but this seems like blind hope.
Do I need to use something with a clue about networks, like the Veritas SQL
Agent? We use Veritas to spin our tapes, but we abandoned SQL Agent 2 years
ago when we could not get it to work.
Help with backing up directly over the network would be much appreciated.
Comments from SQL Agent users are also welcome.
TIA
--
Scott NicholHi Scott
Have you looked at SQL Litespeed? It's all about optimising backup
performance.
http://www.imceda.com/LiteSpeed_Description.htm
Regards,
Greg Linwood
SQL Server MVP
"Scott Nichol" <reply_to_newsgroup@.scottnichol.com> wrote in message
news:u%23NuPnBaEHA.3596@.tk2msftngp13.phx.gbl...
> I am hoping someone with experience can help me with this.
> I have been doing differential and log backups across a network to a
device
> specified by a UNC path for some time. The backup sizes have been small
> enough that performance was no issue. Full backups, which total about 250
> GB, I have been doing to a RAID set on the local machine, then doing a
copy
> (literally the command line copy from a batch script) to the same UNC path
> as the diff and logs. The backup itself takes about 2.5 hours, and the
copy
> another 4 hours. The network is dedicated gigabit. The target machine
uses
> RAID 10 and can do local I/O at >= 60 MB/s. The network can definitely
> sustain 30 MB/s with an app that has a clue about the network. xcopy can
> sometimes hit that pace, but it and copy more typically do 17 MB/s.
> Because I want to use the disk space on the SQL Server box for something
> other than backups, I now want to do full backups directly across the
> network, using the UNC path as for diff and log. My problem is that this
is
> dog slow (no insult to dogs, most of which run much faster than I,
> intended). I am getting about 7 MB/s, which means the full backup is
about
> 10 hours! Considering that the performance from copy (17 MB/s) is hardly
> exemplary, I find SQL Server performance pretty embarassing.
> The only useful tip I found on the net was to backup to multiple devices.
> When I do this, my network throughput actually *drops* to about 6.5 MB/s
> (for 2, 3 or 4 devices). The same tip suggested that multiple devices
might
> not help if max worker threads is not bumped up. I have not had a chance
to
> restart SQL Server (this is a 24x7 public database), but we typically have
> 100-120 connections, so I am not sure that bumping this up will do
anything,
> anyway.
> Does anyone have experience with network backups and is getting better
> throughput? I have considered forcing opportunistic locking in the
> redirector, but this seems like blind hope.
> Do I need to use something with a clue about networks, like the Veritas
SQL
> Agent? We use Veritas to spin our tapes, but we abandoned SQL Agent 2
years
> ago when we could not get it to work.
> Help with backing up directly over the network would be much appreciated.
> Comments from SQL Agent users are also welcome.
> TIA
> --
> Scott Nichol
>

Saturday, February 25, 2012

Performance Monitors on 64bit OS

I am using a 3rd party tool to bind to the perf monitors, with no success. In
the event log:
Windows cannot open the 32-bit extensible counter DLL MSSQLSERVER in a
64-bit environment.
Contact the file vendor to obtain a 64-bit version.
Alternatively, you can open the 32-bit extensible counter DLL by using the
32-bit version
of Performance Monitor. To use this tool, open the Windows folder, open the
Syswow64 folder,
and then start Perfmon.exe.
I followed and can see the monitors on the local machine using the 64bit
perfmon. (they do not show on the stat > run > perfmon
The question: Any ideas how to force the 64bit monitors to present
themselves rather then the 32bit - which do not have the sql perf monitirs.
Heeeelp.
ThanksOK - I have got myself mixed up.
I need the 32bit (Syswow64) perfmon to respond to the 3rd party software
rather than the 64bit.
Cheers
"Mike Duncan" wrote:
> I am using a 3rd party tool to bind to the perf monitors, with no success. In
> the event log:
> Windows cannot open the 32-bit extensible counter DLL MSSQLSERVER in a
> 64-bit environment.
> Contact the file vendor to obtain a 64-bit version.
> Alternatively, you can open the 32-bit extensible counter DLL by using the
> 32-bit version
> of Performance Monitor. To use this tool, open the Windows folder, open the
> Syswow64 folder,
> and then start Perfmon.exe.
> I followed and can see the monitors on the local machine using the 64bit
> perfmon. (they do not show on the stat > run > perfmon
> The question: Any ideas how to force the 64bit monitors to present
> themselves rather then the 32bit - which do not have the sql perf monitirs.
> Heeeelp.
> Thanks|||I have been searching the network and I have found nothing to answer
this question. I am having the same problem. Does anybody have an
idea?
ej
Mike Duncan wrote:
> I am using a 3rd party tool to bind to the perf monitors, with no success. In
> the event log:
> Windows cannot open the 32-bit extensible counter DLL MSSQLSERVER in a
> 64-bit environment.
> Contact the file vendor to obtain a 64-bit version.
> Alternatively, you can open the 32-bit extensible counter DLL by using the
> 32-bit version
> of Performance Monitor. To use this tool, open the Windows folder, open the
> Syswow64 folder,
> and then start Perfmon.exe.
> I followed and can see the monitors on the local machine using the 64bit
> perfmon. (they do not show on the stat > run > perfmon
> The question: Any ideas how to force the 64bit monitors to present
> themselves rather then the 32bit - which do not have the sql perf monitirs.
> Heeeelp.
> Thanks

Performance monitoring

Hi,
I'm using the counter log of Win 2003 to record the server activity (ex : %
processor time). This activity is stored in an SQL Server 2000 SP3a database
(named Performances). All data are stored in the table CounterData.
I tried to set a trigger on this table to copy inserted data to another
table (TB_LastCounters). This trigger does not work when data are
automatically inserted from the Win 2003 counter log. But, the trigger works
well when the data is inserted manually.
Could you explain me this behavior?
Here is a simplified example of my trigger :
CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
FOR INSERT
AS
BEGIN
INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
VALUES (1, 'toto', 2)
END
Thanks a lot,
Eric.We need to see the real trigger and preferably an error message from SQL Server if you have such. My
guess is that the trigger doesn't handle multi-row modifications.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"itparis" <itparis@.discussions.microsoft.com> wrote in message
news:67B984F3-DB2A-4F79-ABBC-67338F57F873@.microsoft.com...
> Hi,
> I'm using the counter log of Win 2003 to record the server activity (ex : %
> processor time). This activity is stored in an SQL Server 2000 SP3a database
> (named Performances). All data are stored in the table CounterData.
> I tried to set a trigger on this table to copy inserted data to another
> table (TB_LastCounters). This trigger does not work when data are
> automatically inserted from the Win 2003 counter log. But, the trigger works
> well when the data is inserted manually.
> Could you explain me this behavior?
> Here is a simplified example of my trigger :
> CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> FOR INSERT
> AS
> BEGIN
> INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> VALUES (1, 'toto', 2)
> END
> Thanks a lot,
> Eric.|||Hi
You need to select from the Virtaul table called "Inserted" to get the rows
that were inserted by the statement.
CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
FOR INSERT
AS
BEGIN
INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
SELECT INSERTED.CounterID, INSERTED.CounterDateTime, INSERTED.CounterValue
FROM INSERTED
END
--
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"itparis" wrote:
> Hi,
> I'm using the counter log of Win 2003 to record the server activity (ex : %
> processor time). This activity is stored in an SQL Server 2000 SP3a database
> (named Performances). All data are stored in the table CounterData.
> I tried to set a trigger on this table to copy inserted data to another
> table (TB_LastCounters). This trigger does not work when data are
> automatically inserted from the Win 2003 counter log. But, the trigger works
> well when the data is inserted manually.
> Could you explain me this behavior?
> Here is a simplified example of my trigger :
> CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> FOR INSERT
> AS
> BEGIN
> INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> VALUES (1, 'toto', 2)
> END
> Thanks a lot,
> Eric.|||Thank you for your responses.
When Win 2003 counter log fills the CounterData table, the trigger does not
work but there are no errors.
Here is my real trigger :
CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
FOR INSERT
AS
BEGIN
INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
SELECT CounterID, LEFT(CounterDateTime,4) + SUBSTRING(CounterDateTime,6,2) +
SUBSTRING(CounterDateTime,9,2) + SUBSTRING(CounterDateTime,12,2) +
SUBSTRING(CounterDateTime,15,2) + SUBSTRING(CounterDateTime,18,2) As
CounterDate, CounterValue FROM INSERTED
END
This trigger works when I manually add data to CounterData table but does
not work when it is Win2003 counter log.
Thank you,
Eric.
"Mike Epprecht (SQL MVP)" a écrit :
> Hi
> You need to select from the Virtaul table called "Inserted" to get the rows
> that were inserted by the statement.
> CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> FOR INSERT
> AS
> BEGIN
> INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> SELECT INSERTED.CounterID, INSERTED.CounterDateTime, INSERTED.CounterValue
> FROM INSERTED
> END
> --
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
>
> "itparis" wrote:
> > Hi,
> >
> > I'm using the counter log of Win 2003 to record the server activity (ex : %
> > processor time). This activity is stored in an SQL Server 2000 SP3a database
> > (named Performances). All data are stored in the table CounterData.
> >
> > I tried to set a trigger on this table to copy inserted data to another
> > table (TB_LastCounters). This trigger does not work when data are
> > automatically inserted from the Win 2003 counter log. But, the trigger works
> > well when the data is inserted manually.
> >
> > Could you explain me this behavior?
> >
> > Here is a simplified example of my trigger :
> >
> > CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> > FOR INSERT
> > AS
> > BEGIN
> > INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> > VALUES (1, 'toto', 2)
> > END
> >
> > Thanks a lot,
> >
> > Eric.|||Hi
If it does not work, then the odds are good that it is failing, and rolling
back the transaction too.
CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
FOR INSERT
AS
BEGIN
INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
SELECT CounterID, LEFT(CounterDateTime,4) + SUBSTRING(CounterDateTime,6,2) +
SUBSTRING(CounterDateTime,9,2) + SUBSTRING(CounterDateTime,12,2) +
SUBSTRING(CounterDateTime,15,2) + SUBSTRING(CounterDateTime,18,2) As
CounterDate, CounterValue FROM INSERTED
IF @.@.ERROR <> 0
PRINT 'Error Occurred'
END
END
Do an insert manually and see what happens.
--
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"itparis" wrote:
> Thank you for your responses.
> When Win 2003 counter log fills the CounterData table, the trigger does not
> work but there are no errors.
> Here is my real trigger :
> CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> FOR INSERT
> AS
> BEGIN
> INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> SELECT CounterID, LEFT(CounterDateTime,4) + SUBSTRING(CounterDateTime,6,2) +
> SUBSTRING(CounterDateTime,9,2) + SUBSTRING(CounterDateTime,12,2) +
> SUBSTRING(CounterDateTime,15,2) + SUBSTRING(CounterDateTime,18,2) As
> CounterDate, CounterValue FROM INSERTED
> END
> This trigger works when I manually add data to CounterData table but does
> not work when it is Win2003 counter log.
> Thank you,
> Eric.
> "Mike Epprecht (SQL MVP)" a écrit :
> > Hi
> >
> > You need to select from the Virtaul table called "Inserted" to get the rows
> > that were inserted by the statement.
> >
> > CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> > FOR INSERT
> > AS
> > BEGIN
> > INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> > SELECT INSERTED.CounterID, INSERTED.CounterDateTime, INSERTED.CounterValue
> > FROM INSERTED
> > END
> >
> > --
> > --
> > Mike Epprecht, Microsoft SQL Server MVP
> > Zurich, Switzerland
> >
> > MVP Program: http://www.microsoft.com/mvp
> >
> > Blog: http://www.msmvps.com/epprecht/
> >
> >
> >
> > "itparis" wrote:
> >
> > > Hi,
> > >
> > > I'm using the counter log of Win 2003 to record the server activity (ex : %
> > > processor time). This activity is stored in an SQL Server 2000 SP3a database
> > > (named Performances). All data are stored in the table CounterData.
> > >
> > > I tried to set a trigger on this table to copy inserted data to another
> > > table (TB_LastCounters). This trigger does not work when data are
> > > automatically inserted from the Win 2003 counter log. But, the trigger works
> > > well when the data is inserted manually.
> > >
> > > Could you explain me this behavior?
> > >
> > > Here is a simplified example of my trigger :
> > >
> > > CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> > > FOR INSERT
> > > AS
> > > BEGIN
> > > INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> > > VALUES (1, 'toto', 2)
> > > END
> > >
> > > Thanks a lot,
> > >
> > > Eric.|||Hi Mike,
I've written your trigger. I made your test but I don't know where I can see
the result of PRINT 'Error occured'. Can you tell me where I could see it?
Thanks,
Eric.
"Mike Epprecht (SQL MVP)" a écrit :
> Hi
> If it does not work, then the odds are good that it is failing, and rolling
> back the transaction too.
> CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> FOR INSERT
> AS
> BEGIN
> INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> SELECT CounterID, LEFT(CounterDateTime,4) + SUBSTRING(CounterDateTime,6,2) +
> SUBSTRING(CounterDateTime,9,2) + SUBSTRING(CounterDateTime,12,2) +
> SUBSTRING(CounterDateTime,15,2) + SUBSTRING(CounterDateTime,18,2) As
> CounterDate, CounterValue FROM INSERTED
> IF @.@.ERROR <> 0
> PRINT 'Error Occurred'
> END
> END
> Do an insert manually and see what happens.
> --
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
>
> "itparis" wrote:
> > Thank you for your responses.
> >
> > When Win 2003 counter log fills the CounterData table, the trigger does not
> > work but there are no errors.
> > Here is my real trigger :
> >
> > CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> > FOR INSERT
> > AS
> > BEGIN
> > INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> > SELECT CounterID, LEFT(CounterDateTime,4) + SUBSTRING(CounterDateTime,6,2) +
> > SUBSTRING(CounterDateTime,9,2) + SUBSTRING(CounterDateTime,12,2) +
> > SUBSTRING(CounterDateTime,15,2) + SUBSTRING(CounterDateTime,18,2) As
> > CounterDate, CounterValue FROM INSERTED
> > END
> >
> > This trigger works when I manually add data to CounterData table but does
> > not work when it is Win2003 counter log.
> >
> > Thank you,
> >
> > Eric.
> >
> > "Mike Epprecht (SQL MVP)" a écrit :
> >
> > > Hi
> > >
> > > You need to select from the Virtaul table called "Inserted" to get the rows
> > > that were inserted by the statement.
> > >
> > > CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> > > FOR INSERT
> > > AS
> > > BEGIN
> > > INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> > > SELECT INSERTED.CounterID, INSERTED.CounterDateTime, INSERTED.CounterValue
> > > FROM INSERTED
> > > END
> > >
> > > --
> > > --
> > > Mike Epprecht, Microsoft SQL Server MVP
> > > Zurich, Switzerland
> > >
> > > MVP Program: http://www.microsoft.com/mvp
> > >
> > > Blog: http://www.msmvps.com/epprecht/
> > >
> > >
> > >
> > > "itparis" wrote:
> > >
> > > > Hi,
> > > >
> > > > I'm using the counter log of Win 2003 to record the server activity (ex : %
> > > > processor time). This activity is stored in an SQL Server 2000 SP3a database
> > > > (named Performances). All data are stored in the table CounterData.
> > > >
> > > > I tried to set a trigger on this table to copy inserted data to another
> > > > table (TB_LastCounters). This trigger does not work when data are
> > > > automatically inserted from the Win 2003 counter log. But, the trigger works
> > > > well when the data is inserted manually.
> > > >
> > > > Could you explain me this behavior?
> > > >
> > > > Here is a simplified example of my trigger :
> > > >
> > > > CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> > > > FOR INSERT
> > > > AS
> > > > BEGIN
> > > > INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> > > > VALUES (1, 'toto', 2)
> > > > END
> > > >
> > > > Thanks a lot,
> > > >
> > > > Eric.|||How does perfmon insert the data? Run a profiler trace to see whether perfmon does regular INSERTs
or uses some form of bulk loading API. Of the later, these API's can bypass triggers.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"itparis" <itparis@.discussions.microsoft.com> wrote in message
news:81DAD60B-7D64-45AB-965E-31C58426AA6C@.microsoft.com...
> Hi Mike,
> I've written your trigger. I made your test but I don't know where I can see
> the result of PRINT 'Error occured'. Can you tell me where I could see it?
> Thanks,
> Eric.
> "Mike Epprecht (SQL MVP)" a écrit :
>> Hi
>> If it does not work, then the odds are good that it is failing, and rolling
>> back the transaction too.
>> CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
>> FOR INSERT
>> AS
>> BEGIN
>> INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
>> SELECT CounterID, LEFT(CounterDateTime,4) + SUBSTRING(CounterDateTime,6,2) +
>> SUBSTRING(CounterDateTime,9,2) + SUBSTRING(CounterDateTime,12,2) +
>> SUBSTRING(CounterDateTime,15,2) + SUBSTRING(CounterDateTime,18,2) As
>> CounterDate, CounterValue FROM INSERTED
>> IF @.@.ERROR <> 0
>> PRINT 'Error Occurred'
>> END
>> END
>> Do an insert manually and see what happens.
>> --
>> --
>> Mike Epprecht, Microsoft SQL Server MVP
>> Zurich, Switzerland
>> MVP Program: http://www.microsoft.com/mvp
>> Blog: http://www.msmvps.com/epprecht/
>>
>> "itparis" wrote:
>> > Thank you for your responses.
>> >
>> > When Win 2003 counter log fills the CounterData table, the trigger does not
>> > work but there are no errors.
>> > Here is my real trigger :
>> >
>> > CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
>> > FOR INSERT
>> > AS
>> > BEGIN
>> > INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
>> > SELECT CounterID, LEFT(CounterDateTime,4) + SUBSTRING(CounterDateTime,6,2) +
>> > SUBSTRING(CounterDateTime,9,2) + SUBSTRING(CounterDateTime,12,2) +
>> > SUBSTRING(CounterDateTime,15,2) + SUBSTRING(CounterDateTime,18,2) As
>> > CounterDate, CounterValue FROM INSERTED
>> > END
>> >
>> > This trigger works when I manually add data to CounterData table but does
>> > not work when it is Win2003 counter log.
>> >
>> > Thank you,
>> >
>> > Eric.
>> >
>> > "Mike Epprecht (SQL MVP)" a écrit :
>> >
>> > > Hi
>> > >
>> > > You need to select from the Virtaul table called "Inserted" to get the rows
>> > > that were inserted by the statement.
>> > >
>> > > CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
>> > > FOR INSERT
>> > > AS
>> > > BEGIN
>> > > INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
>> > > SELECT INSERTED.CounterID, INSERTED.CounterDateTime, INSERTED.CounterValue
>> > > FROM INSERTED
>> > > END
>> > >
>> > > --
>> > > --
>> > > Mike Epprecht, Microsoft SQL Server MVP
>> > > Zurich, Switzerland
>> > >
>> > > MVP Program: http://www.microsoft.com/mvp
>> > >
>> > > Blog: http://www.msmvps.com/epprecht/
>> > >
>> > >
>> > >
>> > > "itparis" wrote:
>> > >
>> > > > Hi,
>> > > >
>> > > > I'm using the counter log of Win 2003 to record the server activity (ex : %
>> > > > processor time). This activity is stored in an SQL Server 2000 SP3a database
>> > > > (named Performances). All data are stored in the table CounterData.
>> > > >
>> > > > I tried to set a trigger on this table to copy inserted data to another
>> > > > table (TB_LastCounters). This trigger does not work when data are
>> > > > automatically inserted from the Win 2003 counter log. But, the trigger works
>> > > > well when the data is inserted manually.
>> > > >
>> > > > Could you explain me this behavior?
>> > > >
>> > > > Here is a simplified example of my trigger :
>> > > >
>> > > > CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
>> > > > FOR INSERT
>> > > > AS
>> > > > BEGIN
>> > > > INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
>> > > > VALUES (1, 'toto', 2)
>> > > > END
>> > > >
>> > > > Thanks a lot,
>> > > >
>> > > > Eric.

Monday, February 20, 2012

Performance monitoring

Hi,
I'm using the counter log of Win 2003 to record the server activity (ex : %
processor time). This activity is stored in an SQL Server 2000 SP3a database
(named Performances). All data are stored in the table CounterData.
I tried to set a trigger on this table to copy inserted data to another
table (TB_LastCounters). This trigger does not work when data are
automatically inserted from the Win 2003 counter log. But, the trigger works
well when the data is inserted manually.
Could you explain me this behavior?
Here is a simplified example of my trigger :
CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
FOR INSERT
AS
BEGIN
INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
VALUES (1, 'toto', 2)
END
Thanks a lot,
Eric.
We need to see the real trigger and preferably an error message from SQL Server if you have such. My
guess is that the trigger doesn't handle multi-row modifications.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"itparis" <itparis@.discussions.microsoft.com> wrote in message
news:67B984F3-DB2A-4F79-ABBC-67338F57F873@.microsoft.com...
> Hi,
> I'm using the counter log of Win 2003 to record the server activity (ex : %
> processor time). This activity is stored in an SQL Server 2000 SP3a database
> (named Performances). All data are stored in the table CounterData.
> I tried to set a trigger on this table to copy inserted data to another
> table (TB_LastCounters). This trigger does not work when data are
> automatically inserted from the Win 2003 counter log. But, the trigger works
> well when the data is inserted manually.
> Could you explain me this behavior?
> Here is a simplified example of my trigger :
> CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> FOR INSERT
> AS
> BEGIN
> INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> VALUES (1, 'toto', 2)
> END
> Thanks a lot,
> Eric.
|||Hi
You need to select from the Virtaul table called "Inserted" to get the rows
that were inserted by the statement.
CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
FOR INSERT
AS
BEGIN
INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
SELECT INSERTED.CounterID, INSERTED.CounterDateTime, INSERTED.CounterValue
FROM INSERTED
END
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"itparis" wrote:

> Hi,
> I'm using the counter log of Win 2003 to record the server activity (ex : %
> processor time). This activity is stored in an SQL Server 2000 SP3a database
> (named Performances). All data are stored in the table CounterData.
> I tried to set a trigger on this table to copy inserted data to another
> table (TB_LastCounters). This trigger does not work when data are
> automatically inserted from the Win 2003 counter log. But, the trigger works
> well when the data is inserted manually.
> Could you explain me this behavior?
> Here is a simplified example of my trigger :
> CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> FOR INSERT
> AS
> BEGIN
> INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> VALUES (1, 'toto', 2)
> END
> Thanks a lot,
> Eric.
|||Thank you for your responses.
When Win 2003 counter log fills the CounterData table, the trigger does not
work but there are no errors.
Here is my real trigger :
CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
FOR INSERT
AS
BEGIN
INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
SELECT CounterID, LEFT(CounterDateTime,4) + SUBSTRING(CounterDateTime,6,2) +
SUBSTRING(CounterDateTime,9,2) + SUBSTRING(CounterDateTime,12,2) +
SUBSTRING(CounterDateTime,15,2) + SUBSTRING(CounterDateTime,18,2) As
CounterDate, CounterValue FROM INSERTED
END
This trigger works when I manually add data to CounterData table but does
not work when it is Win2003 counter log.
Thank you,
Eric.
"Mike Epprecht (SQL MVP)" a écrit :
[vbcol=seagreen]
> Hi
> You need to select from the Virtaul table called "Inserted" to get the rows
> that were inserted by the statement.
> CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> FOR INSERT
> AS
> BEGIN
> INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> SELECT INSERTED.CounterID, INSERTED.CounterDateTime, INSERTED.CounterValue
> FROM INSERTED
> END
> --
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
>
> "itparis" wrote:
|||Hi
If it does not work, then the odds are good that it is failing, and rolling
back the transaction too.
CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
FOR INSERT
AS
BEGIN
INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
SELECT CounterID, LEFT(CounterDateTime,4) + SUBSTRING(CounterDateTime,6,2) +
SUBSTRING(CounterDateTime,9,2) + SUBSTRING(CounterDateTime,12,2) +
SUBSTRING(CounterDateTime,15,2) + SUBSTRING(CounterDateTime,18,2) As
CounterDate, CounterValue FROM INSERTED
IF @.@.ERROR <> 0
PRINT 'Error Occurred'
END
END
Do an insert manually and see what happens.
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"itparis" wrote:
[vbcol=seagreen]
> Thank you for your responses.
> When Win 2003 counter log fills the CounterData table, the trigger does not
> work but there are no errors.
> Here is my real trigger :
> CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> FOR INSERT
> AS
> BEGIN
> INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> SELECT CounterID, LEFT(CounterDateTime,4) + SUBSTRING(CounterDateTime,6,2) +
> SUBSTRING(CounterDateTime,9,2) + SUBSTRING(CounterDateTime,12,2) +
> SUBSTRING(CounterDateTime,15,2) + SUBSTRING(CounterDateTime,18,2) As
> CounterDate, CounterValue FROM INSERTED
> END
> This trigger works when I manually add data to CounterData table but does
> not work when it is Win2003 counter log.
> Thank you,
> Eric.
> "Mike Epprecht (SQL MVP)" a écrit :
|||Hi Mike,
I've written your trigger. I made your test but I don't know where I can see
the result of PRINT 'Error occured'. Can you tell me where I could see it?
Thanks,
Eric.
"Mike Epprecht (SQL MVP)" a écrit :
[vbcol=seagreen]
> Hi
> If it does not work, then the odds are good that it is failing, and rolling
> back the transaction too.
> CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> FOR INSERT
> AS
> BEGIN
> INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> SELECT CounterID, LEFT(CounterDateTime,4) + SUBSTRING(CounterDateTime,6,2) +
> SUBSTRING(CounterDateTime,9,2) + SUBSTRING(CounterDateTime,12,2) +
> SUBSTRING(CounterDateTime,15,2) + SUBSTRING(CounterDateTime,18,2) As
> CounterDate, CounterValue FROM INSERTED
> IF @.@.ERROR <> 0
> PRINT 'Error Occurred'
> END
> END
> Do an insert manually and see what happens.
> --
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
>
> "itparis" wrote:
|||How does perfmon insert the data? Run a profiler trace to see whether perfmon does regular INSERTs
or uses some form of bulk loading API. Of the later, these API's can bypass triggers.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"itparis" <itparis@.discussions.microsoft.com> wrote in message
news:81DAD60B-7D64-45AB-965E-31C58426AA6C@.microsoft.com...[vbcol=seagreen]
> Hi Mike,
> I've written your trigger. I made your test but I don't know where I can see
> the result of PRINT 'Error occured'. Can you tell me where I could see it?
> Thanks,
> Eric.
> "Mike Epprecht (SQL MVP)" a écrit :

Performance monitoring

Hi,
I'm using the counter log of Win 2003 to record the server activity (ex : %
processor time). This activity is stored in an SQL Server 2000 SP3a database
(named Performances). All data are stored in the table CounterData.
I tried to set a trigger on this table to copy inserted data to another
table (TB_LastCounters). This trigger does not work when data are
automatically inserted from the Win 2003 counter log. But, the trigger works
well when the data is inserted manually.
Could you explain me this behavior?
Here is a simplified example of my trigger :
CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
FOR INSERT
AS
BEGIN
INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
VALUES (1, 'toto', 2)
END
Thanks a lot,
Eric.We need to see the real trigger and preferably an error message from SQL Ser
ver if you have such. My
guess is that the trigger doesn't handle multi-row modifications.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"itparis" <itparis@.discussions.microsoft.com> wrote in message
news:67B984F3-DB2A-4F79-ABBC-67338F57F873@.microsoft.com...
> Hi,
> I'm using the counter log of Win 2003 to record the server activity (ex :
%
> processor time). This activity is stored in an SQL Server 2000 SP3a databa
se
> (named Performances). All data are stored in the table CounterData.
> I tried to set a trigger on this table to copy inserted data to another
> table (TB_LastCounters). This trigger does not work when data are
> automatically inserted from the Win 2003 counter log. But, the trigger wor
ks
> well when the data is inserted manually.
> Could you explain me this behavior?
> Here is a simplified example of my trigger :
> CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> FOR INSERT
> AS
> BEGIN
> INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> VALUES (1, 'toto', 2)
> END
> Thanks a lot,
> Eric.|||Hi
You need to select from the Virtaul table called "Inserted" to get the rows
that were inserted by the statement.
CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
FOR INSERT
AS
BEGIN
INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
SELECT INSERTED.CounterID, INSERTED.CounterDateTime, INSERTED.CounterValue
FROM INSERTED
END
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"itparis" wrote:

> Hi,
> I'm using the counter log of Win 2003 to record the server activity (ex :
%
> processor time). This activity is stored in an SQL Server 2000 SP3a databa
se
> (named Performances). All data are stored in the table CounterData.
> I tried to set a trigger on this table to copy inserted data to another
> table (TB_LastCounters). This trigger does not work when data are
> automatically inserted from the Win 2003 counter log. But, the trigger wor
ks
> well when the data is inserted manually.
> Could you explain me this behavior?
> Here is a simplified example of my trigger :
> CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> FOR INSERT
> AS
> BEGIN
> INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> VALUES (1, 'toto', 2)
> END
> Thanks a lot,
> Eric.|||Thank you for your responses.
When Win 2003 counter log fills the CounterData table, the trigger does not
work but there are no errors.
Here is my real trigger :
CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
FOR INSERT
AS
BEGIN
INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
SELECT CounterID, LEFT(CounterDateTime,4) + SUBSTRING(CounterDateTime,6,2)
+
SUBSTRING(CounterDateTime,9,2) + SUBSTRING(CounterDateTime,12,2) +
SUBSTRING(CounterDateTime,15,2) + SUBSTRING(CounterDateTime,18,2) As
CounterDate, CounterValue FROM INSERTED
END
This trigger works when I manually add data to CounterData table but does
not work when it is Win2003 counter log.
Thank you,
Eric.
"Mike Epprecht (SQL MVP)" a écrit :
[vbcol=seagreen]
> Hi
> You need to select from the Virtaul table called "Inserted" to get the row
s
> that were inserted by the statement.
> CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> FOR INSERT
> AS
> BEGIN
> INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> SELECT INSERTED.CounterID, INSERTED.CounterDateTime, INSERTED.CounterValue
> FROM INSERTED
> END
> --
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
>
> "itparis" wrote:
>|||Hi
If it does not work, then the odds are good that it is failing, and rolling
back the transaction too.
CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
FOR INSERT
AS
BEGIN
INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
SELECT CounterID, LEFT(CounterDateTime,4) + SUBSTRING(CounterDateTime,6,2)
+
SUBSTRING(CounterDateTime,9,2) + SUBSTRING(CounterDateTime,12,2) +
SUBSTRING(CounterDateTime,15,2) + SUBSTRING(CounterDateTime,18,2) As
CounterDate, CounterValue FROM INSERTED
IF @.@.ERROR <> 0
PRINT 'Error Occurred'
END
END
Do an insert manually and see what happens.
--
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"itparis" wrote:
[vbcol=seagreen]
> Thank you for your responses.
> When Win 2003 counter log fills the CounterData table, the trigger does no
t
> work but there are no errors.
> Here is my real trigger :
> CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> FOR INSERT
> AS
> BEGIN
> INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> SELECT CounterID, LEFT(CounterDateTime,4) + SUBSTRING(CounterDateTime,6,2)
+
> SUBSTRING(CounterDateTime,9,2) + SUBSTRING(CounterDateTime,12,2) +
> SUBSTRING(CounterDateTime,15,2) + SUBSTRING(CounterDateTime,18,2) As
> CounterDate, CounterValue FROM INSERTED
> END
> This trigger works when I manually add data to CounterData table but does
> not work when it is Win2003 counter log.
> Thank you,
> Eric.
> "Mike Epprecht (SQL MVP)" a écrit :
>|||Hi Mike,
I've written your trigger. I made your test but I don't know where I can see
the result of PRINT 'Error occured'. Can you tell me where I could see it?
Thanks,
Eric.
"Mike Epprecht (SQL MVP)" a écrit :
[vbcol=seagreen]
> Hi
> If it does not work, then the odds are good that it is failing, and rollin
g
> back the transaction too.
> CREATE TRIGGER CopyInsertions ON [dbo].[CounterData]
> FOR INSERT
> AS
> BEGIN
> INSERT INTO TB_LastCounters (CounterID, CounterDateTime, CounterValue)
> SELECT CounterID, LEFT(CounterDateTime,4) + SUBSTRING(CounterDateTime,6,2)
+
> SUBSTRING(CounterDateTime,9,2) + SUBSTRING(CounterDateTime,12,2) +
> SUBSTRING(CounterDateTime,15,2) + SUBSTRING(CounterDateTime,18,2) As
> CounterDate, CounterValue FROM INSERTED
> IF @.@.ERROR <> 0
> PRINT 'Error Occurred'
> END
> END
> Do an insert manually and see what happens.
> --
> --
> Mike Epprecht, Microsoft SQL Server MVP
> Zurich, Switzerland
> MVP Program: http://www.microsoft.com/mvp
> Blog: http://www.msmvps.com/epprecht/
>
> "itparis" wrote:
>|||How does perfmon insert the data? Run a profiler trace to see whether perfmo
n does regular INSERTs
or uses some form of bulk loading API. Of the later, these API's can bypass
triggers.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"itparis" <itparis@.discussions.microsoft.com> wrote in message
news:81DAD60B-7D64-45AB-965E-31C58426AA6C@.microsoft.com...[vbcol=seagreen]
> Hi Mike,
> I've written your trigger. I made your test but I don't know where I can s
ee
> the result of PRINT 'Error occured'. Can you tell me where I could see it?
> Thanks,
> Eric.
> "Mike Epprecht (SQL MVP)" a écrit :
>

Performance monitor stats from table

Is there a way that instead of using performance monitory,
I can query from system tables to get information like
log flush wait time, Disk Read Queue length counter and
all related information.
Thanks.Hi
Those are OS counters, and you need to run the OS Perfmon to capture those.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Data Cruncher" <dcruncher4@.netscape.net> wrote in message
news:1119648499.019039.254950@.g43g2000cwa.googlegroups.com...
> Is there a way that instead of using performance monitory,
> I can query from system tables to get information like
> log flush wait time, Disk Read Queue length counter and
> all related information.
> Thanks.
>

Performance Monitor SQL Counters question

I'm a bit confused, so I hope someone can help.
Under the MSSQL$AAP1:Databases Object are two counters. Data File(s) Size
(KB) and Log File(s) Size (KB). If I understand these correctly, they are to
monitor spikes within the growth of the data & log files. However, when I
run them against my Production Server, they are both consistantly at 100%.
HUH?
The disk drive has more than enough space and both files for my database (I
chose to monitor a single DB, not all of them) are set to AutoGrow. So, why
do the counters register at the top of the charts?
If anyone could explain this for me, I'd greatly appreciate it. Thanks,
Catadmin
MCDBA, MCSA
Random Thoughts: If a person is Microsoft Certified, does that mean that
Microsoft pays the bills for the funny white jackets that tie in the back?
@.=)
Hi
I am not sure you are interpreting the counter correctly, with all
performance monitor counters you need to look at the scale to get the size.
Being 100% of the size all the time would indicate that there has been no
growth during that period.
If you do a period sp_helpfile and store the results into a table you should
be able to monitor store the current size over time.
John
"Catadmin" wrote:

> I'm a bit confused, so I hope someone can help.
> Under the MSSQL$AAP1:Databases Object are two counters. Data File(s) Size
> (KB) and Log File(s) Size (KB). If I understand these correctly, they are to
> monitor spikes within the growth of the data & log files. However, when I
> run them against my Production Server, they are both consistantly at 100%.
> HUH?
> The disk drive has more than enough space and both files for my database (I
> chose to monitor a single DB, not all of them) are set to AutoGrow. So, why
> do the counters register at the top of the charts?
> If anyone could explain this for me, I'd greatly appreciate it. Thanks,
> Catadmin
> --
> MCDBA, MCSA
> Random Thoughts: If a person is Microsoft Certified, does that mean that
> Microsoft pays the bills for the funny white jackets that tie in the back?
> @.=)
|||So how does one know when the files do change in size? Does the percentage
go down? Or is there a number higher than 100 that it shoots up to during a
"growth spurt"?
Thanks,
Catadmin
"John Bell" wrote:
[vbcol=seagreen]
> Hi
> I am not sure you are interpreting the counter correctly, with all
> performance monitor counters you need to look at the scale to get the size.
> Being 100% of the size all the time would indicate that there has been no
> growth during that period.
> If you do a period sp_helpfile and store the results into a table you should
> be able to monitor store the current size over time.
> John
> "Catadmin" wrote:
|||Hi
If open the performance data file in perfmon you will see a step when the
file grows.
John
"Catadmin" wrote:
[vbcol=seagreen]
> So how does one know when the files do change in size? Does the percentage
> go down? Or is there a number higher than 100 that it shoots up to during a
> "growth spurt"?
> Thanks,
> Catadmin
>
> "John Bell" wrote:

Performance Monitor SQL Counters question

I'm a bit confused, so I hope someone can help.
Under the MSSQL$AAP1:Databases Object are two counters. Data File(s) Size
(KB) and Log File(s) Size (KB). If I understand these correctly, they are t
o
monitor spikes within the growth of the data & log files. However, when I
run them against my Production Server, they are both consistantly at 100%.
HUH?
The disk drive has more than enough space and both files for my database (I
chose to monitor a single DB, not all of them) are set to AutoGrow. So, why
do the counters register at the top of the charts?
If anyone could explain this for me, I'd greatly appreciate it. Thanks,
Catadmin
--
MCDBA, MCSA
Random Thoughts: If a person is Microsoft Certified, does that mean that
Microsoft pays the bills for the funny white jackets that tie in the back?
@.=)Hi
I am not sure you are interpreting the counter correctly, with all
performance monitor counters you need to look at the scale to get the size.
Being 100% of the size all the time would indicate that there has been no
growth during that period.
If you do a period sp_helpfile and store the results into a table you should
be able to monitor store the current size over time.
John
"Catadmin" wrote:

> I'm a bit confused, so I hope someone can help.
> Under the MSSQL$AAP1:Databases Object are two counters. Data File(s) Size
> (KB) and Log File(s) Size (KB). If I understand these correctly, they are
to
> monitor spikes within the growth of the data & log files. However, when I
> run them against my Production Server, they are both consistantly at 100%.
> HUH?
> The disk drive has more than enough space and both files for my database (
I
> chose to monitor a single DB, not all of them) are set to AutoGrow. So, w
hy
> do the counters register at the top of the charts?
> If anyone could explain this for me, I'd greatly appreciate it. Thanks,
> Catadmin
> --
> MCDBA, MCSA
> Random Thoughts: If a person is Microsoft Certified, does that mean that
> Microsoft pays the bills for the funny white jackets that tie in the back?
'
> @.=)|||So how does one know when the files do change in size? Does the percentage
go down? Or is there a number higher than 100 that it shoots up to during a
"growth spurt"?
Thanks,
Catadmin
"John Bell" wrote:
[vbcol=seagreen]
> Hi
> I am not sure you are interpreting the counter correctly, with all
> performance monitor counters you need to look at the scale to get the size
.
> Being 100% of the size all the time would indicate that there has been no
> growth during that period.
> If you do a period sp_helpfile and store the results into a table you shou
ld
> be able to monitor store the current size over time.
> John
> "Catadmin" wrote:
>|||Hi
If open the performance data file in perfmon you will see a step when the
file grows.
John
"Catadmin" wrote:
[vbcol=seagreen]
> So how does one know when the files do change in size? Does the percentag
e
> go down? Or is there a number higher than 100 that it shoots up to during
a
> "growth spurt"?
> Thanks,
> Catadmin
>
> "John Bell" wrote:
>

Performance Monitor log files

For the SQL Server running here we have setup a log file that monitors all the activities while the server is running, such as processor percentage being used over the day, CPU percentage taken by SQL Server etc. The problem I'm facing is that the log files (which are in PERFMON format) are recorded over a period of a business day for 30 days. Now I want to get the measurements for all the 30 days combined into one file where i can analyze all the measurement over 30 days.

Thanks in advance.HI

I dont know of any way to combine log files. The best you can do is establish numeric values then manually put these into a spreadsheet if you want a graph.

In future, just run the perfmon monitoring for 30 days......

Hope this helps,

SG