Deadlock captures: "FETCH API_CURSOR..." but not query behind it......

This article shows how to "unmask" the sql query behind a FECTH API_CUSOR
http://www.sqlskills.com/blogs/joe/hunting-down-the-origins-of-fetch-api_cursor-and-sp_cursorfetch/
that is shown in a deadlock graph. But if only applies if one can capture the event while it is ongoing.  Is there a counter in Sql profier (2005) to indicate\capture the query behind the FETCH?  (because most of the time I find out about
deadlocks long after the victim spid has been killed.)
TIA,
edm2
P.S.Of course it I captured every sql statement executed on the server that may do it but I'm trying not to overburden the server by collecting excessive info

Quite honestly you are hitting a very old and continuing problem:
If the original query is out of the system, for whatever reason (cash flushes etc), you cannot get if after the fact.
- when the alert/event notification occurs, it may be too late
If you are hitting this problem frequently you indeed have to set up a trace which captures all possible initiators statements, just to have them once the deadlock occurs.
I don't see the version of SQL Server you are using, but from 2012 on you can stick to Extended Events for such. Otherwise, yes, get a SQL Trace (no Profiler/GUI) in place.
Deadlocks are captured by default from SQL 2008 on, and in 2012 you have all events available - in 2008 some that you may need might not be there yet.
Andreas Wolter
Microsoft Certified Master SQL Server 2008
Microsoft Certified Solutions Master SQL Data Platform, SQL Server 2012
Blog: www.insidesql.org/blogs/andreaswolter
Web: www.andreas-wolter.com |
www.SarpedonQualityLab.com

