Computer Architecture Fundamentals
In this section, I give a very brief overview of the architecture present in all computers; keep in the mind, however, that a stand-alone machine might not have any network connections.
Memory
Memory is a storage device in a computer chip into which instructions and data are entered and retrieved when needed for processing. It is thousands, if not hundreds of thousands, times faster to read information from memory rather than directly from disk; however, there must be an initial load of information into memory from disk. The larger the memory available for a machine, the quicker it will run.
As far as Oracle is concerned, the instructions are the Oracle programs, and the data is the data read from the Oracle database files.
Processes/Programs
A process or program is a set of instructions to a computer that are run on the machine's processor. These instructions, or programs, are stored on the file system of the machine. Before you can run a program, the instructions for it are read into the machine's memory from the file system.
For Oracle, the processes are the Oracle system (background) processes that look after the database or the user processes that perform work for the user accessing the database.
File Systems
Data and programs for the computer are stored on the machine's file system, which typically consists of one or more hard disks. Programs and data, when required, are loaded from the hard disk into the machine's memory before the program or data is used.
Oracle uses the file system for the sets of the files that make up the database and the software programs that enable you to access the database.
Network
A network is a system of connections between machines that enable one machine to communicate with another and share resources. As well as the physical wires and components, you need to establish a set of rules for communication; this is known as a protocol.
Oracle can support many different types of networks and protocols. If you require communication between machines running Oracle software, you must install the Oracle SQL*Net software on all machines requiring network access.
Global View of the Oracle Architecture
The Oracle architecture described in this section is the generic architecture that applies to all platforms on which Oracle runs. There might be differences in the architecture between different platforms, but the fundamentals are the same.
What Is a Database?
A database is a collection of related data that is used and retrieved together for one or more application systems. The physical location and implementation of the database is transparent to the application programs, and in fact, you could move and restructure the physical database without affecting the programs.
Physically, in its simplest form, an Oracle database is nothing more than a set of files somewhere on disk. The physical location of these files is irrelevant to the function (although important for the performance) of the database. The files are binary files that you can only access using the Oracle kernel software. Querying data in the database files is typically done with one of the Oracle tools (such as SQL*Plus) using the Structured Query Language (SQL).
Logically, the database is divided into a set of Oracle user accounts (schemas), each of which is identified by a username and password unique to that database. Tables and other objects are owned by one of these Oracle users, and access to the data is only available by logging in to the database using an Oracle username and password. Without a valid username and password for the database, you are denied access to anything on the database. The Oracle username and password is different from the operating system username and password. For example, a database residing on a UNIX machine requires that I log in to the UNIX machine using my UNIX operating system username and password and then log in again to Oracle before I can use the database objects (the UNIX login would not be required for a client/server setup). This process of logging in, or connecting to, the database is required whether you're using an Oracle or non-Oracle tool.
The same table name can coexist in two separate Oracle user accounts; although the tables might have the same name, they are different tables. Sometimes, the same database (same set of physical database files) is used for holding different versions of tables (in separate Oracle accounts) for the developers, system testing, or user testing, or the same table name is used in different application systems.
Often, people refer to an Oracle user account as a database, but this is not strictly correct. You could use two Oracle user accounts to hold data for two entirely different application systems; you would have two logical databases implemented in the same physical database using two Oracle user accounts.
In addition to physical files, Oracle processes and memory structures must also be present before you can use the database.
Oracle Files
There are three major sets of files on disk that compose a database.
Database files
Control files
Redo logs
The most important of these are the database files where the actual data resides. The control files and the redo logs support the functioning of the architecture itself.
All three sets of files must be present, open, and available to Oracle for any data on the database to be useable. Without these files, you cannot access the database, and the database administrator might have to recover some or all of the database using a backup, if there is one! All the files are binary.
System and User Processes
For the database files to be useable, you must have the Oracle system processes and one or more user processes running on the machine. The Oracle system processes, also known as Oracle background processes, provide functions for the user processes—functions that would otherwise be done by the user processes themselves. There are many background processes that you can initiate, but as a minimum, only the PMON, SMON, DBWR, and LGWR (all described later in the chapter) must be up and running for the database to be useable. Other background processes support optional additions to the way the database runs.
In addition to the Oracle background processes, there is one user process per connection to the database in its simplest setup. The user must make a connection to the database before he can access any of the objects. If one user logs into Oracle using SQL*Plus, another user chooses Oracle Forms, and yet another user employs the Excel spreadsheet, then you have three user processes against the database—one for each connection.
Memory
Oracle uses the memory (either real or virtual) of the system to run the user processes and the system software itself and to cache data objects. There are two major memory areas used by Oracle: memory that is shared and used by all processes running against the database and memory that is local to each individual user process.
System Memory
Oracle database-wide system memory is known as the SGA, the system global area or shared global area. The data and control structures in the SGA are shareable, and all the Oracle background processes and user processes can use them.