(V8.X) OPEN_CURSORS 파라미터를 매우 크게 잡을 경우 고려할 사항

제품 : ORACLE SERVER
작성날짜 : 2003-06-02
(V8.X) OPEN_CURSORS 파라미터를 매우 크게 잡을 경우 고려할 사항
==============================================================
PURPOSE
이 자료는 initSID.ora file에서 지정 가능한 OPEN_CURSORS parameter에
대한 설정과 open 상태의 cursor를 memory에서 release시키기 위한
방법에 대한 내용이다.
Explanation
OPEN_CURSORS 파라미터의 default 값은 50이나, 경우에 따라서 이 값을
매우 크게 잡게 될 경우 영향을 미칠 수 있는 점과 cursor가 commit 후에도
open 상태로 있는 것을 방지할 수 있는 방법에 대해 알아보기로 한다.
1. OPEN_CURSORS = n
이 파라미터는 한 session이 한번에 open할 수 있는 cursor의 최대 갯수이다.
이 값이 1이 증가할 때마다 약 25bytes를 fixed UGA를 사용하므로, 이 값이
너무 크면 oracle의 memory 성능을 저해시키는 요인이 될 수 있다.
OPEN_CURSORS=1000 으로 설정하였을 경우 25 * 1000 = 25Kbytes 크기의 연속된
영역을 메모리에 할당하게 되는 것이다. 만약 MTS로 운영 중이라면 session의
UGA 정보는 PGA가 아닌 SGA에 저장이 된다는 것을 고려해야 하므로,
한 session의 cursor를 위한 영역을 할당하기 위해 shared pool에 cache되어
있는 다른 object에 영향을 미치면서까지 cache되어야 한다면 OPEN_CURSORS
파라미터를 줄이는 것이 바람직하다.
2. CLOSE_CACHED_OPEN_CURSORS = TRUE
PL/SQL 내에서 CLOSE CURSOR를 하지 않았지만, COMMIT은 자주 수행하도록
되어 있다면 process가 kill되거나 하면 session이 끊기면서 cursor는
자동으로 close되겠지만, close cursor를 했다 하더라도 cursor가 즉시
release되지 않는 경우가 있을 수 있다.
이 cursor가 자동으로 memory에서 release되는 time을 예측할 수 있으면
좋겠지만, 그렇지 못한 경우 아래와 같은 파라미터를 initSID.ora 화일에
셋팅해 놓으면 PL/SQL 또는 Pro*C 와 같은 application 내에서 commit 또는
rollback을 수행하면 cursor는 자동으로 close가 된다.
close_cached_open_cursors = true
즉, cursor를 memory에서 빨리 release시키는 것이 목적이라면 위와 같이
파라미터를 셋팅하는 방법도 있다는 것이다.
이 파라미터가 false로 되어 있다면 동일한 형태의 연속적인 executions가
새로운 cursor를 open할 필요가 없도록 하기 위하여 PL/SQL에 의해 open된
cursor를 open 상태 그대로 유지하겠다는 것을 의미한다.
이 파라미터에 대한 보다 자세한 내용은 다음과 같다.
PL/SQL을 사용할 때 해당 procedure에서 참조하는 object에 대해 그 안의
cursor들이 memory에 cache되어 있는데,
commit 또는 rollback이 일어날 때 이 cursor들이 자동으로 close되도록 하는
역할을 한다.
즉, transaction 단위로 close한다. (commit, rollback)
그러나, 이 값이 true로 되어 있으면 latch bottle-neck이 발생할 수 있으므로,
true로 할지 false로 할지에 대해 신중하게 값을 결정해야 한다.
만약, application 내에서 재사용의 빈도가 매우 높은 SQL 문들을 사용한다면
memory 내에서 현재 수행 중인 object에 대해 그 object를 참조하는 cursor가
close되는 것이 좋지 않으므로, 이 값을 false로 설정해 두는 것이 바람직하다.
3. SESSION_CACHED_CURSORS = N
과거에 session_cached_cursors=n 이라는 파라미터도 존재했었다.
session_cached_cursors 파라미터는 oracle server V7.1까지만 존재하는
파라미터이다.
이 파라미터에 지정한 갯수는 한 session 동안 open된 상태로 cache에 유지할
수 있는 cursor의 갯수이다.
4. Pro*C 또는 PL/SQL 내에서 COMMIT WORK RELEASE;
commit 을 수행하면 현재 수행 중인 transaction을 종료시키고, db에 그 시점
까지의 변화들을 반영시키는 작업이 일어나고, 사용 중이던 resource들을
반환한다.
PL/SQL 내에서는 commit을 했다 하더라도 아직 END가 완벽하게 마무리 된
것은 아니므로, COMMIT WORK RELEASE; 를 해주면 모든 resource들을 free
시키고 해당 session은 database로부터 disconnect하게 된다.
참고로 8.1.5 부터는 commit force; 라는 명령이 있는데
이것은 current transaction만을 commit 시키는 option이다.
5. CURSOR_SPACE_FOR_TIME = TRUE
이 파라미터는 shared SQL 영역의 object를 참조하는 open cursor가 있는 한,
해당 object는 항상 shared pool에 keep시키는 역할을 한다.
Example
none
Reference Documents
<Note:30781.1>
<Note:1009170.6>
Oracle8i Designing and Tuning for Performance

