Tuesday, January 27, 2009

Oracle Architecture -- Memory Structures

Because Oracle uses the system memory to store various information, Memory structures are required to access and control a database. These Memory structures reside in the system's main memory and are used;
  • to execute program code
  • to access the control file for information about the database
  • to access the status of a table (if two users try to modify the same table simultaneously, there must a way to stop one of them)
  • to access the datafiles and redo log files

In order to accomplish these tasks, the Memory structure has two main areas called :

  • System Global Area (SGA) which contains data and control information for a database instance and is accessible to all the user and server processes that are running
  • Program Global Area (PGA) which contains data for one process, accessible within different parts of a process, but not outside of it.
The system global area stores information such as transactions made to the data, data dictionary information, (objects that the user can access, location of these objects, etc) and redo log information. The information stored in the SGA can be accessed by all the sessions and processes.

The program global area stores the variables used in a session, which can only be accessed by processes or programs within that session.


TIP: Memory is also known as buffer.

As an analogy, you can think of SGA as the lounge area in a hotel, accessible to all the guests staying in the hotel similarly to (the SGA, which can be accessed by all the processes running). The PGA can be compared to a hotel room, which can be accessed by only the guests who have reserved that room, and not by others.


When a user issues a command, the relevant data is retrieved from the datafiles and is brought to the SGA. This recently used data is kept in memory (i.e., in the SGA) for some time so that any time the same command is issued by any other user, data can be taken directly from the SGA instead of going to the disc again.

The information stored in the SGA is divided into the following Memory structures:

  • Data buffers
  • Redo log buffers
  • Shared pool
Data buffers-This is the area in the SGA where the transactions made to the data are stored. Data which is read from the datafiles is brought and kept here.

Redo buffers-This is the area in the SGA where any changes made to the data are recorded . Later, these changes are written to the redo log files (on the disc).

Shared pool-This is the portion of the SGA where the command issued by the user, its text, and compiled version is kept. It also contains the data dictionary information.


Processes that Run in Memory

Every program uses a process to communicate with the Oracle database. Two types of processes run in the Oracle database are user and server. This topic discusses these two processes. A process is a series of steps executed by the operating system and has its own space in which it runs. Oracle servers have two processes:


  1. User process: or client process, executes the code in an application by sending the request to the server.
  2. Server process: handles requests from the user, communicates with the database to carry out the request, and gets back to the user process with information.
The user process communicates with the server process through a medium called the program interface, which --

  • understands the requests made on the data;
  • passes the information to the user process;
  • traps and returns errors, if any;
  • converts and translates data between different computers.
The server process is responsible for communicating with the user process and for passing information from the Oracle database. The user and server processes may be a single process or separate. client/server systems execute the user and server processes on different machines.

Background Server Processes

Oracle starts a set of background processes every time the database is opened. These processes increase the performance of the programs run. Whenever an Oracle database is started, then a system global area is allocated and Oracle background processes started. The interacting of the system global area and background processes is called an Instance. There are five mandatory processes in an Oracle Instance:

  1. The process that writes all changes in data to the datafiles. This is called the database writer-DBWn-because it writes the information in the data buffers to the data files.
  2. The process that writes the redo log information to the disk. This is called log writer-LGWR-because it writes the information in the redo buffers to the redo log files.
  3. The process that signals Oracle, precisely DBWn, to write the information stored in the data buffers to the datafiles. This process is called the Checkpoint Process or CKPT.
  4. The process that performs crash recovery in the event of an instance failure is called System Monitor or SMON.
  5. The process that performs recovery when a user or server process fails is called the Process Monitor or PMON.
A detailed description of all these processes is of course beyond the scope of this course, but the foregoing provides you with a good fundamental understanding of how the Oracle database works.

An Instance is depicted in the the figure below.

