Sample Header Ad - 728x90

Lots of "FETCH API_CURSOR0000..." on sp_WhoIsActive ( SQL Server 2008 R2 )

10 votes
4 answers
7696 views
I have a strange situation. Using sp_whoisactive I can see this: Strange Ok, with this query, I can see what is triggering ( does this word exists in english? ) it: SELECT c.session_id, c.properties, c.creation_time, c.is_open, t.text FROM sys.dm_exec_cursors (SPID) c --0 for all cursors running CROSS APPLY sys.dm_exec_sql_text (c.sql_handle) t the result: its just a select it's a simple select. Why is this using fetch_cursor? Also, I see a lot of "blank" sql_texts too. Does this has something with this "cursor"? blank DBCC INPUTBUFFER (spid) shows me this: print there's this question Here ( made by me ) but i don't know if this is the same thing. _____________________________________________________________________________ **EDIT1:** Using the query provided by kin, I see this: still  no code. ___________________________________________________________________________ **EDIT2:** Using Activity Monitor, I can see this: Mos expensive query It is the most expensive query ( The first one is intentional, we know about it ). And again, I would like to know, why this select * from... is the reason of FETCH CURSOR... ________________________________________________________________________________ **EDIT3:** This "select * from..." is running from another server ( via linked server ). Well, Now i'm having problems to understand what @kin said. This is the execution plan of the query ( running in the same server of the database): same server of the database this is now, the execution plan, running in the other server, via linked server: enter image description here Ok, Not a problem too. And NOW! the execution plan , via **activity monitor** ( the same select * from ): what the hell is going on here?
Asked by Racer SQL (7546 rep)
Aug 12, 2015, 12:33 PM
Last activity: Jul 12, 2024, 09:01 PM