Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Gurushankar.

Asked: June 25, 2009 - 11:04 am UTC

Last updated: March 29, 2017 - 1:52 pm UTC

Version: 10.2.0

Viewed 10K+ times! This question is

You Asked

Hi Tom,

Is PGA memory allocated from SGA?

In my database SGA_MAX_SIZE is 1504M

SQL> sho parameter sga_max_size

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
sga_max_size big integer 1504M

PGA is 24M

SQL> sho parameter pga

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
pga_aggregate_target big integer 24M

If I increase PGA to 200M will this additional memory be taken from SGA?

Thanks
Guru.

and Tom said...

no

SGA is shared global memory
PGA is PROCESS memory

pga is private, is it not allocated from the SGA at all.


If you have access to Expert Oracle Database Architecture, I cover the SGA and PGA memory structures in detail.

Rating

  (9 ratings)

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

Comments

What about shared server?

A reader, June 27, 2009 - 9:42 pm UTC

What goes in the PGA and what goes into the UGA would also be good to read
Tom Kyte
July 06, 2009 - 5:09 pm UTC

and it is in that book as well.

the UGA is in the PGA in dedicated server
the UGA is in the SGA (large pool if configured, shared pool otherwise) in shared server

but the UGA is the UGA - your user global area, your session specific information, that data that must be available for the life of your session (like plsql variable values, cursor state information, etc)

Guru, June 29, 2009 - 9:20 am UTC

Thanks Tom for the clarification

About SGA

Anil, June 30, 2009 - 5:00 am UTC

Hello Tom,
If I allocate x GB of memory to sga_max_size then Oracle will never/ever use more than sga_max_size (+ PGA, as it's allocated seperately).

Am I correct in saying this?


Tom Kyte
July 06, 2009 - 6:39 pm UTC

if you set the sga max size, then the max size of the sga will be limited to that number, yes.

SGA and PGA

lalu, July 01, 2009 - 7:54 am UTC

The PGA value may go up.But not the sga...
There is another parameter sga_target that controls the sga value....(If you already have set it.)

SGA_PGA_SHMMAX

lalu121212, June 30, 2011 - 6:21 am UTC

Hi Tom,
Hope you doing good.

Came across a typical situation.
Is there any restriction on setting the SHMMAX lower than sga_target?
I have tested and the DB runs good.

Which confirms that sga is not allocated from shmamx, its from the RAM/OS.
Similarly, I have seen in asktom, that the pga can grow beyond our pga_aggregate_target and use the whole RAM.

My understanding is that both the PGA and SGA are directly allocated from the RAM/OS?

Regards,
Tom Kyte
July 01, 2011 - 8:45 am UTC

that does not confirm what you think it does.

SHMMAX is the max size of a shared memory segment. A process may attach up to SHMSEG segments however.

The sga is allocated from shared memory. And shared memory is 'RAM'. I don't understand the distinction you are trying to make. What is the difference to you regarding 'RAM' and shared memory?

PGA Memory

Milind Pandey, February 15, 2012 - 2:05 am UTC

I feel the question being asked is PGA memory allocation is taken from Allocated memory(RAM).
EG: we have 100Gb of RAM allocated on server with SGA 30Gb & PGA as 10Gb so 10Gb would be allocated out of 100Gb & not 30Gb(SGA) depending upon shared/dedicated server.
Tom Kyte
February 15, 2012 - 8:24 am UTC

the question was pretty clear:

is PGA memory allocated from the SGA?
If I increase PGA to 200m will this additional memory be taken from SGA?


the answer to that is:

no.



and it does not depend on shared/dedicated server. PGA memory is always process memory, allocated directly from the OS, it does not come from the SGA ever.


The question was pretty unambiguous and the answer is quite simply:

no.


There is a piece of memory we call the UGA (user global area) that either resides in the PGA or the SGA depending on dedicated/shared server - but UGA is not the PGA. It is just a component that if you use dedicated server will reside in the PGA.





PGA Memory

Milind Pandey, February 16, 2012 - 5:11 am UTC

I believe thats pretty much clear now... Thanks for again helping me revise my concepts...

GOOD ORACLE

ALICE WHIM, February 16, 2012 - 7:54 am UTC

I LIKE LOTS OF THINGS IN ORACLE THANKS ALICE WHIM

Montu, March 29, 2017 - 12:58 pm UTC

Normally SGA is allocated on server where database is install.
but where PGA is allocated?
Chris Saxon
March 29, 2017 - 1:52 pm UTC

I don't understand what you're asking. A database can only use memory from the server instance(s) it runs on!