What follows is a step-by-step working example of Oracle:
  1. The database is started. This involves 3 steps:
  • An instance is allocated (i.e., SGA and background processes are started).
  • The database is identified (i.e., the datafiles and redofiles are identified-This is called mounting the database.)
  • The database is opened (i.e., the user can now access the database).
  1. When a user connects to the database and a session starts.
  2. The user process and the server process-they do a handshake.
  3. A user issues an SQL command: Update emp Set sal = sal *12 where deptno = 20;
  4. The user process passes on this statement to the server process.
  5. The server process receives the statement and checks the SGA to see if the relevant data already exists there. If it does, then it takes the data from there only. Otherwise, it retrieves the data from the datafiles and puts it in the SGA (to be precise, in the data buffers).
  6. The update is completed in the data buffers.
  7. This modification of the data is recorded in the redo buffers.
  8. The user issues a command to make the changes permanent (i.e., issues a commit ).
  9. The redo entries ( i.e., the information in the redo buffers) is written to the redo log files; this is done by the LGWR.
  10. After some time, the changes made in the data buffers are written to the datafiles; this is done by the DBWn.
  11. Throughout the process other background processes run, looking out for situations that require their response.

Oracle Architecture -- Physical Database Structures

The Physical structure of a database contains the operating system files. Information in the Oracle database is stored in the tablespace in the form of the Physical structures which occupy the disk space available to store data. These structures include:
  • Password file, which contain the password information for all users.
  • Parameter file, which contains all the important information necessary to start a database. The parameter file is called init.ora , which you can find in the operating system.
  • Datafiles, which contain the application data being stored, as well as any data necessary to store user-IDs, passwords, and privileges.
  • Redo log files, which store all the transactions made to the database. These files are also called transaction log files.
  • Control files, which store information specifying the structure of the database, such as the name and time of creation of the database and the name and location of the datafiles.

Password File

Since the tasks performed by the database administrator (DBA), are critical and should not be done by any other user, there needs to be a more secure method to safeguard his password.

To authenticate a user logging in as the DBA, two methods can be used. Either an operating system authentication, power can be employed or a password file can be used.

A password file is a file that contains the passwords of the DBA. The password file authenticates the user logging in as the DBA. When a user is granted the privileges of a DBA, his username is automatically added in the password file. The password file contains the passwords in encrypted form.

Parameter File

When you start an Oracle database instance, the start-up process checks for the status of certain parameters. The parameter file, init.ora, is the most important part of a database. Some of the parameters identified by the parameter file include:
  • the amount of system memory area that can be used by an instance
  • the name of the database
  • the maximum number of licensed users
  • the names of the control files
  • the amount of memory space that can be used by the redo log files
  • the frequency with which the redo log is updated

Datafiles

The Oracle database requires one or more datafiles to store the application data. The tablespace is composed of the datafiles. Every datafile is associated with just one tablespace, whereas a tablespace can contain more than one datafile. The data stored in datafiles include:


  1. The data for an application, for example, employee information (first name, last name, address, phone, salary, and department) and product information (product name, unit-price, and supplier-name);
  2. The information that the database needs to manage user-data (for example, since the salary of an employee must contain only numbers, the system datafiles will ensure that characters are not stored.);
  3. The information to the database need to determine the validity of your username and password when you log on to the Oracle database.

Redo Log Files

The Oracle database has a set of two or more redo log files. The main purpose of the redo log is to keep track of changes made to the application data. Any change made to the data is not immediately made permanent in the database. The changes are first stored in the systems' redo log and later made permanent. This makes having redo logs a useful feature because if the system fails (which usually happens when you least expect it), you can restore the changes from the redo log, a fact which means you don't have to lose your work! More precisely, if you have an unexpected power outage that shuts your system down, you will lose all transactions stored in the RAM. However, using the automatically maintained redo log, you can apply the changes made recently and restore all information up to the time of the power failure. Oracle allows you to protect the redo log itself by allowing for multiplexed redo log files that back up the data from the original redo log files in different disks simultaneously.

Control Files

The Oracle database has a control file that contains information about the Physical structure of the database. The information may include:
  • the name of the database;
  • the name and location of the datafiles;
  • the name and location of the redo log;
  • the time when the database was created.

The control file is used every time an instance of an Oracle database is started, to identify the database and determine the redo log that must be opened to start the database. The control file is automatically modified when the database is changed; for example, when a new datafile is created or when the redo log changes. Oracle allows multiplexed control files; that is, you can have many control files in different disks that will be updated simultaneously. The information stored in the control files are also used for database recovery, to identify which redo log must be accessed. The control file always contains the last change number of the last change to the database.

Oracle Architecture---Logical Database Structures

Logical database structures manage the storage of physical data. They include:

TABLESPACES

