Showing posts with label therei. Show all posts
Showing posts with label therei. Show all posts

Thursday, March 8, 2012

Activated Stored Proc blocking?

Hi There

I was wondering, i have experienced alot of stored procedure blocking where you have a stored procedure that get executed very frequently and is complex, when the sp has to recompile it is locked and cannot be executed by other processes.

How will this work with an activated stored procedure, our activated stored procedure will probably not be too complex but it may exec complex ones base on the message type.

Now lets say that a message is recieved by the activated sp he in turn executes a complex sp to process the message this causes the complex sp to recompile, during this time another activated sp is spawned by the queue with the same message type he execs the same complex sp that is busy recompiling, i presume that the second activated sp will be blocked until the sp has completed recompiling.

Is this correct, because on a very busy queue with very complex sp's being called by the activated stored procedure, the benefit of having multiple queue readers is negated by the blocking caused by the recompiling sp's called by the activated sp.

Basically no matter how many queue readers kick in to handle the messages they all wait for the sp to recompile from the first message.

I am hoping multiple spawned activated stored procedures somehow over come this? Or work differently somehow.

Does anyone know ?

Thanx

The stored proc will be compiled only once. After that, all callers should be able to use the stored proc without blocking other callers.

If you need the stored procs to be modified frequently, that could result in constant recompilation as you have described above. In that case, you could use dynamic SQL and put the frequently changing code as strings in a table.

Hope that helps.

|||

Hi Rushi

Perhaps i need to found out more about sp recompiles, we have a large sp about 1000 lines. It never changes, however it recompiles everytime it executes, not sure why. Thats why i was under the impression that very large complex sp's executed by the activated stored prcedure would blocked the additional spawned queue readers?

What are you r thoughts on this? Is it correct that sp's that have large amounts of dynamic sql will recompile frequently, i cannot put these strings in a table since they are dynamically created with variables passed to the sp.

Thank You

Activated Proc not firing.

Hi There

I just had the following scenario.

I checked sys.service_queues to confirm the my queue has an activated proc assigned to it and is activation_enabled.

I send messages to the service, however i see that the messages just sit in the queue. I run profiler with all SB and Error events there is nothing, i check the sql server log, there is also nothing.

So i have no idea why the activated proc is not firing, all i see in the profiler trace is that the messages are acknowledged but the activated proc does not execute.

For a while i was stumped. i then tried to execute the proc myself and i got a syntax error.

Basically what happened was that i altered a table that the proc used and now the proc cannot execute cos there are more columns that must be inserted so i altered the proc.

However the activated proc still did not fire.

I had to disable and re-enable activation for it to work.

What i am wondering is why was there no indication in profiler or the sql og as the the fact that something was wrong with the activated proc ? Surely the activated proc should have fired and given the same error i got either to the sql log or profiler ?

And why did i have to re-enable activation ? Does sql cache the proc when you activate it and not know that the proc has changed when you alter it ?

Thanx

I had a similar issue...and I am trying to get a resolution on this. In my scenario, it was a new service broker startup (complete rebuild of queues from build scripts that were working in our development database environment)...We have about 30 queues in which all but 1 worked fine. When I went to look to see what happened, the queue was up and activation was on and the messages were sitting in the target queue. When I manually executed the activation stored procedure everything was successful and processed fine (no errors). This is not the first time this has happened, and after it is manually executed the activation seems to occur without issue from that point forward. I am just kind of concerned that when this system is in production and they have to take it down to perform maintenance, this will happen again and since nothing is really "wrong" with the queue, monitoring this is fairly difficult.

Any ideas or suggestions?

|||

When you run into this problem, look at sys.dm_broker_queue_monitors, sys.dm_broker_activated_tasks and sys.service_queues views. We need the content of these views to diagnose the issue.

HTH,
~ Remus

|||

Hi Remus

Ok next time i will get that information.

Thanx

Activated Proc not firing.

Hi There

I just had the following scenario.

I checked sys.service_queues to confirm the my queue has an activated proc assigned to it and is activation_enabled.

I send messages to the service, however i see that the messages just sit in the queue. I run profiler with all SB and Error events there is nothing, i check the sql server log, there is also nothing.

So i have no idea why the activated proc is not firing, all i see in the profiler trace is that the messages are acknowledged but the activated proc does not execute.

For a while i was stumped. i then tried to execute the proc myself and i got a syntax error.

Basically what happened was that i altered a table that the proc used and now the proc cannot execute cos there are more columns that must be inserted so i altered the proc.

However the activated proc still did not fire.

I had to disable and re-enable activation for it to work.

What i am wondering is why was there no indication in profiler or the sql og as the the fact that something was wrong with the activated proc ? Surely the activated proc should have fired and given the same error i got either to the sql log or profiler ?

And why did i have to re-enable activation ? Does sql cache the proc when you activate it and not know that the proc has changed when you alter it ?

Thanx

I had a similar issue...and I am trying to get a resolution on this. In my scenario, it was a new service broker startup (complete rebuild of queues from build scripts that were working in our development database environment)...We have about 30 queues in which all but 1 worked fine. When I went to look to see what happened, the queue was up and activation was on and the messages were sitting in the target queue. When I manually executed the activation stored procedure everything was successful and processed fine (no errors). This is not the first time this has happened, and after it is manually executed the activation seems to occur without issue from that point forward. I am just kind of concerned that when this system is in production and they have to take it down to perform maintenance, this will happen again and since nothing is really "wrong" with the queue, monitoring this is fairly difficult.

Any ideas or suggestions?

|||

When you run into this problem, look at sys.dm_broker_queue_monitors, sys.dm_broker_activated_tasks and sys.service_queues views. We need the content of these views to diagnose the issue.

