Showing posts with label altered. Show all posts
Showing posts with label altered. Show all posts

Sunday, March 11, 2012

Activation proc failed

Good day,

I have send a msg successful,but the proc failed. I altered the proc to correct the problem in the proc. The msg are still in the queue. Is there a manual way to excute the proc again to process the msg in the q? or do I wait for service broker to do it after a retry time (self recover)?

thank you in advance.

If the proc fails (i.e. throws an exception), Service Broker will try to restart the proc every 5 seconds. However, if your proc actually did a RECEIVE which was rolled back, then the rollback handler will detect this as a poisoned message and disable the queue. You can check this by doing:

select is_receive_enabled from sys.service_queues where name='YourQueue';

You can enable the queue by:

alter queue [YourQueue] with status = on;

|||

Rudhi

what I did :

receive top(1) @.receivedMsg = message_body,

@.h = conversation_handle,

@.msgType = message_type_name

from q111 -- wrong queue ,finger trouble.

In theLog file viewer :
The activated proc [dbo].[HandleRecieveMsg] running on queue EOGDB.dbo.q2eog output the following: 'Invalid object name 'q111'.'

So I corrected the proc to point to the correct queue.

I did as you said: "select is_receive_enabled from sys.service_queues where name='q2eog'; " q return a value of 1.

The message still is in the correct q after 5 seconds and longer.

Is there something else I can look or do?

|||

Okay I followed the steps in the help:

"Symptom: Activation Stored Procedures Do Not Run". And discovered that the proc I execute inside the RecieveProc fails.

(the proc I exec inside the recieving proc is proc reference a external assmbly)

Now my q is if a proc fails and the msg is allready retrieved from the queue, what happens to the msg? where does it go or the error msg?

|||

You can look at the state of the queue monitor:

select * from sys.dm_broker_queue_monitors;

If it is in 'NOTIFIED' state (which means, waiting for someone to do a RECEIVE), you can either reset the state by doing a RECEIVE or an ALTER QUEUE:

ALTER QUEUE [YourQueue] WITH STATUS = ON;

Hope that helps.

|||If you are doing that within a transaction scope, the transaction should rollback and the message should be put back into the queue.

Saturday, February 25, 2012

Accidentally dropped DBO from database

I altered a script that drops all users from a database and accidentally
changes an AND to an OR so that the user DBO was dropped after a refresh fro
m
production to dev.
Can I readd this user or is the only solution is to restore from backup?
Thanks,
LindaYou can use sp_changedbowner and dbo will map to whatever
login you assign as the database owner with
sp_changedbonwer.
You can find more information on sp_changedbowner in SQL
Server books online.
-Sue
On Tue, 18 Jan 2005 06:25:03 -0800, "Linda"
<Linda@.discussions.microsoft.com> wrote:

>I altered a script that drops all users from a database and accidentally
>changes an AND to an OR so that the user DBO was dropped after a refresh fr
om
>production to dev.
>Can I readd this user or is the only solution is to restore from backup?
>Thanks,
>Linda|||The user dbo was dropped from sysusers. This did not solve the problem. I
ended up restoring the database from backup but that took several hours and
I
had been hoping a quick script to add dbo back to sysusers might solve it.
"Sue Hoegemeier" wrote:

> You can use sp_changedbowner and dbo will map to whatever
> login you assign as the database owner with
> sp_changedbonwer.
> You can find more information on sp_changedbowner in SQL
> Server books online.
> -Sue
> On Tue, 18 Jan 2005 06:25:03 -0800, "Linda"
> <Linda@.discussions.microsoft.com> wrote:
>
>|||Actually, what I suggested is exactly how you fix the issue.
Without any information on what happened or what errors you
had, it's hard to give you more specifics.
If you were receiving the error:
Error 21776: [SQL-DMO] The name 'dbo' was not found in the
Users collection. If the name is a qualified name, use [] to
separate the various parts of the name, and try again
That error is due to having databases where the owner (dbo)
is mapped to a login that doesn't exist on the server. It's
not a matter of DBO being dropped but rather problems with
the mappings.
If you get an error along the lines of "the user is already
a user in the database" when using sp_changedbowner, that's
generally due to a mismatch between dbo and the database
owner. You can work around this by creating a temp login,
change the owner to this new login, then change the owner to
the login you actually want to be the owner and drop the
temporary login.
-Sue
On Thu, 20 Jan 2005 08:57:06 -0800, "lslmustang"
<lslmustang@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
>The user dbo was dropped from sysusers. This did not solve the problem. I
>ended up restoring the database from backup but that took several hours and
I
>had been hoping a quick script to add dbo back to sysusers might solve it.
>"Sue Hoegemeier" wrote:
>