A database is divided into logical storage units called Tablespaces. A tablespace is a logical construct for arranging different types of data you have in the database. An Oracle database must have at least a system tablespace. It is recommended to have different tablespaces for user and system data. One or more datafiles are created for each tablespace to physically store the data of all Logical structures. The relationship between tablespace and datafiles can be understood as: for every user-table created a System Tablespace is created.
System tablespaces exists purely as a logical unit; where as the user-tablesapces exist as physical spaces.


Oracle has provided a standard, recommended way to arrange different kinds of data in different logical units. They have even recommended conventions for naming these logical units. Lots of people still follow this way of arranging their database data and find it to be especially logical and the most effective way. Oracle has provided us with seven logical tablespaces. Let's look at all of them so as to understand their purpose in the database. The seven logical tablespaces are:
  1. SYSTEM Tablespace: This tablespace is available in every Oracle database. The database cannot function without this logical unit, which stores the SYSTEM data. This data is controlled by Oracle itself and it Inserts, Updates, and Deletes this data internally. This logical unit is also the area where DBA's get most of the internal information about database functioning. This logical unit should never be deleted. The System Tablespace plays a role in almost all the transactions that occur in the database.
  2. DATA Tablespace: This tablespace is the logical area where the user of the database stores all the application data. This is the area where you will store USER data. For example, a payroll application will have all of its names, salary, commission, and tax information stored in this logical unit. Depending on the amount of data, this logical unit could be huge and have many datafiles associated with it. Oracle recommends that you relate the tablespace name with its associated datafile name in some way. For example, if the tablespace name for this logical unit is PAYROLL_DATA , then you name its associated physical datafiles as payroll_data_01.dbf and the second one (if needed) as payroll_data_02.dbf . This way if you see any datafile anywhere on the system, you will have no problem relating it to the corresponding tablespace associated.
  3. INDEX Tablespace: This logical unit is used in conjunction with the DATA tablespace. This stores the indexes needed by the application for a speedy response time. Indexes are logical objects created internally in the database to help in the speedy retrieval of user data and thus help in increasing the overall performance of the Application.
  4. TEMP Tablespace: This is the logical unit that serves a very special purpose in the database. When users retrieve data stored in the database, they sometimes do a lot of sorting and grouping. To give you an example, suppose that a user of the database who serves a payroll application wants to see all employees who are working the Information Technology field, who are in their twenties, and who are earning more than 100K a year. To retrieve this kind of data (i.e., to show names of employees who fit this profile), the Oracle database has a lot of work to do inside. First, it must retrieve data relating to information technology personnel; then it sorts this data again to retrieve the employees between 20 and 30 years old. Again it sorts this data to take only those employees who earn more than 100K. Now if we look at the entire transaction, we see Oracle doing a lot of sorting inside the database. Where does all this happen? It happens in the TEMP tablespace, the logical unit, which allocates space to perform all these tasks.
  5. USERS Tablespace: This Tablespace is created for all users who will be connecting to the database. All the users need a work area, which they can use to access data. Having such a logical unit is very helpful because it restricts users to a specific logical area, preventing access to the rest of the database, a feature making database management much easier.
  6. ROLLBACK Tablespace: Let us suppose you go inside the database and write a command that increases the salary of all the employees by 20%. Immediately after writing this command, you realize you didn't intend to give them a 20% raise, only a 10% raise. So how do you undo? Oracle comes to your help in this area because it stores all data before any change is made, in a special area called rollback area. You can retrieve the old data from this holding area. This logical unit is available to hold all the undo information. The usual name given to this tablespace is ROLLBACK, or RBS.
  7. TOOLS Tablespace: This is an important Tablespace that you should have if you plan to install Oracle's or any other third party tools in your database. Most of these tools need to use the SYSTEM database account in the database to create tables and indexes. Now the SYSTEM database account has the System Tablespace as its default Tablespace for the user to create tables. It is important to keep in mind that you should NEVER create any database objects in the System Tablespace even if you install any tools. Thus, to give the database user SYSTEM some place in the database to create tables and indexes needed for tools you may be installing, you should create a separate Tablespace and make that Tablespace its default Tablespace. Oracle recommends you call that Tablespaces Tools.

Schemas and Schema Objects

A Schema is a collection of database objects. Schema objects refer directly to the data.

Relationship between Schema Objects and Tablespaces:

Objects within the same Schema can be stored in different tablespaces, and the same tablespace can store objects from different Schemas. In a database named EMPLOYEE, a user has created the following objects:

  • Table EMP (Physical space)
  • Table DEPT (Physical space)
  • Index I_EMP (Logical space)
  • Index I_DEPT (Logical space)

