cursors status
1 Find out the cursors that are allocated but not opened or closed
01.
--Method 1
02.
03.
select
name
from
sys.dm_exec_cursors(0)
where
is_open =0
04.
05.
06.
--Method 2
07.
08.
select
09.
cur.cursor_name
10.
from
11.
sys.syscursorrefs
as
ref
inner
join
sys.syscursors
as
cur
on
ref.cursor_handl=cur.cursor_handle
12.
where
13.
cur.open_status =0
2 Find out the cursors that are opened and not closed
01.
--Method 1
02.
03.
select
name
from
sys.dm_exec_cursors(0)
where
is_open =1
04.
05.
06.
--Method 2
07.
08.
select
09.
cur.cursor_name
10.
from
11.
sys.syscursorrefs
as
ref
inner
join
sys.syscursors
as
cur
on
ref.cursor_handl=cur.cursor_handle
12.
where
13.
cur.open_status =1
3 Find out the cursors that are allocated but not deallocated
01.
--Method 1
02.
03.
select
name
from
sys.dm_exec_cursors(0)
04.
05.
06.
--Method 2
07.
08.
select
09.
cur.cursor_name
10.
from
11.
sys.syscursorrefs
as
ref
inner
join
sys.syscursors
as
cur
on
ref.cursor_handl=cur.cursor_handle
0 comments:
Post a Comment