Question of PGA

Hello

Oracle 11.2.0.3.0

I have memory_target = 15G

That is why in the database, pga_aggregate_target = 0

But I can see from v$ pgastat, aggregation PGA target = 5637144576 parameter = Mo 5673 .

Statspack shows

Statistical memory Begin End

~~~~~~~~~~~~~~~~~                ------------ ------------

Host Mem (MB): 31,440.3 31 440,3

Use of LMS (MB): 15,291.4 15 291,4

PGA use (MB):                          1,722.1      1,698.8

Host % Mem used for SGA + PGA: 54.0 54.1

PGA Aggr target histogram DB/Inst: PIVR01/PIVR01 snaps: 8610-8612

-> Optimal performances are purely in memory operations

High low

Execs Total optimum optimum optimum Execs 1 pass Execs M-Pass Execs

------- ------- -------------- ------------- ------------ ------------

2K      4K                     5,036          5,036            0              0

64K    128K                       14               14            0              0

128K    256K                      78              78             0              0

512 K 1024 K 174 174 0 0

1M      2M                      164            164            0              0

4M      8M                           4               4             0              0

256M 512M                      2               1             1              0

     1G      2G                             2               0             2              0


Memory PGA Advisory DB/Inst: PIVR01/PIVR01 end Snap: 8612

--> When using automatic memory management, choose at least a value of pga_aggregate_target

where Estd PGA Overalloc Count is 0

Estd estd Extra

AGGR PGA W/A MB time Estd Estd PGA PGA

Target size W/A MB read/written to deal with Cache Overalloc

Factr EST (MB) treated disc bytes (s) % number of access

---------- ------ -------------- -------------- ---------- ------ ----------

672 0.1 427 978 214.7 522 063 45.0 3 481

1 344 0.3 427 978 514 547 213,0 45.0 3 320

2 688 0.5 427 978 90 681 117.2 83,0 0 * advised a minimum size to fit all executions in memory        

4 032 0.8 427 978 84 797 115.9 83,0 0

5 376 1.0 427 978 115,3 82 105 84.0 0 * size current target which we fail to

6 451 1.2 427 978 114,0 76 674 85.0 0

7 526 1.4 427 978 114,0 76 674 85.0 0

8 602 1.6 427 978 114,0 76 674 85.0 0


1. why PGA memory grows no more than 2 GB to cope with this and be able to run the SQL all in memory, even if the target is set at 5673 MB?

2. do I need to manually set pga_aggregate_target = 2688 M with memory target = 15 G?


Thanks for your time

1938071 wrote:

I got your point, but the bottom implies that there is 2 SQL executions which do not completely held in memory of the PGA and must be partially exchanged on temporary slow disk. The size of the book that does this is between 1-2 GB.

So if I 5673 MB allocated total setting target PGA in v$ pgastat, why is he not use it... This part confuses me

Target histogram Aggr PGA

-> Best executions are purely in memory operations

High low

Execs Total optimum optimum optimum Execs 1 pass Execs M-Pass Execs

------- ------- -------------- ------------- ------------ ------------

2K      4K                     5,036          5,036            0              0

64K    128K                       14               14            0              0

128K    256K                      78              78             0              0

512 K 1024 K 174 174 0 0

1M      2M                      164            164            0              0

4M      8M                           4               4             0              0

256M 512M                      2               1             1              0

     1G      2G                             2               0             2              0

The pga_aggregate_target did NOT previously assigned, it is a (soft) limit on the total memory that can be allocated dynamically. Given that you have defined the memory_target to 15 GB, Oracle can only grow the total allocation of the PGA to 5G by reducing the rest of its endowment (in large part the shared pool and the buffer cache) to 10 GB.

It is a necessary part of the algorithm of automatic memory management that it would decide if the time saved by the growth of the component of the PGA is greater or less than the time lost by the decline of the shared pool and the cache buffers.  You could imagine that doing a few GB of bed and writes temporary files for one or two is probably much faster that 2 GB buffer cache dumping and ending with a large number of random to block reads as a side effect.

-If you have a CPU bottleneck then hit a very large size on disk may be the best use of resources: large sorts in memory can we a lot of CPU.

Concerning

Jonathan Lewis

Tags: Database