The schema contains the objects EMP, DEPT, I_EMP, and I_DEPT; part of the EMPLOYEE database.

Relationship Between Schema Objects and Datafiles:

A schema object can span datafiles. In fact, in Oracle RDBMS, the user does not have the control of specifying in which datafile she wants the data of a particular Schema object to go. If a datafile gets exhausted, then the data of the particular object starts filling up another datafile of that tablespace. The relationship between Schema objects and datafiles are depicted.
Schema objects include structures such as:

  • tables, which you can use to store data;
  • views, which present data from one or more tables;
  • sequences, which generate a list of numbers;
  • synonyms, which provide a mask for other database objects (such as tables or views);
  • indexes and clusters, which can assist in improving the performance when you retrieve data;
  • procedures, functions, packages, and triggers (collectively called Program Units), which are programs that perform specific tasks;
  • database links, which describe the path when using more than one database.

Table: This is the main database object within which the data is stored inside the database. Every table has columns in which it stores different kind of data. Oracle stores information about all the tables that exist inside the database. When you create a table, you specify how many columns it will have and what kind of data (number, string, date, etc.) these columns will contain. To better know how a table is organized and filled, think of a spreadsheet. In a spreadsheet you have columns and rows; similarly in an Oracle table, you have columns and rows. Columns describe the data stored and rows consist of the actual data stored. The following code is an example of how a table is created syntactically in Oracle:

CREATE TABLE EMPLOYEE (first_name varchar2(30), last_name varchar2(30), gender varchar2 (5), salary number);

The above code creates a table called EMPLOYEE, which has four columns: first_name, last_name, gender, and salary. The varchar2 and number are two datatypes of Oracle, which represent the kind of data that a column can have. The varchar2 datatype accepts numbers, letters, and any special characters. The number datatype accepts only numbers.

View: A view is an object that acts as a window, or a filter, to the data in a table. What we mean by a window is that using this object, you get to see only partial data from one or more tables. This object is not a physical object and does not have a storage clause as any other table. A view is based on the underlying table or tables and allows you to see only the columns you specifically include in that view. This object is stored in the database as a query against a table and whenever anything is trying to retrieve data from a view, the underlying query is executed and the data from pre-selected columns are obtained. Let's look at how do we create views in Oracle. To create a view based on the EMPLOYEE table, the syntax would appear as follows:

CREATE VIEW my_view AS SELECT first_name, salary FROM EMPLOYEE;

The above syntax would create a view of the employee table with only first_name and salary as its viewable columns. Thus, if you try to retrieve data from my_view , you will be able to see the first name and the salaries of employees. The chief reasons as to why we create views are: one, to get an additional level of security on the data and to restrict users from being able to see all data; two, to hide the complexity of the data. That is, a view can be based on several tables and you can isolate only the requested from all the base tables. This effectively hides how the data is stored in the underlying base tables from outside users. You can relate this feature to normalizing the database. When you normalize tables, you try to avoid redundant data by creating many tables and establishing a link between tables using Primary and Foreign Keys. A view helps you to retrieve data from normalized tables and make it (data) appear as coming from a single table.

Indexes: Indexes are database objects that help performance by speeding data retrieval. Consider the index given at the end of a book, which you use to look up any topic or word in the entire book, without having to search yourself page by page or line by line. These indexes basically help you find a topic faster. Similarly, the indexes in Oracle help you look in specific rows from data stored in a table. Indexes could be based on one or more columns of a table. An index is used if you want to filter the data based on the Primary Key. The syntax to create an index on the salary column of the EMPLOYEE table is as follows:

CREATE INDEX sal_idx
ON EMPLOYEE (salary);

Synonyms: This object in the database is just a pointer to an object like an alias. Assume there is a table called EMP0934BASE that stores all the employee data. You can create a Synonym called employee which points to the EMP0934BASE table. There are two reasons for creating a Synonym; one is to simplify an objects's name, and the other to disguise the owner of the object. Assume that two users, John and Richard, have access to the table, EMP0934BASE. If John is the owner of the table (that is, the person who created the table), then Richard can access the table only by referencing the table with John's name: John.EMP0934BASE. To avoid this unnecessary need for prefixing the table name with the name of the owner, you can create direct simple synonyms. Once you create a Synonym, Richard no longer needs to prefix it with John's name. There are two kinds of Synonyms: Private and Public. You may want to use synonyms if you want to hide the true name or identity of the table or to give simpler names for the users to use in place of more complicated names.