Similar Messages

  • How to increase dynamically open_cursors and session_cached_cursors

    how to increase dynamically open_cursors and session_cached_cursors
    for Ex. alter system open_cursors = 500

    instane level:
    alter system set session_cached_cursors=200 scope = spfile; or set init.ora file.
    alter system set open_cursors=400;
    More details about open_cursor and session_cached_cursor, refer the below link
    http://www.orafaq.com/node/758
    Regards
    RajaBaskar

  • Open_cursors and session_cached_cursors!!

    Hi, all.
    I have a 2 node RAC database (10.2.0.2.0) on windows2003 EE SP1.
    Recently, I am getting warnings related to "library cache lock" and "cursor: pin S wait on X" wait event.
    The recommendation from ADDM findigs is as follows.
    -- increase open_cursors
    -- increase session_cached_cursors
    The above parameters are dynamic ?? or do I need to restart the instances??
    Thanks and Regards.

    set linesize 121
    SELECT name, isses_modifiable, issys_modifiable
    FROM gv$parameter
    WHERE ....;

  • Changing value for open_cursors

    Dear All,
    I have changed the value for this parameter in a customized init.ora file which I give during the startup of the Database like this :
    startup open pfile=/software/initkbdev.ora
    I want to change the value for this permanently in the database.
    When I give the following command :
    startup open
    the value goes back to the previous one.
    How to make this change permanent ?
    How should I solve this ?
    Thanks in advance.
    Regds..Ramakrishnan

    Hi,
    If you startup your database with the right init.ora file, the open_cursor value in v$parameter can't "go back to his previous value".
    Check if you modify the right init.ora file.
    Fred

  • How to inclease open_cursors in oracle?

    Hi, someone give me hands,please.
    I want to change oracle parameter "open_cursors" from default value of it.
    Where is init.ora file in oracle 10g database?
    Let me know.

    You can't have my hands, and it sounds like you should probably talk to the person who set the system up, if that is an option. This is probably one of the most basic of database administration tasks. If you don't know how to do this, you probaby shouldn't be working on a production system (assuming you are).
    Second, you probably want to make sure you really need to do this. The default value is 50 cursors per session. Not for the whole instance, that's for each session. Does your application really need to hold more than 50 cursors open in each database session? Or is it leaking cursors (as I suspect)?
    If you truly must change this value, try this while logged into SQL*Plus as SYSDBA:
    SQL> alter system set open_cursors=<new_value> scope=both;
    If that works, you are using SPFILE, which means that the initialization parameters are dynamically managed.
    If that returns "ORA-32001: write to SPFILE requested but no SPFILE specified at startup" then you are using init<sid>.ora files. You may have a file in $ORACLE_HOME/dbs (Linux/Unix) or in %ORACLE_HOME\database (Windows) called init<SID>.ora. If that is present, you can change the value for open_cursors by adding a line to that file or changing any existing setting to look like:
    open_cursors=<new_value>
    Regards,
    Jeremiah Wilton
    ORA-600 Consulting
    Recovery - Services - Seminars
    http://www.ora-600.net
    http://oradeblog.blogspot.com

  • Measuring the value of "session_cached_cursors"  and "open_cursor"

    Friends ,
    Recently In my Database production server Oracle10g (version : 10.2.0.1.0.), I got the "open_cursor" and "session_cached_cursors" related error where OEM asks to increase the value . I have increase the value but the problem still is not solved .
    Can anybody plz tell me , how can I measure the Standard value of "open_cursor" and also "session_cached_cursors" of my database server ?
    Another question ,
    SQL> show parameter open_
    NAME TYPE VALUE
    open_cursors integer 500
    In above output , what is the unit of 500 value . Is this value related with the SGA memory area ?

    shipon_97 wrote:
    Thanks all for reply ..
    I have another query ...
    How can I find the standarnd value of "open_cursor" as well as "session_cached_cursors" parameter value in the respect of my oracle database server . And what are the recommended value of these parameters . I am using oracle database 10g (v-10.2.0.1.0 ) .Shipon,
    You can see the values of the parameters in your db with the simple show parameter command,
    >
    show parameter open_cursors
    show parameter session_cached_cursors>
    About the settings of the parameters and their optimal value, I guess there wont' be any "concrete" answer to that. Session cached cursors is set to 50 default in Oracle which means 50 cursors can be marked as 'hot cursors' for the the system and will be avoided from the library cache lookup. This also has a condition that the cursor will be marked as hot only when its run for 3 times. So you need to check back with your system that how many queries are actually requiring this optimization. And more over, this is used or said to be used when you are seeing a Library Cache Latch contention. I don't think that just for the sake of change, you need to modify the parameter from default.
    The smae is true for the OPEN_CURSORS as well. The value is required to be changed if you are seeing an error about maximum opened cursor exceeding from the set value. Generally , a value of 2000 is enough for most of the systems but again, that may depend on site to site and surely enough , you need to check yours befoe playing around.
    HTH
    Aman....

  • What is the maximum size for open_cursors parameter in 11g database

    what is the maximum size we can set for open_cursors parameter in 11g database..

    Oracle® Database Reference
    11g Release 1 (11.1)
    Parameter type     Integer
    Default value     50
    Modifiable     ALTER SYSTEM
    Range of values     0 to 65535
    Basic     Yes
    For details, go to the following link:
    http://www.seasongreetings.org/documentation/oracle/database/11.1/server.111/b28320/initparams153.htm

  • How to choose  optimal value for  the OPEN_CURSOR parameter in init.ora?

    15:05:35 SQL> select count(*) from v$open_cursor;
    COUNT(*)
    5159
    15:06:28 SQL> select count(*) from v$open_cursor WHERE user_name='USER1';
    COUNT(*)
    2369
    15:06:48 SQL> select count(*) from v$open_cursor WHERE user_name='USER2';
    COUNT(*)
    686
    Currently, application using these number of open cursors?
    How to set the optimal value for this application?

    Hi,
    >>With the above setting I have yet to get any errors due to cursor limits. A good trade off memory v issues.
    To see if you have set OPEN_CURSORS high enough, monitor v$sesstat dynamic performance view using the SQL below for the maximum opened cursors. If your sessions are running close to the limit, maybe you should increase the value of OPEN_CURSORS.
    select max(a.value) as highest_open_cur, p.value as max_open_cur
    from v$sesstat a, v$statname b, v$parameter p
    where a.statistic# = b.statistic#
    and b.name = 'opened cursors current'
    and p.name= 'open_cursors'
    group by p.value;In addition, I advise you to take a look at your PL/SQL code in order to see if the explicit cursors have been close (if it was the case), or if your SQL code can be tuned ...
    Cheers
    Legatti

  • ORA-00064 after changes processes, open_cursors in Oracle 10g Express

    Hi,
    I just run the following sql statements:
    alter system set processes=400 scope=spfile;
    alter system set open_cursors=5000 scope=spfile;
    After restart my computer, I can't connect to the oracle and in oradim.log i see the following error:
    ORA-00064: object is too large to allocate on this O/S (1,7999480)
    Any idea why and how can i solve it?
    Thanks a lot!

    Hi,
    Thanks for your help.
    I just open SQL and insert the following statement:
    create pfile from spfile;
    and i got the following error:
    SP2-0640: Not connected
    when i try to connect using conn user/pass@XE i got:
    ORA-12514: TNS:listener does not currently know of service requested in connect
    descriptor
    any idea?

  • What is table SYS.V_$OPEN_CURSOR for?

    I guess this table is used to record the info. of currently opened cursor, both explicit and implicit. But, somehow I found that the corresponding record in this table will not be deleted as soon as I close a explicit cursor using CLOSE command in a PL/SQL program block. Also, the record still remains after a function is executed if the cursor is declared in that function. Can any one tell me why?

    This is new optimitization of Oracle 8.1.6 database.
    Whit Oracle 8.1.5 when you close the cursor (JDBC or others) it automtically disappear from v$Open_cursors, but with 8.1.6 it still open in the database until the connection is closed.
    Best regards, Marcelo.
    null

  • Open_cursor problem

    hi there,
    I am trying to increase the parameter open_cursors for the database, initially it was 100 and now i made it to 500, but now when i try to start the database it gives me error post initialization failed.
    I feel i need to set some OS parameter. I am using Sun Solaris 2.6.
    May be if anybody knows, please let me know.
    I will really appreciate it.
    Thanks in advance.
    Amit

    Hi Amit,
    open svrmgrl
    connect internal/passwd.
    shutdown database.
    edit init.ora file and add open_cursor = 500.
    startup mount <db_name>;
    alter database open;
    type: show parameter open_cursors;
    you should see the new value.
    null

  • Location of db_block_size , Open_cursors

    Gurus,
    The small question.
    Where shoud I go to look for db_block_size and Open_cursors?
    Thanks.

    In file init<SID>.ora

  • Is open_cursors per session or user?

    I'm getting a lot of ORA-01000 in error logs on my app servers. 8i documentation states that:
    "OPEN_CURSORS determines the maximum number of cursors per user."
    but I suspect this is a typo and should be per session, an extremely relavant difference when multiple app servers are connecting to DB w/common username.
    does Oracle actually track open cursors across all active sessions for a given username or is it per session like most parameters?

    It must be per session,
    You can resolve the problem by increasing the parameter to 2500 as it cotrolls maximum allowed.

  • Question about v$open_cursor

    I see cursors that are open in v$open_cursor that are run from stored procedures which have finished running.
    how long do cursors stay open?

    Thanks jonathan
    so if I set the max open cursors parameter. Is this
    based on v$open_cursor records? Said that an open
    cursor is a lock?
    Open cursors take space in the SGA - an x$kgllk entry (which you see as a v$open_cursor entry) and a local "array" or pointers to the SGA.
    Based on 9.2.0.6
    If you set open_cursors, you can hold that many cursors open explicitly before getting an error (ORA-01000 to many cursors). Each held cursor corresponds to an entry in v$open_cursor. Each held cursor takes an entry in a local array.
    If you set session_cached_cursors, you can find that many cursors have been implicitly held open - again you will find an entry in v$open_cursor for each cursor, and there is a DIFFERENT local array used to point to these entries in v$open_cursor.
    Once session_cached_cursors is set, however, pl/sql can also hold cursors open implcitly. At this point I get a little uncertain, but I think
    a) You still see the entries in v$open_cursor
    b) The number that may be held is set by session_cached_cursors but
    c) The local array used is the one associated with the open_cursors parameter but
    d) A pl/sql cursor that is being held open will be closed if the local array is full and you need to explicitly hold a new cursor. (i.e. pl/sql cursors can't cause ORA-01000 to happen).
    What kind of lock is it? What is being locked?
    This is another place where the terminology gets vague - for library cache objects you have both LOCKs and PINs - and the word lock is a little ambiguous because you are allowed a null lock (i.e. non-locking lock). The lock "registers and interest" in a chunk of the library cache - such as the text of an SQL statement that has been loaded. The pin is used to ensure that an object is not destroyed while someone is using it.
    So an open cursor is a lock on the structure that holds the statement in the library cache. When you want to execute the statement you have to acquire a pin on the 'executable code' (which includes the execution plan) for that statement.
    If you want to investigate locks and pins in the shared pool, there is a script called catblock.sql in $ORACLE_HOME/rdbms/admin which gives you some notes and creates a couple of views over the relevant objects.
    So lets say I have a cursor that is compiled in
    memory with bind variables. A new session needs to
    use that sql statement. It then aquires some form of
    lock, which leads to a record in v$open_cursor which
    represents its open cursor.
    That's about it.
    Then, every time the session executes the statement, it has to acquire a pin to execute it, and release the pin afterwards
    is that correct? The only thing I don't understand is
    the lock.Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk

  • Open_cursor ,cursor_sharing..

    plz i need the details abt open_cursor ,curssor_sharing .....parameters.. ..in detail

    open_cursor - number of cursors referencing private sql area allocated to user process.
    cursor_sharing- can help the users share the parsed code
    regards

Maybe you are looking for

  • Some albums don't appear in finder (Pictures)

    For some reason not all of my albums from iphoto appear in my "Pictures" folder in the finder. About 3/4 do, but not all. I have made sure that I haven't used any odd characters, etc. Is there a way to ensure they appear. That seems to be the best wa

  • Iphone4 will not sync, back up file corrupt

    During the sync process my iphone was accidentally disconncted.  After restarting my computer and trying to again sync I received an error message stating the the back-up file is corrupt.  I followed the procedure to delecte the corrupt file and have

  • HTTP_RESP_STATUS_CODE_NOT_OK: Error 200

    Hi All, I am doing a scenario in XI as follows; r/3--- [Idoc] -> XI -http-->APO The r/3 to XI is working perfectly and to send to APO I am using XI adaptor with HTTP transport protocol. But I am getting the following error. <SAP:Code area="INTERNAL">

  • Iphone 5 stuck in recovery mode error 1603/4

    received apple update on iphone, clicked ok and phone switched of and asked to connect to itunes,conncected to itunes and stated phone in recovery mode and to restore phone but every time i do this it just says it cant do it and gives error code 1604

  • AS10g installation suggestions needed

    i want to install Oracle AS10g for J2EE. I want to know if i have to install oracle infrastrucure first ? i need AS 10g only for my J2EE app's.