Similar Questions

  • WHY THE PGA IS REQUIRED FOR EACH USER?

    Hello everyone;

    I have a question about PGA.

    WHY THE PGA IS REQUIRED FOR EACH USER?

    What I got from google...

    Even if information analysis of SQL or PL/SQL is already available in the library of shared pool cache,

    the value that the user want to execute the statement select or update cannot be shared.

    I can't realize that someone can show an example of clear, if possible?

    DB version is 10.2.0.4.0

    OS: oracle linux 5.5

    Thanks in advance...

    PGA is memory private belonging to a specific user. This private memory contains of these pieces that is not supposed to be shared with others. For example, when you sort a part of the data, that does not mean all he wants too. If Oracle retains the sorted data requested by you in your own PGA. Similarly, if you want to query a table with a value of 10, it does not mean that all want the same thing. If these structures are stored in the PGA. For a more detailed description, read the link given by Hoek.

    HTH

    Aman...

  • question about the use of the PGA and TEMP

    Hello
    We had a situation whereby OEM reported that because the PGA was too small for a period of time that e/s additional on the TEMP was created. So does that mean that the TEMP has acted as a pseudo PGA.

    concerning

    Take a look at these threads
    Re: Problem with memory PGA - Oracle 10.2.0.4 on windows 2003
    Re: Details on using in the memory of the PGA



    Oracle database FAQ

  • A few questions about the upgrade on Satellite A300-144

    Sorry for the typos, English is not my mother tongue.
    I want to ask some questions about the upgrade of a300-144.

    * Some info first.*

    CPU: T2370 ([http://ark.intel.com/products/34445/Intel-Pentium-Processor-T2370-1M-Cache-1_73-GHz-533-MHz-FSB]).
    Chipset: GM965 ([http://ark.intel.com/products/29821/Intel-82GM965-Graphics-and-Memory-Controller]).

    * Questions.*

    1. my frequency of laptop memory at 533 MHz, supports 667 MHz memory controller, memory modules can work at 667 MHz. Is - this because CPU FSB 533 MHz frequency and new processor at 667/800 MHz FSB will fix it or it is hardcoded in the BIOS?

    2 Intel said that the size of max memory for my chipset is 4 GB (2 x 2 GB), but Toshiba says that only 2 GB (2 x 1 GB), who is right?

    3 I know, taken of my CPU is μFCPGA-478 aka socket P, max FSB 800 MHz, max 35 W TDP, so T9500 ([http://ark.intel.com/products/33918/Intel-Core2-Duo-Processor-T9500-6M-Cache-2_60-GHz-800-MHz-FSB]) is a compatible processor or there are some limitations in the BIOS?

    > 1. My frequency of laptop memory at 533 MHz, supports 667 MHz memory controller, memory modules can work at 667 MHz. Is - this because CPU FSB 533 MHz frequency and new processor at 667/800 MHz FSB will fix it or it is hardcoded in the BIOS?

    The speed of the memory is related on the material. This means that the FSB is responsible for the limitation.
    If the FSB would allow support 667 MHz then the memory would also at this speed.

    > 2. Intel says that the size of max memory for my chipset is 4 GB (2 x 2 GB), but Toshiba says that only 2 GB (2 x 1 GB), who is right?
    The memory depends on the chipset. So if the chipset supports 4 GB of RAM, you should be capable of this move to 4 GB of RAM

    > 3. I know, my CPU is? FC-PGA-478 aka socket P, max FSB 800 MHz, max 35 W TDP, so T9500 (http://ark.intel.com/products/33918/Intel-Core2-Duo-Processor-T9500-6M-Cache-2_60-GHz-800-MHz-FSB) will be a compatible processor or there are some limitations in the BIOS?

    It might be possible that the new processor would be fully supported by the BIOS, but in most cases it should not be a problem if the chipset would support the new processor.
    But as far as I know the upgrade of the CPU is not supported by Toshiba or any other manufacturers of portable and its your own risk to run laptop with the new processor.

  • Try to download "PGA 96 Tour for Win 95 (PC)" on 64/32 bit Win 7 OS. This is dwnldd, installed and wants to start. What do I need 4 this and other older programs? I can? That I should?

    Try to load a "E A Sports PGA Tour 96 for Win 95" on a new OS Win 7 32/64 6 G memory.  It wants to start but where and or what is a good method to try to get older programs to work with newer systems?  Some I know, some I Can not - Smart Rocker

    What system you have 32-bit or 64-bit?

    32-bit and 64-bit Windows: frequently asked questions
    http://windowshelp.Microsoft.com/Windows/en-us/help/41531554-d5ef-4f2c-8fb9-149bdc5c8a701033.mspx

    List of limitations in 64-bit Windows
    http://support.Microsoft.com/default.aspx/KB/282423#appliesTo

    Have you tried right clicking on the shortcut to the game program, or the .exe and select "Run As Administrator"?  Perform, even if your user name is an administrator.

    Make older programs in this version of Windows (Windows 7)
    http://Windows.Microsoft.com/en-us/Windows7/make-older-programs-run-in-this-version-of-Windows

    Help with Windows 7 compatibility issues
    http://Windows.Microsoft.com/en-us/Windows7/help/compatibility

    Windows 7 Compatibility Center
    http://www.Microsoft.com/Windows/compatibility/Windows-7/en-us/default.aspx

    Windows Virtual PC
    Download Windows XP Mode
    http://www.Microsoft.com/Windows/Virtual-PC/Download.aspx

    Windows XP Mode (Windows 7 only, but not one of the Home versions) "you are not eligible to download Windows XP Mode. You must have Windows 7 Professional, enterprise or full to run Windows XP Mode."

    Virtual PC 2007
    http://www.Microsoft.com/downloads/details.aspx?FamilyId=04d26402-3199-48A3-afa2-2dc0b40a73b6&displaylang=en&TM

    Virtual PC 2007 running on Windows 7
    http://blogs.msdn.com/virtual_pc_guy/archive/2009/08/19/running-Virtual-PC-2007-on-Windows-7.aspx

    This warranty covers the gambit set of VMS in the 'Home' versions if you want to have a look.  Of course you will need a licensed copy of XP to install and run in any of them (except XP Mode).

    VirtualBox is an impressive VM competitor
    http://WindowsSecrets.com/search/?CX=017937947691920082874%3A_ilcm6kdy_y&COF=FORID%3A11&q=VirtualBox+is+an+impressive+VM+contender+&SA=search&advWS=1&advSAN=1&advPages=15

  • What are the differences between pga memory max session and pga session in memory?

    Hi all

    What are the differences between pga memory max session and pga session in memory?

    SELECT s.sid, n.name, s.value FROM v$ sesstat s, v$ statname n

    WHERE s.statistic # = n.statistic #.

    AND n.name = 'pga session in memory. "

    SELECT s.sid, n.name, s.value FROM v$ sesstat s, v$ statname n

    WHERE s.statistic # = n.statistic #.

    AND n.name = 'pga memory max session ";



    Note that I have read the documentation. However, it is not clearly explained.


    Thank you

    John Stegeman wrote:

    I agree with the comments of the Ed, NightWing.

    You do not have a story to ask questions that are clearly answered in the documentation.

    Mind your own business. If you answer the question, so answer! Otherwise, please stop the thread engrossing.

  • Metrics PGA Cache Hit %

    Hi gurus,

    I'm on 10.2.0.4.0 and receive regularly the Metrics PGA Cache Hit percent alert through OEM. Could you please guide me in the identification of the question if these OEM alerts are stopped.

    Kindly let me know what you would need more information.

    SQL > Show sga

    Total System Global Area 6442450944 bytes
    Bytes of size 2093584 fixed
    3640659440 variable size bytes
    2785017856 of database buffers bytes
    Redo buffers 14680064 bytes
    SQL > Show parameter pga

    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    whole large pga_aggregate_target 1500M

    Thanks for your time and your help.

    Kind regards

    DBApps

    DBApps wrote:

    Hi gurus,

    I'm on 10.2.0.4.0 and receive regularly the Metrics PGA Cache Hit percent alert through OEM. Could you please guide me in the identification of the question if these OEM alerts are stopped.

    Kindly let me know what you would need more information.

    SQL > Show sga

    Total System Global Area 6442450944 bytes
    Bytes of size 2093584 fixed
    3640659440 variable size bytes
    2785017856 of database buffers bytes
    Redo buffers 14680064 bytes
    SQL > Show parameter pga

    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    whole large pga_aggregate_target 1500M

    Thanks for your time and your help.

    Kind regards

    DBApps

    I just want to turn off the alert in OEM.  It warns you of a non-issue.  I'd be more concerned about the fact that you are using an old version, not supported in Oracle.

  • memory of the PGA

    Hi all

    SQL uses memry SGA and collections use PGA in memory only. Is this true?

    Select * twice;

    The sql above must use SGA and PGA together?

    One of SGA components is shared pool. That is your executable version of SQL and PL/SQL. So each SQL uses SGA. SGA is global. Once the executable version of SQL (cursor) is stored in the Shared Pool its accessible through the session.

    On the other hand, PGA's private memory. Its accessibility is limited at the level of the session. That a single session stores in is not visible to the other session. One of the aims of PGA is to store values of Bind.

    Consider this

    Select * from emp where empno: =: emp_no;

    Here emp_no is a variable binding

    The executable version (cursor) to the SELECT statement is stored in the pool shared the SGA. And the value of the Bind variable to: emp_no is stored in the PGA.

    When several session execute the same SQL from different link so the executable (cursor) is shared between the session, while the value of the bind variable is kept secret to each session of the value of the variable.

    When you talk about specific DOUBLE, you must remember DUAL is a very special table and its treaties very differently considered an ordinary table. For example, if you do not select the column DUMMY table DOUBLE then 10g on oracle will not go for a table scan, which means that it will not be a real IO. He'll make a QUICK DOUBLE. Here is an example.

    SQL > set autotrace traceonly explain
    SQL >
    SQL > select * from double;

    Execution plan
    ----------------------------------------------------------
    Hash value of plan: 3543395131

    --------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT |      |     1.     2.     2 (0) | 00:00:01 |
    |   1.  TABLE ACCESS FULL | DOUBLE |     1.     2.     2 (0) | 00:00:01 |
    --------------------------------------------------------------------------

    SQL > select 1 double;

    Execution plan
    ----------------------------------------------------------
    Hash value of plan: 1546270724

    -----------------------------------------------------------------
    | ID | Operation | Name | Lines | Cost (% CPU). Time |
    -----------------------------------------------------------------
    |   0 | SELECT STATEMENT |      |     1.     2 (0) | 00:00:01 |
    |   1.  QUICK DOUBLE |      |     1.     2 (0) | 00:00:01 |
    -----------------------------------------------------------------

    Your next question

    Why use the collections only PGA?

    Because they are the private component that is accessible at the level of the session. And that's why they are stored in the PGA. Don't forget no SGA is global and PGA is local. And this is the reason why the PGA is considered very expensive area and its need to be used properly. And it's one of the reasons why the collection should be used with great caution.

  • AMM to shrink and grow the question

    Hello
    I have database 11.2.
    I know that with the help of AMM, Oracle manages sga and pga together.
    But why boom and grow (sga pools) operation impact only shared buffer and not also on the PGA Tour?
    For example, I have 5 GB of the AMM, looking for AWR, updated Oracle shared pool about 1, 9 GB, 1, 1 GB buffer (sga target around 3, 3 GB) and the results of the PGA.
    Looking for dynamic components of memory in AWR, I see only shared operation uses reduction/increase and buffer pool and not on the PGA TOUR that is not used.
    Why is that?

    Thank you.

    Mr.D. says:
    Hello
    I have database 11.2.
    I know that with the help of AMM, Oracle manages sga and pga together.
    But why boom and grow (sga pools) operation impact only shared buffer and not also on the PGA Tour?
    For example, I have 5 GB of the AMM, looking for AWR, updated Oracle shared pool about 1, 9 GB, 1, 1 GB buffer (sga target around 3, 3 GB) and the results of the PGA.
    Looking for dynamic components of memory in AWR, I see only shared operation uses reduction/increase and buffer pool and not on the PGA TOUR that is not used.
    Why is that?

    Thank you.

    That I understand your question, it is that you do not see reallocation of the PGA that you see in the SGA resizable components.

    [url http://docs.oracle.com/cd/B28359_01/server.111/b28310/memory003.htm] this article describes how the PGA is affected.
    Unless there is pressure on oracle to release the PGA memory to allocate to the SGA or vice versa, you will not see the change in the allocation of memory for PGA

  • Oracle Concepts: Query processing SQL (SGA/PGA performance)

    Hello

    I need some clarification on my understanding, assume there is a query:
    SELECT t1.c1, t1.c2
    FROM t1, t2
    WHERE t1.c3 = t2.c1
    ORDER BY t1.c1;
    The user pointed out above the query and the following steps are performed:
    Syntax Check -in PGA
    Semantic Check -in PGA
    Shared Pool Check (unsuccessful) -in SGA
    Optimization (Hard Parse) -in SGA
    Row Source Generation (Hard Parse) -in SGA
    Execution - in SGA?
    User B sends a request even and following steps are performed:
    Syntax Check -in PGA
    Semantic Check -in PGA
    Shared Pool Check (successful) -in SGA
    (Soft Parse)
    Execution - in SGA?
    First question (general):
    I thought execution happens to the LMS, but sort, hash, or bitmaps merger happens in PGA (temporary segment), then it's a subset of execution that happens in the PGA to the user?

    Second question (for user B):
    Once check the shared pool is successful, and plan/data sets are already in SGA, so sort, hash, and/or merge bitmaps happen on these sets of data to the user of the PGA B?

    Kind regards
    Ankit Rouault
    http://oraclenbeyond.blogspot.in

    NVO wrote:
    Hello

    I need some clarification on my understanding, assume there is a query:

    SELECT t1.c1, t1.c2
    FROM t1, t2
    WHERE t1.c3 = t2.c1
    ORDER BY t1.c1;
    

    The user pointed out above the query and the following steps are performed:

    Syntax Check -in PGA
    Semantic Check -in PGA
    Shared Pool Check (unsuccessful) -in SGA
    Optimization (Hard Parse) -in SGA
    Row Source Generation (Hard Parse) -in SGA
    Execution - in SGA?
    

    User B sends a request even and following steps are performed:

    Syntax Check -in PGA
    Semantic Check -in PGA
    Shared Pool Check (successful) -in SGA
    (Soft Parse)
    Execution - in SGA?
    

    First question (general):
    I thought execution happens to the LMS, but sort, hash, or bitmaps merger happens in PGA (temporary segment), then it's a subset of execution that happens in the PGA to the user?

    Execution happens in the SGA (buffer cache), but no matter what kinds of these treatment as sorting is specific session and that is why it happens in the PGA for this user.

    >

    Second question (for user B):
    Once check the shared pool is successful, and plan/data sets are already in SGA, so sort, hash, and/or merge bitmaps happen on these sets of data to the user of the PGA B?

    Yes.

    That said, you can post a link that confirms that the syntax/semantics check occur in the PGA? As far as I know this isn't really a part of the PGA because code oracle itself stock grammar and would do it.

    Aman...

  • 'overall target of auto PGA' is too small compared to the overall target of the PGA

    Hi all.

    The database is 11gR 2 (11.2.0.3) on a linux machine.

    'global setting of target PGA' is about 25 giga size.
    'overall target of auto PGA' is about 5.5 gigabytes size
    'Allocated total PGA' is about 25 giga size.
    "total PGA inuse" is about 19.5 giga size.

    According to the manual of the oracle, "total target auto PGA" means:

    Amount of memory PGA the Oracle database can use workspaces running in automatic mode. This amount comes dynamically PGA_AGGREGATE_TARGET initialization parameter value and work load current workspace and set continuously from the Oracle database.

    If this value is small compared to the value of PGA_AGGREGATE_TARGET, then a large amount of memory on the PGA TOUR is used by other components of the system (for example, PL/SQL or Java memory) and little is left for work areas. The DBA should ensure that enough memory PGA is left of workspaces running in automatic mode

    -----------------------------------------

    My question is following:

    1. what component consumes about 20 gigabytes size of the pga (total 25 giga).
    If the PL/SQL or Java memory consumes 20 giga size, isn't too compard to a total of size pga (25giga)?
    Does rely on applications? (we have procedures/packages in the database server-side)

    2. the total amount allocated (25 giga) PGA is close to "Global PGA target parameter (25giga).
    "total PGA inuse" is about 19.5 giga.

    Is that mean that data from free space of 5.5 giga size PGA?
    I'm a bit confused between 'PGA Total allocated' and 'total PGA inuse.

    ------------------------------------

    {code}

    Select name, decode (unit, 'bytes', round(value/1024/1024), value) mega_value, unit
    v $ pgastat



    aggregate the target PGA 25 600 bytes parameter
    overall target of auto PGA 5 505 bytes
    global memory related to 1024 bytes
    Total PGA inuse 19 483 bytes
    PGA total allocated 25 503 bytes
    PGA maximum allocated 53 426 bytes
    total number of freeable memory PGA 2 486 bytes
    number of processes 5 946
    Max process count 6 039
    PGA memory freed to OS 39,677,868 bytes
    Total PGA used to auto workareas - bytes
    Maximum PGA used to auto workareas 15 543 bytes
    Total PGA used for manual workareas - bytes
    Maximum PGA used for manual workareas 38 293 bytes
    during the allocation, count 3 733
    the treated bytes 17,288,505 bytes
    3 144 169 bytes read or written additional bytes
    cache hit percentage 85%
    has count 13,254,278 (total)


    {/ code}

    Thanks in advance.

    Best regards.

    Published by: 869578 on October 7, 2012 20:39

    869578 wrote:
    -----------------------------------------

    My question is following:

    1. what component consumes about 20 gigabytes size of the pga (total 25 giga).
    If the PL/SQL or Java memory consumes 20 giga size, isn't too compard to a total of size pga (25giga)?
    Does rely on applications? (we have procedures/packages in the database server-side)

    The place to look is v$ process_memory (see, for example this blog post - ignore the fact that he speaks a bug 3 years ago, the SQL to query the memory usage is the bit important to you).

    2. the total amount allocated (25 giga) PGA is close to "Global PGA target parameter (25giga).
    "total PGA inuse" is about 19.5 giga.

    Is that mean that data from free space of 5.5 giga size PGA?
    I'm a bit confused between 'PGA Total allocated' and 'total PGA inuse.

    Basically Yes, your system currently thinks only about 5.5 GB of memory that can be called on any process requiring more memory to work. When a process requests from memory (for example, sorting) it will not necessarily return at the time wherever he has done with her, because she plans to use it again in the near future. This is why the amount awarded may be higher than currently in use. If another process.

    ------------------------------------

    {code}

    Select name, decode (unit, 'bytes', round(value/1024/1024), value) mega_value, unit
    v $ pgastat

    aggregate the target PGA 25 600 bytes parameter
    overall target of auto PGA 5 505 bytes
    global memory related to 1024 bytes
    Total PGA inuse 19 483 bytes
    PGA total allocated 25 503 bytes
    PGA maximum allocated 53 426 bytes
    total number of freeable memory PGA 2 486 bytes
    number of processes 5 946

    {code}

    You have almost 6 000 live processes - and it takes a couple of MB per process just to get a few bits of SQL, is not really surprising that you have already allocated about 19 GB of memory - what is an average of 3 MB per process. You CAN see, however, that a few processes have to run away with a big piece, which is why you can watch process $ v and v$ process_memory in detail.

    Concerning
    Jonathan Lewis

  • Question about VALIDATION and EXCEPTION loop

    DB version: 11.2

    I believe the gurus here despise is committed inside loops. Due to budgetary constraints our java colleagues write code PL/SQL here. Below is an excerpt from a stored procedure that does some archive stuff.


    Question on COMMIT
    =====================
    I know is committed to the inside of the loops is bad, but I just want to know if the path that they have implemented COMMIT frequency is correct (using the number of iterations). Their intention was to commit all 200,000 records.


    Question on EXCEPTION
    ======================
    LMD like that, isn't better to have the exception block in the loop?




     
     
    select po.txn_id, po.po_id BULK COLLECT into v_txn_id, v_po_id 
    from purchase_orders po inner join txn_pkt_common tc 
    on tc.txn_id = po.txn_id
    and tc.created_date < po.last_mod_date;
    
    
    v_rec_count := 0;
    
    
    IF v_txn_id IS NOT NULL AND v_txn_id.COUNT > 0 THEN
    
    
         FOR i IN v_txn_id.FIRST .. v_txn_id.LAST LOOP
    
              v_rec_count := v_rec_count + 1;
    
              INSERT INTO purchase_orders_archive SELECT * FROM purchase_orders WHERE po_id = v_po_id(i);
    
              DELETE FROM purchase_orders WHERE po_id = v_po_id(i);
    
    
              IF v_rec_count >= 200000 THEN
              COMMIT;
              v_rec_count := 0;
              END IF;
    
          END LOOP;
         COMMIT; 
    
    end if;

    ExpansiveMind wrote:
    DB version: 11.2

    I believe the gurus here despise is committed inside loops.

    Cursor inside the lines, Yes, but this isn't a case of contemptuous, it's more to do this is to knowingly introduce a bug in your code, resulting in a possible "snapshot too old" error So, good programmers do not.

    Question on COMMIT
    =====================
    I know is committed to the inside of the loops is bad, but I just want to know if the path that they have implemented COMMIT frequency is correct (using the number of iterations). Their intention was to commit all 200,000 records.

    Q: Why is there the intention to commit all 200,000 records? What is the issue they're trying to move?

    In your example code, it is the data block collection. Is it really in collector block + 200,000 records? If so you may have a serious impact on the resources of database data are collected in the memory of the PGA, which is expensive.

    Question on EXCEPTION
    ======================
    LMD like that, isn't better to have the exception block in the loop?

    That depends on what you want to do when an exception occurs. If the exception can be 'managed' and you want to continue processing the rest of the data, then Yes, you would want an exception around the DML inside the loop block. If an exception should cause processing to stop completely, then you want the exception handler (if you really need one) out of the loop... but then you wonder again why you make inside the loop, because it is not supposed transaction.

    All of this procedure looks like this could be done with a single INSERT statement followed a single DELETE statement, followed by a unique validation. Oracle can easily handle millions of records, so it shouldn't be a problem.

    The other problem with frequent postings is that each commit tells oracle to write the data to the data blocks, and these 'write' get statements go in the database for the writer to manage processes. By default, there are X number of writer running process (depends on version and other parameters) when the database starts, but if a large number of postings is published then Oracle begins to generate additional editor on the server processes to manage the extra workload, which can then cause a lot of writer running process (using the resources of the server) all trying to access the same load of blocks of data in terms of physical i/o and therefore all the other slows down. This is why frequent postings are not a good thing, and you must book to engage in logical business transactions.

  • PGA of DIVISION between sessions

    Hello
    I am forest inside the management of oracle (mainly PGA) memory get better understood on the PGA TOUR.
    With the help of:
    http://docs.Oracle.com/CD/E11882_01/server.112/e16508/memory.htm#i12483

    My question is how oracle divides the memory for the process (PGA)?
    Each process has get a fixed size of the PGA?
    Or the PGA divided equally between the process?
    For example if I have a PGA G 10 and that a user to connect to the DB.
    Can get up to 10G of the PGA to his operation, sql (like)?

    Hello

    Link below may be useful for you.

    http://www.DBA-Oracle.com/art_so_undocumented_pga_parameters.htm

    Kind regards
    Amit Golia

  • v$ pgastat - overall target of auto PGA

    Hi guys,.

    10.2.05 / HP - UX

    The Oracle Documentation on "global target of auto PGA:
    ===
    Amount of memory PGA the Oracle database can use workspaces running in automatic mode. This amount comes dynamically PGA_AGGREGATE_TARGET initialization parameter value and work load current workspace and set continuously from the Oracle database.

    If this value is small compared to the value of PGA_AGGREGATE_TARGET, then a large amount of memory on the PGA TOUR is used by other components of the system (for example, PL/SQL or Java memory) and little is left for work areas. The ADMINISTRATOR must ensure that enough memory PGA is left of workspaces running in automatic mode.
    ===

    A few questions on this
    1. (PGA_AGGREGATE_TARGET - overall target of auto PGA = mΘmoire untunable?) Or (PGA_AGGREGATE_TARGET - target global auto PGA memory untunable = + tunable memory currently used)?

    2. when the tunable memory usage increases, the overall target of auto PGA will shrink? Or it will decrease only what untunable memory use increase?

    Thank you

    According to you, the definitions of the memory tunable and untunable

    1. (PGA_AGGREGATE_TARGET - overall target of auto PGA = mΘmoire untunable?) Or (PGA_AGGREGATE_TARGET - overall target of PGA mΘmoire untunable = auto + > tunable memory currently used)?

    You can tell
    PGA_AGGREGATE_TARGET = tunable memory + memory untunable

    PGA can still grow if PL/SQL nees traditionally much. You can test it by creating a procedure to call itself recursively and monitor the v$ pgastat for the current assignment of pga.

    As the tunable memory usage increases, the overall target of auto PGA will decrease? Or it will decrease only what untunable memory use increase?

    If the tunable memory usage increases, target auto PGA should also increase and it will increase the total envelope of pga (current allocation of pga).

    Salman

  • Investigate session PGA for a process

    Windows server 2003 with Oracle 9.2.0.8.0

    In this server, there is a process (myprocess.exe) that runs every night at 04:00.
    The process is still running, but only actually work between 04:00 and 05:00. The rest of the day is present with something (inactive).

    Run this query:
    SELECT
    s.sid sid
    , lpad(s.username,12) oracle_username
    , lpad(s.osuser,9) os_username
    , s.program session_program
    , lpad(s.machine,8) session_machine
    , (select ss.value/1024/1024 from v$sesstat ss, v$statname sn
    where ss.sid = s.sid and
    sn.statistic# = ss.statistic# and
    sn.name = 'session pga memory') session_pga_memory
    , (select ss.value/1024/1024 from v$sesstat ss, v$statname sn
    where ss.sid = s.sid and
    sn.statistic# = ss.statistic# and
    sn.name = 'session pga memory max') session_pga_memory_max
    , (select ss.value/1024/1024 from v$sesstat ss, v$statname sn
    where ss.sid = s.sid and
    sn.statistic# = ss.statistic# and
    sn.name = 'session uga memory') session_uga_memory
    , (select ss.value/1024/1024 from v$sesstat ss, v$statname sn
    where ss.sid = s.sid and
    sn.statistic# = ss.statistic# and
    sn.name = 'session uga memory max') session_uga_memory_max
    FROM
    v$session s
    ORDER BY session_pga_memory DESC
    I see that myprocess.exe has:
    Session_PGA_memory 154 MB
    163 MB session_pga_memory_max
    104 MB of session_UGA_memory
    111MB session_UGA_memory_max

    For an idle process, it's just for a lot. So I think there are a lot of cursors are not closed.

    If I kill the myprocess.exe, immediaty, I see the memory used oracle.exe falling... around ~ 150MB.
    If I take myprocess.exe, PGA only has 4 MB... until the next morning, where he has ~ 150 MB.


    Get the SID for myProcess.exe and run this query:
    SELECT s.machine, oc.user_name, oc.sql_text, count(1)  FROM v$open_cursor oc, v$session s 
    WHERE oc.sid = s.sid
    AND s.sid=38 
    GROUP BY user_name, sql_text, machine 
    HAVING COUNT(1) > 1 ORDER BY count(1) DESC 
    I was expecting to find a lot of sliders... but I did not! Only 9 lines are returned and all with similat Sql_Text
    "DELETE from GT_A.
    "DELETE from GT_B.
    "DELETE from GT_C.
    (...)
    (9 rows returned)


    This GT_ * are 9 global temporary tables used in the execution of PL/SQL.

    (1) why is this 9 "DELETE GT_" still present in open_cursors, if the process is slowed since 05:00?

    (2) checking the code, I found that they are created with: "On commit delete rows.
    but this 9 global temporary tables justify the 154MB of PGA not automatically detaches the session?

    Thanks in advance;

    Published by: PauloSMO on Set/6/2011 04:20

    The fact that the policy of work area is set to auto and you're on the server of course cancel the setting here. It's just a bit strange that it was fixed in view of the status of documents that it is set to 0 by default and is recommended to be used in server environments shared.

    Oracle does not recommend the use of the SORT_AREA_RETAINED_SIZE parameter, unless the instance is configured with the option of shared server. > Oracle recommends enable auto sizing of SQL working areas by setting PGA_AGGREGATE_TARGET instead. > SORT_AREA_RETAINED_SIZE is retained for backward compatibility.

    PauloSMO wrote: still active looking for a way to find why an idle process, has is session with 160MO at the PGA.
    Why didn't it releases memory for the operating system.

    The pga_aggregate_target is a target. It will be if necessary exceded. If the memory is used may not be returned to the operating system. The question is to discover where it uses memory. As you can see, it is not particularly easy to dig into the real details of what is contained in the PGA so that a particular session, so why not put in place a simple job to query stats for this session every 10 seconds or something? In this way, you'll be able to get a profile of when the memory usage is up and I hope that are correlated with what the process. It is not ideal, but that's essentially what does something like history of the session is active. If you have a decent level of instrumentation through things like dbms_application_info, it will make the job a little easier.

    HTH

    David

Maybe you are looking for