Privileges: This is a database object related to database security and its objects. All objects created in the database have access rights associated with them. Only users with proper rights can access a database object. There are four main privileges that can be granted on database objects by the owner. They are: SELECT, INSERT, UPDATE, and DELETE. SELECT allows the user to be able to see the data in a table or view. It does not allow the user to manipulate the data stored in it in any way. INSERT, UPDATE, and DELETE are granted to allow other users to add, change, or remove data, respectively. The syntax to grant a privilege in the database is as follows:

GRANT SELECT, INSERT, DELETE
ON EMPLOYEE TO richard;

This way you have granted three privileges on the EMPLOYEE table to the user called Richard.

Roles: Consider a scenario where you have 1,000 users and they all are developers. There are 10 tables in the database and all users need to have SELECT and INSERT privileges on all the 10 tables. To give each user privileges for each table separately would require two days of writing a similar SQL over and over again. There is, though, another more efficient way. You can create a role (let's call it development ) and grant all the necessary privileges to this single role and then simply grant this role to all the users. This way, if you want to provide UPDATE privilege on one table to all the users, you can simply grant it to the role instead of granting it to each and every user. Thus, a role makes the management of privileges more transparent and more manageable. The following figure shows how the role called development fits in the picture. You grant privileges to the role, then grant the role to all the users.

Data Blocks

A data block is the smallest unit of Input/Output used by the Oracle database. Though the underlying operating system stores the data in arrays of bits and bytes, Oracle writes and reads in chunks of database blocks. One datablock corresponds to a specific number of bytes of physical database space on disk. The size of data block for any database is fixed at the time of creation of the database; to change it you will have to recreate the database. Thus the data block size for that database should be chosen very carefully. Some values of the data block size are 2KB, 8KB, 16KB, and 32KB. Oracle recommends a size of 8KB for a typical Online Transaction Processing (OLTP) database.

Extents

An extent is the next level of data storage. One extent consists of a specific number of contiguous data blocks allocated for storing a specific type of information. One noteworthy aspect of extents is that storage values for all physical objects created in the database are in number of extents. One or more extents in turn make up a segment. When the existing space in a segment is completely used, Oracle allocates a new extent for the segment. When you try to create any physical object in the database, storage parameters expressed in terms of extents define every segment you wish to create for that object. Thus, in the storage clause of the CREATE TABLE statement, you can determine how much space is initially reserved for a table's data segment.

Segments

Segment is the level of logical database storage above an Extent. A segment consists of a set of extents assigned for a specific Logical structure. Each table's data is stored in its own single segment. Similarly, each index's data is stored in a single segment. The different types of segments are the data segments, index segments, rollback segments, and temporary segments.

TIP: You can remember the order of levels of the logical storage structures through the acronym 'DEST' (Datablocks, Extents, Segments, Tablespaces).

More extents are automatically allocated by Oracle to a segment if its existing extents become full. An important point to be remembered is that although an Extent consists of contiguous data blocks (i.e., data blocks adjacent to each other on the same datafile), a segment may not consist of contiguous Extents; thus, the Extents constituting a segment may lie on different datafiles.

There are four main types of segments that are used in the Oracle database. They are:

  1. Data segment: This type of segment is created by Oracle when you create a non-clustered table or a cluster inside an Oracle database. Thus, a non-clustered table, or a cluster, has a single data segment to hold all its data.
  2. Index Segment: Like the data segment, every index in the Oracle database has an index segment to hold all its data. A CREATE INDEX command creates this kind of segment.
  3. Temporary Segment: Many commands used to communicate with the database create a temporary segment which Oracle uses for a transaction. These segments are automatically created and dropped by Oracle.
  4. Rollback Segment: These are the undo segments which Oracle has for its use to store the undo information. Every database has several of these segments. The database can function only if there is at least a single rollback segment.

Logical Structures:

Schema Objects --> Need storage space
Data Blocks --> Stored in one or more datablocks
Extends --> One or more continuous data blocks form an extent
Segments --> A set of extends form a segment; when full Oracle creates/allocates space.
Tablespace --> Includes above structures and form a database

Oracle Architecture

A reasonably strong theoretical understanding of Oracle architecture will prove to be of great practical benefit later in the developing of applications to work with the Oracle database. While at first, it might seem that to work with a database system as well-developed as Oracle, all you really have to know is how to record and retrieve data, the practical reality is that knowing how Oracle works "under the hood" will pay off.

Once you understand the internal structure and mechanism of the Oracle database system, you will find yourself developing much more efficient applications-more efficient in terms both of processing speed and space requirements. If you have a reasonably strong technical understanding of how Oracle actually works, when creating objects such as tables, for example, you will have a much better sense of how much space to allocate to the object, where to put the object, and so forth.

To begin with, we need to understand that Oracle, like any database, stores data its user tells it to store. In addition, though, Oracle stores other information-data for its own use. Let's examine these two species of data stored and used.

The first type of data, the data the user stores for his or her own application's use, is appropriately termed USER data. This data can be stored and used in many ways, as well as customized according to the user's needs. You, the user, can decide the type of the data and the amount you want to store. You enjoy essentially complete control over the user data.

The second type of data, which Oracle spontaneously generates for itself, which the system uses, updates, or deletes on its own, is referred to as SYSTEM data. What is remarkable about Oracle's system data is that Oracle is able to generate and manage this type of data on its own in order to keep itself functioning smoothly and consistently. This data, which the user has little or no control over, Oracle generates and stores in internal tables during the initial installation. The sort of information stored as system data includes the number of users, their passwords, their privileges, the number of tables the user is creating, the kind of data being stored, how much data is stored, and so on. How Oracle actually functions as a database depends largely upon its system data. Finally, although users cannot access system data, Oracle database administrators routinely work with this data in order to fine-tune Oracle's performance.

The Oracle Database has three types of structures in which it stores and maintains User and System data.

  1. A Logical structure, that maps the data to the Physical structure.
  2. A Physical structure, that is part of the operating system's file structure.
  3. A Memory structure, where all the processing takes place.

The Logical structures control how the data must be stored in the database. There are five Logical structures, namely, tablespaces, segments, extents, data blocks, and schema objects. and five Physical structures, namely, parameter files, password files, datafiles, redo log files, and control files that reference data.

Every program uses a process to communicate with the Oracle database. These processes run in the System's Random Access Memory (RAM). In addition to Logical and Physical structures, there are two main Memory structures, namely, the System Global Area (SGA) and the Program Global Area (PGA). The Oracle database uses these memory areas to store information before they are made permanent in the database.

The purpose of a database is to both store and manipulate information. The Oracle database controls this dual process efficiently by maintaining the Physical and Logical structures separately, a feature allowing for modification of physical data without the need for accessing the Logical structure, and vice-versa. By way of illustration, consider the following: assume that you have a database table for a retail outlet that stores information about its salespeople. Initially, you decide to store only the first name, the last name, the address, the phone number, and the social security number of each salesperson. Later on, you decide to store the city, state, and zip code information in separate columns instead of including them with the address. Since the Logical and Physical structures in an Oracle database are maintained separately, you can easily accomplish such changes by just adding the columns to the Logical structure (which is a table, in this case), and then inserting the data. This data will be updated in the file-system, a Physical structure. What about the reverse of this? If you have to change the contents of the data (something you will do often), you may end up changing the Logical structure as well each time.

Logical structures control how the actual data will take up available storage space. The two different sets of Logical structures available to support this purpose are:

  • Tablespaces, segments, extents, and data blocks, each of which provide a different level of organization and storage units-tablespaces being the highest level.
  • Schema objects, which reference data in the database.

The Physical structures occupy the disk space available to store data. These structures include:

  • Password File, which contains the password information for all users.
  • Parameter File, which contains all the important information necessary to start a database.
  • Data Files, which contain all the data in the Oracle database.
  • Redo Log Files, which keep track of changes made to the data.
  • Control files, which contain information about the Physical structure, such as the database name, location, etc., and also the system change number for the last change made to the database, allowing for the restoration of the database to its last change before a crash.

Memory areas are used to manage the storage of data. There are two memory areas:

  • The System Global Area (SGA), which contains data and control information for a database instance and is accessible to all users and server processes that are running.
  • Program Global Area (PGA), which contains data for one process, and which therefore is accessible within different parts of a process, but not outside of it.