Similar Messages

  • Capture card recognized but not capturing any video

    Hi everybody,
    I have a problem with a capture card, a Pinnacle 50dtvi.
    I'm trying to capture live video via Flash, using the Camera
    object. With my webcam it works perfectly.
    Flash is given the permission to access the capture card,
    which is recognized correctly by Flash, nevertheless it doesn't
    show any output.
    Any solution?
    Maybe there's a problem with the fact the card has several
    input sources (tv, analog in etc.) and Flash doesn't know how to
    distinguish among them - this, for instance, is what happens with
    softwares like vvvv, where you can select the capture device and,
    inside it, the capture source.
    Is there any way to make this choice in Flash via
    ActionScript?
    Do you know of any (possibly low-cost) capture card working
    with Flash which have a in and a out?
    I've seen others have similar problem, for instance:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=578&threadid=1164387&en terthread=y
    Thanks everybody!

    I have the same problem with other TV capture cards. I've
    tried a hauppauge 150, 350, and an AverMedia card.
    All show up as valid camera devices, but there is no video. I
    even tried to use an external applciation to set channels, set
    inputs, etc. No luck.
    My application works with some camera sources, such as usb
    web cams and a usb composite video capture device.
    I've searched lots of different forums and come across this
    problem at least a half a dozen times - never answered though.
    Help!!

  • Sys_refcursor not fetching any data although query returns value

    hi!!!
    I am using sys_refcursor to return columns,and using below procedure to do so.Although data is there in table_1 and table_2.
    PROCEDURE test_pro(abc_date N DATE,
    cur_get_data OUT sys_refcursor
    OPEN cur_get_data
    for
    select A.col1,B.col2
    from table_1 A
    where A.dis_date=abc_date
    left outer join
    table_2 B
    on
    A.dis_date=B.dis_date;
    IF cur_get_data%rowcount=0
    then
         raise e_error;
    END if;
    EXCEPTION
         when e_error
         then
              ------no_data_found;
         when others
         then
    --------(giving SQL error with error code);
    END      test_pro;
    while running below sql in sql window of pl/sql developer fetching
    data
    select A.col1,B.col2
    from table_1 A
    where A.dis_date=abc_date
    left outer join
    table_2 B
    on
    A.dis_date=B.dis_date;
    but while testing the test_pro in test window of pl/sql developer it is
    not fetching any data and raising e_error each time
    is there any problem arising using IF cur_get_data%rowcount=0 as each time it is going to exception block..
    so can somebody please put some ideas what cud be the possible reason for this??

    Welcome to the forum!
    Unfortunatley you posted to the wrong forum. This question belongs in the SQL and PL/SQL forum.
    PL/SQL
    >
    sys_refcursor not fetching any data although query returns value
    but while testing the test_pro in test window of pl/sql developer it is
    not fetching any data and raising e_error each time
    is there any problem arising using IF cur_get_data%rowcount=0 as each time it is going to exception block..
    >
    A cursor doesn't fetch data - your code has to do that. The code you posted doesn't have any FETCH statements so no data will be fetched.
    There is no problem using 'IF cur_get_data%rowcount=0' but it will always be 0 in your code because you are not fetching any data.
    I'm guessing that you are trying to determine if there are any rows for the query. That isn't going to work since a cursor doesn't fetch rows.
    You just have to return the cursor to the caller and the caller will have to perform at least one fetch to see if there are any rows.
    If the above answers your question the just mark the question ANSWERED. Otherwise, since you have posted in the wrong forum
    1. repost the question in the SQL and PL/SQL forum
    2. Edit this post to add a link to the new thread in the other forum
    3. Mark this question ANSWERED so people will follow up in the other forum.
    Thanks.

  • Can you check for data in one table or another but not both in one query?

    I have a situation where I need to link two tables together but the data may be in another (archive) table or different records are in both but I want the latest record from either table:
    ACCOUNT
    AccountID     Name   
    123               John Doe
    124               Jane Donaldson           
    125               Harold Douglas    
    MARKETER_ACCOUNT
    Key     AccountID     Marketer    StartDate     EndDate
    1001     123               10526          8/3/2008     9/27/2009
    1017     123               10987          9/28/2009     12/31/4712    (high date ~ which means currently with this marketer)
    1023     124               10541          12/03/2010     12/31/4712
    ARCHIVE
    Key     AccountID     Marketer    StartDate     EndDate
    1015     124               10526          8/3/2008     12/02/2010
    1033     125               10987         01/01/2011     01/31/2012  
    So my query needs to return the following:
    123     John Doe                        10526     8/3/2008     9/27/2009
    124     Jane Donaldson             10541     12/03/2010     12/31/4712     (this is the later of the two records for this account between archive and marketer_account tables)
    125     Harold Douglas               10987          01/01/2011     01/31/2012     (he is only in archive, so get this record)
    I'm unsure how to proceed in one query.  Note that I am reading in possibly multiple accounts at a time and returning a collection back to .net
    open CURSOR_ACCT
              select AccountID
              from
                     ACCOUNT A,
                     MARKETER_ACCOUNT M,
                     ARCHIVE R
               where A.AccountID = nvl((select max(M.EndDate) from Marketer_account M2
                                                    where M2.AccountID = A.AccountID),
                                                      (select max(R.EndDate) from Archive R2
                                                    where R2.AccountID = A.AccountID)
                   and upper(A.Name) like parameter || '%'
    <can you do a NVL like this?   probably not...   I want to be able to get the MAX record for that account off the MarketerACcount table OR the max record for that account off the Archive table, but not both>
    (parameter could be "DO", so I return all names starting with DO...)

    if I understand your description I would assume that for John Dow we would expect the second row from marketer_account  ("high date ~ which means currently with this marketer"). Here is a solution with analytic functions:
    drop table account;
    drop table marketer_account;
    drop table marketer_account_archive;
    create table account (
        id number
      , name varchar2(20)
    insert into account values (123, 'John Doe');
    insert into account values (124, 'Jane Donaldson');
    insert into account values (125, 'Harold Douglas');
    create table marketer_account (
        key number
      , AccountId number
      , MktKey number
      , FromDt date
      , ToDate date
    insert into marketer_account values (1001, 123, 10526, to_date('03.08.2008', 'dd.mm.yyyy'), to_date('27.09.2009', 'dd.mm.yyyy'));
    insert into marketer_account values (1017, 123, 10987, to_date('28.09.2009', 'dd.mm.yyyy'), to_date('31.12.4712', 'dd.mm.yyyy'));
    insert into marketer_account values (1023, 124, 10541, to_date('03.12.2010', 'dd.mm.yyyy'), to_date('31.12.4712', 'dd.mm.yyyy'));
    create table marketer_account_archive (
        key number
      , AccountId number
      , MktKey number
      , FromDt date
      , ToDate date
    insert into marketer_account_archive values (1015, 124, 10526, to_date('03.08.2008', 'dd.mm.yyyy'), to_date('02.12.2010', 'dd.mm.yyyy'));
    insert into marketer_account_archive values (1033, 125, 10987, to_date('01.01.2011', 'dd.mm.yyyy'), to_date('31.01.2012', 'dd.mm.yyyy'));
    select key, AccountId, MktKey, FromDt, ToDate
         , max(FromDt) over(partition by AccountId) max_FromDt
      from marketer_account
    union all
    select key, AccountId, MktKey, FromDt, ToDate
         , max(FromDt) over(partition by AccountId) max_FromDt
      from marketer_account_archive;
    with
    basedata as (
    select key, AccountId, MktKey, FromDt, ToDate
      from marketer_account
    union all
    select key, AccountId, MktKey, FromDt, ToDate
      from marketer_account_archive
    basedata_with_max_intervals as (
    select key, AccountId, MktKey, FromDt, ToDate
         , row_number() over(partition by AccountId order by FromDt desc) FromDt_Rank
      from basedata
    filtered_basedata as (
    select key, AccountId, MktKey, FromDt, ToDate from basedata_with_max_intervals where FromDt_Rank = 1
    select a.id
         , a.name
         , b.MktKey
         , b.FromDt
         , b.ToDate
      from account a
      join filtered_basedata b
        on (a.id = b.AccountId)
    ID NAME                     MKTKEY FROMDT     TODATE
    123 John Doe                  10987 28.09.2009 31.12.4712
    124 Jane Donaldson            10541 03.12.2010 31.12.4712
    125 Harold Douglas            10987 01.01.2011 31.01.2012
    If your tables are big it could be necessary to do the filtering (according to your condition) in an early step (the first CTE).
    Regards
    Martin

  • I can print to a Lexmark X4550, but not scan (with Image Capture)

    Following tips (by "Lexmark Listens" and others) I succeded in printing (via USB and wifi) to a Lexmark X4550.
    But when scanning (via USB) using the Image Capture app (included in Mac OS), Image Capture sees the scanner a couple of seconds, then complains that no scanner is connected (although it still is).
    This happens with a MacBook (Pro), but not with another MacBook (white).
    I tried (not necessarily in this order):
    - reboot
    - repair disk permissions
    - re-installing drivers (both printer driver and "Image Capture Application Scan Driver for for 10.6.8 and later Mac OS") from Lexmark support site.
    - running Mac OS software update (which updated the printer driver to version 2.8]
    - resetting the printing system: http://support.apple.com/kb/HT1341
    How can I completely remove all files related to Lexmark printers&scanners and try again installing from a clean state?
    (I see in other posts that a Lexmark Uninstaller is sometimes located in HD/Library/Printers/Lexmark/YEAR/ ; I used to have one here, but it was removed during previous attempts at getting the scanner working ; and anyway when I run this Uninstaller at the time, it did not completely clean the /Printer/Lexmark)
    My problem is very similar to this one described in this bug report in Lexmark knowledge base:
    http://bit.ly/MOR9bd
    But the patch proposed is "For Mac OS X 10.6 only" and titled "LexmarkPro800-Pro900SeriesQFE1.0.0.dmg" so I don't think it would work for a Lexmark X4550. (Indeed I installed this patch and the problem is still there).
    As for the workaround suggested, "When using Apple's Image Capture application, do not use the "Show Details" option [...]", I can't get it to work: as soon as I launch Image Capture, it starts scanning (a preview) and the "Show Details" bouton is grayed out.
    I've already spent many hours trying to get this printer-scanner to work with my Mac.
    Any suggestion would be very helpful!

    Same issue, sort of.  After ML upgrade, Lexmark x264dn fails to register as a printer & scanner, there is no scan tab anymore.   Also, image capture application is stuck in a crash loop until I disable mDNS (bonjour) on the printer.   Still, it does not register as a scanner anywhere (protoshop, image capture, preview...)
    I have installed all the package scripts from Lexmark's Mountain Lion support page.   No dice.

  • Query for Price difference account when item is not sold but not on stock

    Hi Experts!
    One of my clients accountant requires a report which will help for what to do with the balance of the price difference account.
    At the and of the year there are some postings on this account, but not every item that hadnt been on stock when A/P Invoice arrived were sold. Some item were waistrel and put into a waistrel warehouse, but not sold.Some item were sent back to the supplier, but not sold.
    Is it possibble to make a query for knowing where to post the balance of the price difference account? Not all should be post to the Cost of goods sold.
    Thank you in advance!

    Hi,
    The query is possible.  However, it is a complicated one. It is also need to involve detailed analysis to your transaction histories.  You may start from OINM table to check.
    Thanks,
    Gordon

  • After using video capture device to copy VHS to DVD, burnt DVD will play on computer but not

    After using video capture device to copy VHS to DVD, burnt DVD will play on computer but not on DVD player. Tech support for the VCD said my HP DVD burning software has to burn "DVD Video and not DVD data" and to check with HP. How can i check myself.

    Grahamster, welcome to the forum.
    I recommend trying CDBurnerXP for burning video CD's.  I have been using it for years without a glitch.  I use it mainly for burning ISO's, but have used it for all types.  Please let us know if it works or not.
    Signature:
    HP TouchPad - 1.2 GHz; 1 GB memory; 32 GB storage; WebOS/CyanogenMod 11(Kit Kat)
    HP 10 Plus; Android-Kit Kat; 1.0 GHz Allwinner A31 ARM Cortex A7 Quad Core Processor ; 2GB RAM Memory Long: 2 GB DDR3L SDRAM (1600MHz); 16GB disable eMMC 16GB v4.51
    HP Omen; i7-4710QH; 8 GB memory; 256 GB San Disk SSD; Win 8.1
    HP Photosmart 7520 AIO
    ++++++++++++++++++
    **Click the Thumbs Up+ to say 'Thanks' and the 'Accept as Solution' if I have solved your problem.**
    Intelligence is God given; Wisdom is the sum of our mistakes!
    I am not an HP employee.

  • Abnormal, Same query get data in sql but not working on Fron-end

    Dear,
    Version :Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    We have created packed in oracle database befor two months ago & was working fine, but since morning select statment in package is not working while running via application which mentioned below and raise not data found but surprising thing is that same query is getting data when we execut on sql plus return one record.
    i don't know either it's abnormal behaviour or sth else becuase the same query run without changing any singl column in where_clause work in sql but not getting data while submition request through oracle application and raising not data found.
    --thankse
    Edited by: oracle0282 on Dec 29, 2011 2:20 AM

    Actully when i run this query in sql it return one record on the same parameter, while when we exeucte this select in pl/sql on the same parameter oracle raise no data found error.
    so i got confused the same query with same parameter retur record in sql but when we call it fron-end through packege raise 'no data found error'.
    hope you understand now.
    --thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Query works in Report but not during Edit session

    I have a report based on an SQL query, and it works perfectly from the menu in Development. It's also in Test and Production, and it works there, too. I want to change the template it's on, so I went in through the Navigator to open up and change the report. The Edit session opens up to the query, but I cannot move to any of the other tags, because it says the query is "not valid".
    It won't allow me to save the query 'as is', because it supposedly isn't valid. The report isn't locked, and prior versions (I went back to view five of them) have the same trouble. How can the query work off the menu, but not be 'valid'? We installed a patch recently, but even so, why would the query work in one spot and not another?
    Anyone have any ideas on what I can do?
    Pat Murray

    Hi,
    Please give me the query and the error the error you are getting.
    Thanks,
    Sharmila

  • Query running in Quality but not in Production

    Hi Folks,
    we are running a query AQICSDUSERS=====MOVEMENTLIST4= which used to get executed previously,but all of a sudden now after running for an hour or so it is coming back to  sap easy access screen without displaying the report.It is running and giving the report in Quality but not in Production.
    What could be the reason?
    K.Kiran.

    Hi Folks,
    From DUMP I got this:-
    <b>You should usually execute long-running programs as batch jobs.
    If this is not possible, increase the system profile parameter
    "rdisp/max_wprun_time".</b>
    I want to know how to increase the system profile parameter
    "rdisp/max_wprun_time".
    Thanks,
    K.Kiran.

  • Can you change the canvas size in AI CC . If so how? Not the artboard but the canvas behind it. I have a large cad drawing.

    Can you change the canvas size in AI CC . If so how? Not the artboard but the canvas behind it. I have a large cad drawing.

    Vandushia,
    The Workspace size is fixed, 16,384 points.
    I am afraid you will have to work in a suitable scale, which could be 1:2, 1:4, 1:10, or whatever is most convenient.

  • Is it possible to apply conditional formatting to a cell (or range) based upon a LOOKUP query to cell values in another sheet.? I want to alter the formatting (i.e., text and/or cell background color), but not cell content.

    Is it possible to apply conditional formatting to a cell (or range) based upon a LOOKUP query to cell values in another sheet.?
    I want to alter the formatting (i.e., text and/or cell background color), but not the content, of the target cell(s).

    Hi Tom,
    Your LOOKUP formula will return a value that it finds in the "other" table. That value can be used in conditional highlighting rules. (Numbers 3 calls it conditional highlighting, not conditional formatting. Just to keep us awake, I guess, but it works the same).
    Please explain what you are trying to do.
    Regards,
    Ian.

  • SQL query works for Access but not mySQL

    *I'm using the Database Connectivity VIs* Can anyone give me a clue as to why the following query works with an MS Access File DSN but not a mySQL File DSN:
    SELECT * FROM (SELECT * FROM WP100598 WHERE SerialNum LIKE '311022-05%' OR SerialNum LIKE '311022-07%') WHERE UTCTime > 1090882800 AND UTCTime < 1092870000 ORDER BY SerialNum desc
    Thank you, your help is much appreciated

    Hi,
    I don't think MySQL supports nested queries.
    Regards,
    Wiebe.
    "optobionics" wrote in message
    news:[email protected]..
    > *I'm using the Database Connectivity VIs* Can anyone give me a clue
    > as to why the following query works with an MS Access File DSN but not
    > a mySQL File DSN:
    > SELECT * FROM (SELECT * FROM WP100598 WHERE SerialNum LIKE
    > '311022-05%' OR SerialNum LIKE '311022-07%') WHERE UTCTime >
    > 1090882800 AND UTCTime < 1092870000 ORDER BY SerialNum desc
    > Thank you, your help is much appreciated

  • Image Capture connects to card reader but not camera

    Image Capture and iPhoto do not detect new connected Canon camera.  Will read card via card reader.  Camera will connect to older macbook iPhoto and Image Capture but not my iMac.  Image Capture in Mountain Lion has no perferences anymore.  Tried Repairing Disk Permissions but no success. Any ideas?

    Sorry, there is no setting on the AirPort Extreme card built-in your new iMac that can be tweaked to "force" a connection to the Netgear's "n" network.
    Does your Netgear allow for different Network Names (or SSIDs) for each of its radios? If so, you can try an experiment by renaming the 5 GHz radio's Network Name, and then, specifically connect the iMac to it.
    Also, since "n" can operate on either radio, it appears that your iMac is "locking" on the 2.4 GHz radio. Does your iMac have any trouble connecting to any other "n" Wi-Fis? If so, then there may be a problem with either the AirPort Extreme card or the internal antennae on the iMac ... and it would warrant a visit to your local Apple Store to have them take a look.

  • Query works interactively, but not as a View? ORA-03113: end-of-file on communication

    Hi,
    I have created a db, using object stuff and now am doing a few
    queries. I created this query and it makes perfect sense, runns
    fine interactively and returns the correct records ..
    But if I put this query into a separate queries.sql file and try
    to create a VIEW of it in there, I get that end-of-file
    communicaton error, and it basically disconnects me from
    oracle .. so I have to restart SQLPlus. There are no other
    characters or anything in the file, just the query itself ..
    This is what happens when I run the .sql script which creates a
    view of the query:
    SQL> create or replace view query_b3 as
    2 SELECT w.dinner.restaurant AS Restaurant, w.y.name.surname
    AS Surname, w.x.bookingno AS BookingNo
    3 FROM (SELECT deref(wd.sdt) x, dinner, deref(sd.guestref) y
    4 FROM weekenddeal wd, specialdeal sd
    5 WHERE wd.sdt.bookingno = sd.bookingno) w;
    create or replace view query_b3 as
    ERROR at line 1:
    ORA-03113: end-of-file on communication channel
    SQL>
    SQL> select * from query_b3
    2 /
    select * from query_b3
    ERROR at line 1:
    ORA-03114: not connected to ORACLE
    PLEASE HELP!!!! This query WORKS FINE in SQLPlus, but NOT when I
    put it in an outside file / try making a VIEW of it!!!!

    Hi,
    I was having this problem in a Test DB that was running in
    Windows NT.
    I thought the problem was caused by Inadequate memory.
    Pls Check that.
    Regards,
    Ganesh R

Maybe you are looking for