Skip to Main Content
  • Questions
  • Close "Opened Cursor" Manually and your new book

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Peter.

Asked: May 06, 2001 - 11:04 pm UTC

Last updated: January 10, 2005 - 8:49 am UTC

Version: 8.1.6

Viewed 1000+ times

You Asked

Hi Tom:

1)
If we detect cursor leak (e.g. user not close of callablestatement in the java code).

Using:
select a.value, b.name from v$mystat a, v$statname b where a.statistic# = b.statistic# and a.statistic#= 3

How can we manually close "opened cursor" outside of the application without “kill a session”?

2)Please talk about your new book!

Thanks,
Peter Cheng


and Tom said...

1) Sorry but you cannot. Just as you could not close open files this program leaks. The program itself must fix its behavior. It would be a disaster to close some cursor before the program would actually be done with it -- how can you tell from "outside" that the cursor is obsolete? In any case, we have no facility to do that.


2) My book comes out in June 2001. It is about Developing in Oracle. It is geared towards both the DBA and the Developer with more of a developer slant. It is what I believe everyone programming against Oracle needs to know (or at least be aware of).. I cover the architecture of Oracle (the files, the memory, the processes). From there I go onto Locking and concurreny controls -- how transactions work, what happens with redo and rollback. Then I cover all of the different types of tables you can have (heap, IOT's, nested, object relational, b*tree clustered, hash clustered) and index types. Then we look at utilities such as imp/exp and SQLLDR -- trying to answer the frequently asked questions, info the utilities guide doesn't necessarily cover.

Application Tuning and Optimizer plan stability are covered next. My approach to tuning is a little different I think. You won't see "buffer cache hit ratio" mentioned once -- but you'll know how to make sense of the Oracle trace file and tkprof reports by the time you are done. I focus on application tuning (whereas most other books seem to focus on database instance tuning). I find 80% or more of the payback in tuning comes from there -- that is where I start.

The next section of the book goes into advance sql features where I discuss and show how to use

o analytic functions
o materialized view
o partitioning
o autonomous transactions
o dynamic sql (from a plsql point of view)

The I get into extensibility:

o intermedia text
o C based external procedures
o Java external procedures (java stored procs)
o Using object relational features

And finally some security related topics:

o Fine Grained Access control
o N-Tier authentication
o Invokers/Definers rights procedures (what it means and when to use them)

The last part is a pretty large appendix where I cover many of the supplied packages -- not in the sense that the supplied packages guide covers them, i expect you'll refer to that for the list of all functions and their inputs/outputs -- rather here I show how I use them, covering only the packages I find relevant (and haven't already covered earlier). About 18 packages in all....



Rating

  (8 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Bala, May 07, 2001 - 10:01 am UTC


Bala, May 07, 2001 - 10:02 am UTC


Peter, May 07, 2001 - 6:04 pm UTC

Good Jobs and Thanks for your efforts.

Excellent

Narendra, July 01, 2001 - 10:13 pm UTC

Hi Tom
Congratulations ,Really you are doing a great job,keep it up.
Awaiting your next Book .

Your Book

R.Ganguli, August 20, 2001 - 4:00 pm UTC

Tom,

I finished your book, and it cleared up many of my doubts, it's one of the best. I am going to go through it a second time. Why don't you write a book for the DBA's with more details on the internals, latches , File Systems , RAIDs etc.

Thank you
Ran

Tom Kyte
August 20, 2001 - 4:37 pm UTC

Have you read Jonathan Lewis's book -- its pretty great:

</code> http://www.amazon.com/exec/obidos/ASIN/0201715848 <code>
...

Book details

Abdal-Rahman Agha, October 21, 2001 - 7:01 am UTC

I still have no info about your book. Please, can write specific details about your book so that I can request it from the bookshop that has it. e.g, the ISBN, the Title, the Price, the Bookshop that is the book available in.

Thanks.

Tom Kyte
October 21, 2001 - 9:10 am UTC

just goto </code> http://asktom.oracle.com/ <code>

A link into amazon that provides all of the above is there (well, except for the bookshop, I don't know what bookshops there are in Yemen)

OK

Roselyn, April 09, 2004 - 3:12 am UTC

Hi Tom,
How concurrency control is achieved in Oracle?could you
please explain in simple words?
Bye!


Tom Kyte
April 09, 2004 - 7:45 am UTC

one word:

multi-versioning


read the concepts guide, especially:

</code> http://docs.oracle.com/docs/cd/B10501_01/server.920/a96524/c21cnsis.htm#2414 <code>


Cusor leak problem for implicit cursor

Purushotham, January 10, 2005 - 3:53 am UTC

Hi Tom,

Thanks for taking time to answer our questions. You site is one stop for me. I have encountered a problem recently. DBA logged an issue for memory leak. But most of the queries I found over there are implict cursors.

1. How could Implicit cursors be tagged as memory leaks ?

2. Below is the query they use to find the memory leaks

select
oc.sid sid,
oc.hash_value hash,
s.module module,
oc.sql_text text,
count(*) count
from v$open_cursor oc , v$session s
where s.sid = oc.sid
group by oc.sid,oc.hash_value,oc.sql_text,s.module
having count(*) > 5
order by 4;

I am confused about whether this query is the right one to find out memory leaks. Please throw some light on this.

Tom Kyte
January 10, 2005 - 8:49 am UTC

they are not being leaked, they are being cached by plsql, they will be released if the slots are needed.


</code> http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:3512824755435 <code>



More to Explore

VLDB

If you are new to partitioning, check out Connor McDonald's introduction series here.

VLDB

Documentation set on VLDB and Partitioning.