I am using Service broker in two instances in two physical servers .with this instrument :
http://www.sqlservercentral.com/articles/Service+Broker/2797/
I set all certificate and all other options for both servers .I am using this code to send a message to target machine :
Declare #ConversationHandle uniqueidentifier
Begin Transaction
Begin Dialog #ConversationHandle
From Service SenderService
To Service 'ReceiverService'
On Contract SampleContract
WITH Encryption=off;
SEND
ON CONVERSATION #ConversationHandle
Message Type SenderMessageType
('<test>test</test>')
Commit
But when i check the target queue no messages exist.So i check the sys.transmission_queue in sender machine and i found this :
All messages are here .why ?how can i found the problem ?
I check the sys.conversation_endpoints
6720A2A2-C8F6-E811-80E3-40A8F038BB1F 802A7832-100B-4093-BEF3-B91ACB98EA13 1 65536 6820A2A2-C8F6-E811-80E3-40A8F038BB1F 65536 2086-12-21 10:11:09.720 CO CONVERSING ReceiverService NULL 1 7 A3DAEFBC-2ADA-4C46-8F44-3FC9882BADD1 00000000-0000-0000-0000-000000000000 1900-01-01 00:00:00.000 1900-01-01 00:00:00.000 1 0x02388E050000 -1 0 0 0 -1 0 0 0 5
Finally i used this (enter link description here)post to find the problem .
The problem was the time different between two machines.
Related
I am fairly green at SQL and have reached a road block. I have a Job that already runs a query and sends an email to our purchasing department agents via the agent.
Here is my sample data they receive as a text attachment:
po_num vend_num qty_needed external_email_addr
318 1 200 email#earthlink.net
318 1 910 email#earthlink.net
703 2 250 email#row.com
993 3 3600 email#cast.com
993 3 3600 email#cast.com
676 4 1 NULL
884 5 10000 email#Futures.com
118 5 2500 email#Futures.com
My goal is to automatically send each vendor one email of the qty_needed using the email address in external_email_addr field. Also, if the email address is NULL it would send me an email that this needs to be fixed.
I am not sure how complicated or simple this is but any help would be greatly appreciated.
Since the po_num is unique you will generate several mails per email address per day based on the example data you provided.
I dont have access to SQL at the moment so the syntax might need some sprucing up.
SELECT po_num,
vend_num,
qty_needed,
CASE WHEN external_email_addr ='' THEN COALESCE(external_email_addr,'defaultempty#fixthisproblem.com') ELSE external_email_ddr END AS email_address
FROM table_name
I'm trying to (implicitly) create a temp table in SQL server 2014 (12.0.4100.1), using the following code:
proc sql;
create table UNDEAD."##_28DaysLater"n as
select * from UNDEAD.inv_overrides;
UNDEAD is an OLEDB libref, and the code is running on SAS 9.3_M2 (Windows). The error I am getting is below:
ERROR: Cursor extended fetch error: IRowset::GetNextRows failed. : The
object is in a zombie state. An object may enter a zombie
state when either ITransaction::Commit or ITransaction::Abort is called, or when a storage object was created and not yet
released.
The full log (with sastrace) is below, executed in a fresh session of Enterprise Guide (5.1).
What is actually happening here? Is it possible to prevent this error by configuration, on the SAS or SQL server side?
15 LIBNAME UNDEAD OLEDB
16 PROPERTIES=('Integrated Security'=SSPI 'Persist Security Info'=True 'initial catalog'=BDS)
17 DATASOURCE='Kernkraft400' PROVIDER=SQLNCLI11.1 SCHEMA=dbo connection=shared;
NOTE: Libref UNDEAD was successfully assigned as follows:
Engine: OLEDB
Physical Name: SQLNCLI11.1
18 OPTIONS SASTRACE=',,,d' SASTRACELOC=SASLOG NOSTSUFFIX;
19 proc sql;
20 create table UNDEAD."##_28DaysLater"n as
21 select * from UNDEAD.inv_overrides;
OLEDB_13: Prepared: on connection 3
SELECT * FROM "dbo"."inv_overrides"
OLEDB: AUTOCOMMIT turned ON for connection id 4
OLEDB: *-*-*-*-*-*-* COMMIT *-*-*-*-*-*-* on connection 4
OLEDB: AUTOCOMMIT turned OFF for connection id 4
OLEDB: AUTOCOMMIT turned ON for connection id 4
OLEDB: *-*-*-*-*-*-* COMMIT *-*-*-*-*-*-* on connection 4
NOTE: SAS variable labels, formats, and lengths are not written to DBMS tables.
OLEDB_14: Executed: on connection 3
SELECT * FROM "dbo"."inv_overrides"
OLEDB: AUTOCOMMIT turned ON for connection id 3
OLEDB: *-*-*-*-*-*-* COMMIT *-*-*-*-*-*-* on connection 3
OLEDB_15: Executed: on connection 3
CREATE TABLE "dbo"."##_28DaysLater" ("TECH_FROM_DTTM" datetime2(3),"MSF_BK" varchar(400),"COLUMN_NM" varchar(32),"OVERRIDE_VALUE"
varchar(1000),"APPLY_IND" varchar(3),"TECH_TO_DTTM" datetime2(3))
OLEDB: AUTOCOMMIT turned OFF for connection id 3
OLEDB: *-*-*-*-*-*-* COMMIT *-*-*-*-*-*-* on connection 3
OLEDB_16: Prepared: on connection 3
INSERT INTO "dbo"."##_28DaysLater" ("TECH_FROM_DTTM","MSF_BK","COLUMN_NM","OVERRIDE_VALUE","APPLY_IND","TECH_TO_DTTM") VALUES ( ?
, ? , ? , ? , ? , ? )
OLEDB_17: Executed: on connection 3
INSERT INTO "dbo"."##_28DaysLater" ("TECH_FROM_DTTM","MSF_BK","COLUMN_NM","OVERRIDE_VALUE","APPLY_IND","TECH_TO_DTTM") VALUES ( ?
, ? , ? , ? , ? , ? )
ERROR: Cursor extended fetch error: IRowset::GetNextRows failed. : The object is in a zombie state. An object may enter a zombie
state when either ITransaction::Commit or ITransaction::Abort is called, or when a storage object was created and not yet
released.
OLEDB: Performing ROLLBACK on connection 3
OLEDB: *-*-*-*-*-*-* ROLLBACK *-*-*-*-*-*-*
OLEDB: *-*-*-*-*-*-* ROLLBACK *-*-*-*-*-*-* on connection 3
NOTE: SUCCESSFUL INSERT of 1 ROWS
WARNING: File deletion failed for UNDEAD.'##_28DaysLater'n.DATA.
Staking the existence of a grave problem on the SQL Server side, I reincarnated the table via SASWORK and the log moaned no more:
data;
set UNDEAD.inv_overrides;
run;
proc sql;
create table UNDEAD."##_28DaysLater"n as
select * from &syslast;
NOTE: Table UNDEAD.'##_28DaysLater'n created, with 4 rows and 6
columns.
I am sending emails from SQL Server, and need to map the values of the sent_status column on the msdb.dbo.sysmail_mailitems table to something more descriptive.
So far I have identified two values:
1 = 'Sent'
2 = 'Failed'
Are there any more possible values, and if so what do they represent?
sent_status, --0 new, not sent, 1 sent, 2 failure or 3 retry.
On the MSDN page for the related msdb.dbo.sysmail_allitems table, the description for sent_status says:
The status of the mail. Possible values are:
sent - The mail was sent.
unsent - Database mail is still attempting to send the message.
retrying - Database Mail failed to send the message but is
attempting to send it again.
failed - Database mail was unable to send the message.
Connecting the two views together as follows:
SELECT DISTINCT mi.sent_status, ai.sent_status
FROM
msdb.dbo.sysmail_allitems ai
FULL OUTER JOIN
msdb.dbo.sysmail_mailitems mi ON
ai.mailitem_id = mi.mailitem_id
Will yield a relationship, which can be expressed with the following CASE statement:
SELECT
CASE sent_status
WHEN 0 THEN 'Unsent'
WHEN 1 THEN 'Sent'
WHEN 2 THEN 'Failed'
WHEN 3 THEN 'Retrying'
END AS sent_status_desc
FROM msdb..sysmail_mailitems
I have a table listing patient_clinic_visits. I have SQLSERVER 2005 backend. Access2010 frontend.
Each morning this table needed refreshing from a data dump from the hospital mainframe.
this data dump includes information on the day before (who attended, didn't, cancelled) and forward appointments for next 6 weeks.
I therefore do a "DELETE * from Patient_clinic_visits where Visit_Date > (a day) and < (a day + 1) to clean out the table for each day in turn before uploading the new data after some processing.
On most days there will be only about 100-150 records in each day. Their is one foreign key to Pat_ID in Master_Patient_Table which has NO_ACTION chain on it.
At the moment this Delete query is timing-out in the Access frontend after processing a couple of days of data (ie it works okay for Monday, Tuesday, Wednesday...)
I run sp_whoisactive and get:
00 01:53:01.926 52 [[query SELECT 1 FROM "dbo"."Patient_Clinic_Visits" ]] RAHCC_User (265ms)ASYNC_NETWORK_IO 0 0 0 NULL 51 0 0 2 suspended 0 NULL SAH0020663 RAHCC_DB Microsoft MDB RAHCC 2013-04-02 09:08:33.027 0 2013-04-02 11:01:35.033
00 00:00:27.610 53 [[query --
DELETE from Patient_Clinic_Visits WHERE clinic_date >= '26-Mar-2013' AND clinic_date < '27-Mar-2013' AND Clinic_location = 'MONC' ]] HAD\jhogan05 (27596ms)LCK_M_IX 16 0 0 52 1,074 0 0 130 suspended 2 NULL SAH0048645 RAHCC_DB Microsoft SQL Server Management Studio Express - Query 2013-04-02 11:01:07.343 0 2013-04-02 11:01:35.033
This indicates my client front end is waiting on a "SELECT 1 from Patient_Clinic_Vists" and this is blocking the procedure. Apparently this is due to an ASYNC_NETWORK_IO on the client (which can happen with Access front ends doing a table request and then not processing the data).
a) However a "SELECT 1 from Patient_Clinic_Visits" should really only return TRUE or FALSE ?? which is unlikely to fill up anything, and unclear why it would cause a block situation??
b) I can't find "SELECT 1..." in my Access frontend anywhere.. Is this perhaps part of a sequence of sub-selects made by SQLSERVER in response to a more complext select? If so how do I find the true select causing this situation in that process history?
cheers,
JonHD
a) The query "SELECT 1 from Patient_Clinic_Visits" will return either an empty result set (if the Patient_Clinic_Visits table is empty) or a result set with as many rows as the Patient_Clinic_Visits table, each row having a 1 in it. To do this, SQL Server will have to issue a query against the whole Patient_Clinic_Visits table, which (assuming default locking behavior) will cause shared (read) locks to be issues against the rows in that table.
b) (NOTE: the OP addressed this point in the comments) I might be missing something, but I don't see where you come up with the "SELECT 1 from Patient_Clinic_Vists" query based on sp_whosactive. The best way to understand the SQL being sent from your application to the database server might be to use SQL Profiler with an appropriate filter (perhaps filtering only for connections from the host running your application).
I'm doing "Multidimensional Project" with MS SQL Server 2012 (Server Data Tools - Visual Studio 2010 Shell). I can't run (debug) it.
If the data source's impersonation information is set to "use the service account", this error occures:
Error 2 Internal error: The operation terminated unsuccessfully. 0 0
Error 3 OLE DB error: OLE DB or ODBC error: Login failed for user 'NT Service\MSSQLServerOLAPService'.; 28000. 0 0
Error 4 Errors in the high-level relational engine. A connection could not be made to the data source with the DataSourceID of 'Data Warehouse', Name of 'Data Warehouse'. 0 0
Error 5 Errors in the OLAP storage engine: An error occurred while the dimension, with the ID of 'Items', Name of 'Items' was being processed. 0 0
Error 6 Errors in the OLAP storage engine: An error occurred while the 'Id' attribute of the 'Items' dimension from the 'Warehouse_MultidimensionalProject_Cube' database was being processed. 0 0
Error 7 Server: The current operation was cancelled because another operation in the transaction failed. 0 0
I guessed that this account has no premissions but (1) I coudn't even add this account (it seems that it doesn't exist) and (2) how is that even possible for it to not have built-it poremissions?
When I'm setting impersonation to "use the credentials of current user" (which is the owner of the data source, btw.), another error occures:
Error 2 Internal error: The operation terminated unsuccessfully. 0 0
Error 3 The datasource, 'Data Warehouse', contains an ImpersonationMode that is not supported for processing operations. 0 0
Error 4 Errors in the high-level relational engine. A connection could not be made to the data source with the DataSourceID of 'Data Warehouse', Name of 'Data Warehouse'. 0 0
Error 5 Errors in the OLAP storage engine: An error occurred while the dimension, with the ID of 'Items', Name of 'Items' was being processed. 0 0
Error 6 Errors in the OLAP storage engine: An error occurred while the 'Id' attribute of the 'Items' dimension from the 'Warehouse_MultidimensionalProject_Cube' database was being processed. 0 0
Error 7 Server: The current operation was cancelled because another operation in the transaction failed. 0 0
Any help?
The password musn't be set to blank for SQL Server to work properly... curious detail. :-)