Page 53
Page 54
When someone refers to the Oracle database, they are most likely referring to the entire Oracle data management system. But as Oracle professionals, we must recognize the difference between the database and the instancea distinction often confusing to non-Oracle administrators. In this chapter we explore the structure and configuration of the Oracle instance, and continue our exploration of the internals of the Oracle Relational Database Management System (RDBMS) in the next chapter by looking in-depth at the Oracle database. (To avoid confusion, the term RDBMS, is used to describe the entire data management server consisting of the Oracle database and instance.) The creation of the instance is automatic and behind the scenes. The details of how and when this happens are discussed.
To provide the degree of service, flexibility, and performance that Oracle clients expect, much of the work done by the database is handled by a complex set of memory structures and operating system processes called the instance. Every Oracle database has an instance associated with it, and unless the Oracle Parallel Server option is implemented, a database is mounted by only one instance. The organization of the instance allows the RDBMS to service many varied types of transactions from multiple users simultaneously, while at the same time providing first class performance, fault tolerance, data integrity, and security.
NOTE |
This chapter defines the term process as any running task, operating without user intervention. Your particular OS may refer to these as tasks, jobs, threads, and the like. |
The instance structure is loosely styled after UNIX's implementation of the multitasking operating system. Discrete processes perform specialized tasks within the RDBMS that work together to accomplish the goals of the instance. Each process has a separate memory block that it uses to store private variables, address stacks, and other runtime information. The processes use a common shared memory area in which to do its worka section of memory that can be written to and read from at the same time by many different programs and processes. This memory block is called the System Global Area (SGA).
NOTE |
Because the SGA resides in a shared memory segment, it is also often referred to as the Shared Global Area. |
You might think of the background processes as the hands, eyes, ears, and mouth of the database, with the SGA as the brain, storing and distributing information as necessary. The SGA takes part in all information and server processing that occurs in the database.
NOTE |
Single user Oracle configurations (such as Personal Oracle Lite) do not use multiple processes to perform database functions. Instead, all database functions are contained within one Oracle process. For this reason, single user is also known as single process Oracle. |
Page 55
Opening an Oracle database involves three steps:
The Oracle instance is created during the nomount stage of database startup. When the database passes through the nomount phase the init.ora parameter file is read, the background processes are started, and the SGA is initialized. The init.ora file defines the configuration of the instance, including such things as the size of the memory structures and the number and type of background processes started. The instance name is set according to the value of the ORACLE_SID environment variable and does not have to be the same as the database name being opened (but for convenience, usually is). The next stage the database passes through is called the mount stage. The value of the control file parameter of the init.ora file determines the database the instance mounts. In the mount stage, the control file is read and accessible, and queries and modifications to the data stored within the control file can be performed. The final stage of the database is when it is opened. In this stage the database files whose names are stored in the control file are locked for exclusive use by the instance, and the database is made accessible to normal users. Open is the normal operating state of the database. Until a database is open, only the DBA is able to access the database, and only through the Server Manager utilities.
In order to change the operating state of the database, you must be connected to the database as internal, or with SYSDBA privileges. When going from a shutdown state to an open state you can step through each operating state explicitly, but when shutting down the database you can only go from the current operating state to a complete shutdown. For example, you can issue the STARTUP NOMOUNT command in the Server Manager utility. This will put your database into the nomount stage. Next, you can issue ALTER DATABASE MOUNT or ALTER DATABASE OPEN to step through the operating stages. At any operating state, if you issue a SHUTDOWN command you will completely shut down the database. For example, you cannot go from an open state to a mount state.
An instance that does not have a database mounted is referred to as idleit uses memory, but does not do any work. An instance can only attach to one database, and unless Parallel Server is being used, a database only has one instance assigned to it. The instance is the brain of the data management systemit does all the work, while the database stores all the data.
Figure 5.1 is a visual representation of the Oracle instance. Explanations of the different components follow.