You were brought to this page based on an internet search
and as a free service to Oracle DBAs.
The text below is an except from the book,
Oracle Performance Firefighting, written by
Craig Shallahamer of
OraPub, Inc.
Figures and tables are not included on this page, only their reference.
To order the book in either print or PDF form, click
here.
©2009, 2010 by Craig Shallahamer. This is copyrighted material.
PleaseOut of respect for those involved in the creation of the book and also for
their familes, we ask you to respect the copyright both in intent and deed. Thank you.
-------------------------------
When a cursor is closed, Oracle does not simply deallocate all three of these cursor components. Rather, Oracle may deallocate the cursor components as it deems necessary; for example, if the memory is needed elsewhere.
The first time a cursor is executed, there is actually a parent cursor and a child cursor. Subsequent sessions, and even the same session executing the same exact SQL statement (that is, the hash value is the same), may require a different child cursor. While the SQL statement will be textually exactly the same, a child cursor is created to capture specific characteristics, such as optimization mode differences (for example, first_rows) resulting in different execution plans or different session-level parameters (cursor_sharing=similar). To demonstrate this, Figure 7-1 shows a simple situation where the same session executed the same SQL statement twice with a simple alter session in between the two executions. This is enough to force an additional child cursor to be created. The trace command is used to prove two child cursors are created.
Figure 7-1. Shown is the same session running the same SQL statement with a simple alter statement between executions. This is enough to force Oracle to create two child cursors. The trace statement is used to prove two child cursors are created.
©2009, 2010 by Craig Shallahamer. This is copyrighted material.
PleaseOut of respect for those involved in the creation of the book and also for
their familes, we ask you to respect the copyright both in intent and deed. Thank you.
|