HTH,
~ Remus

|||

Hi Remus

Ok next time i will get that information.

Thanx

Saturday, February 25, 2012

accing shered volume

Hello there
I have local hard drive, which i can easy run xp_cmdshell 'dir c:\'
On the same computer i have shered Z: volume which is hard drive on another
server
How can i get list of all files on z by using xp_cmdshell 'dir z:' ?What account is SQL Server running as? It must have permissions to the Z:\
(typically this means you must set up SQLServer to run as a Domain\User as
opposed to a local user or built-in account).
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:eXbwFn7kGHA.3816@.TK2MSFTNGP02.phx.gbl...
> Hello there
> I have local hard drive, which i can easy run xp_cmdshell 'dir c:'
> On the same computer i have shered Z: volume which is hard drive on
> another
> server
> How can i get list of all files on z by using xp_cmdshell 'dir z:' ?
>
>

Friday, February 24, 2012

Accessing to another server

Hello there
I have two databases, on two diffrent servers, connected to the same
network.
In order to use them both I:
1. create registry to both servers on the same enterprize manater
2. Set them as remote server on two sides.
Now when i'm trying to access to one server when connecting to other server,
it being connected as Guest. And i would like to access to another server as
Admin, or other user.
How can i do that?Roy
Have you read about Linked Servers?
"roy goldhammer" <roy@.hotmail.com> wrote in message
news:eOinwRG%23FHA.740@.TK2MSFTNGP11.phx.gbl...
> Hello there
> I have two databases, on two diffrent servers, connected to the same
> network.
> In order to use them both I:
> 1. create registry to both servers on the same enterprize manater
> 2. Set them as remote server on two sides.
> Now when i'm trying to access to one server when connecting to other
> server, it being connected as Guest. And i would like to access to another
> server as Admin, or other user.
> How can i do that?
>|||Is there diffrenct between linked server and remote server?
' 03-5611606
' 050-7709399
: roy@.atidsm.co.il
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:OFMRt3J%23FHA.1032@.TK2MSFTNGP11.phx.gbl...
> Roy
> Have you read about Linked Servers?
>
> "roy goldhammer" <roy@.hotmail.com> wrote in message
> news:eOinwRG%23FHA.740@.TK2MSFTNGP11.phx.gbl...
>|||Roy
By creating Linked Server you will be able to query this (remote)
server like SELECT <> FROM Servername.DataBase.dbo.Table WHERE...
By registering a remote server via EM you can olny view a data if you have
an appropriate permissions
One thing I'd like to mention is you can use OPENROWSET command to query
remote server without creating linked server on it.
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:eri9hfL%23FHA.160@.TK2MSFTNGP12.phx.gbl...
> Is there diffrenct between linked server and remote server?
> --
>
>
> ' 03-5611606
> ' 050-7709399
> : roy@.atidsm.co.il
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:OFMRt3J%23FHA.1032@.TK2MSFTNGP11.phx.gbl...
>

Sunday, February 19, 2012

accessing stored procedure

Hi there!
I 've defined a sp while I was logged as 'sa' into query
analyser...well, I defined this sp with a specific owner, I mean:
create proc myowner.myproc...Etc...
once defined, I can invoke this sp from query analyser, no pb..(exec
myowner.myproc...)
But, when I log into database ('sa' user) from VBscript and I try to
run my sp, it says, it can't find my sp...despite the fact I can run
it from query analyser without any troubles...
did I miss something'
thanks a lot
++
Vince
note: this sp uses bulk insert statement, so the user needs to be
either symin or bulkadmin, that's why I chose to log as 'sa', I
noticed that no need for 'myowner' to be in bulkinsert roleVince <vincent@.<remove>.> wrote in news:nkf551h5lc7dc0rllkdvrvtvslocfebkri@.
4ax.com:

> Hi there!
> I 've defined a sp while I was logged as 'sa' into query
> analyser...well, I defined this sp with a specific owner, I mean:
> create proc myowner.myproc...Etc...
> once defined, I can invoke this sp from query analyser, no pb..(exec
> myowner.myproc...)
>
> But, when I log into database ('sa' user) from VBscript and I try to
> run my sp, it says, it can't find my sp...despite the fact I can run
> it from query analyser without any troubles...
> did I miss something'
> thanks a lot
>
If the object is owned by a user account other than sa (sa would show
"dbo" as the owner), then you must preface it with the owner name
(myowner.myproc) when logged in as anyone other than the owner, including
sa.
Rumble
"Write something worth reading, or do something worth writing."
-- Benjamin Franklin|||On Tue, 05 Apr 2005 16:56:47 GMT, Rumbledor
<Rumbledor@.hotspamsuxmail.com> wrote:

>If the object is owned by a user account other than sa (sa would show
>"dbo" as the owner), then you must preface it with the owner name
>(myowner.myproc) when logged in as anyone other than the owner, including
>sa.
this is what I did in my VBscript, I logged in as 'sa' but I invoke my
sp naming it by its owner...
that's why I don't understand why it doesn't work...
I got It '
++
Vince|||Vince <vincent@.<remove>.> wrote in
news:7ih551t07mds2rt30dkl779dunangq4aj0@.
4ax.com:

> On Tue, 05 Apr 2005 16:56:47 GMT, Rumbledor
> <Rumbledor@.hotspamsuxmail.com> wrote:
>
> this is what I did in my VBscript, I logged in as 'sa' but I invoke my
> sp naming it by its owner...
> that's why I don't understand why it doesn't work...
> I got It '
It sounds like it should work, then. Perhaps if you posted the VBScript
code, the problem might be more apparent.
Rumble
"Write something worth reading, or do something worth writing."
-- Benjamin Franklin