2011年3月26日星期六

Expert Oracle Database Architecture读书笔记之Architecture Overview

Defining Database and Instance

•  Database: A collection of physical operating system files or disks. When using
Oracle Automatic Storage Management (ASM) or RAW partitions, the database
may not appear as individual, separate files in the operating system, but the
definition remains the same.
•  Instance: A set of Oracle background processes or threads and a shared memory area, which is memory that is shared across those threads or processes running on a single computer. This is the place for volatile, nonpersistent stuff, some of which gets flushed to disk. A database instance can exist without any disk storage
whatsoever. It might not be the most useful thing in the world, but thinking about it that way definitely helps draw the line between the instance and the database.

  Some further explanation should help clear up these concepts. An instance is
simply a set of operating system processes, or a single process with many threads, and some memory. These processes can operate on a database, which is just a collection of files (data files, temporary files, redo log files, and control files). At any time, an instance will have only one set of files (one database) associated with it. In most cases, the opposite is true as well: a database will have only one instance working on it. However, in the special case of Oracle Real Application Clusters (RAC), an Oracle option that allows it to function on many computers in a clustered environment, we may have many instances simultaneously mounting and opening this one database, which resides on a set of shared physical disk. This gives us access to this single database from many different computers at the same time.Oracle RAC provides for extremely highly available systems and has the potential to architect extremely scalable solutions.
  Let’s start by taking a look at a simple example. Say we’ve just installed Oracle 11g version 11.2.0.1 on our Linux-based computer.

 sqlplus / as sysdba
SQL>startup

  Oracle used defaults to put everything together and created a database as a set of persistent files. If we close this database and try to open it again, we’ll discover that we can’t:
SQL> alter database close;
Database altered.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-1619c6: database has been previously opened and closed

  An instance can mount and open at most one database in its life. Remember, the instance consists simply of the processes and shared memory. This is still up and running. All we did was close the database, that is, the physical files. We must discard this instance (shutdown) and create a new one (startup) in order to open this or any other database.
•An instance is a set of background processes and shared memory.
•A database is a collection of data stored on disk.
•An instance can mount and open only a single database, ever.
•A database may be mounted and opened by one or more instances (using RAC)  and the number of instances mounting a single database can fluctuate over time.

The SGA and Background Processes
You’re probably ready now for an abstract picture of what an Oracle instance and database look like, so take a look at Figure 2-1.















Dedicated Server













Shared server










Mechanics of Connecting over TCP/IP

If we are making a dedicated server connection, the listener process will create a dedicated server for us. On UNIX, this is achieved via fork() and exec() system calls (the only way to create a new process after initialization in UNIX is via fork()). The new dedicated server process inherits the connection
established by the listener, and we are now physically connected to the  database. On Windows, the listener process requests the database process to create a new thread for a connection. Once this thread is created, the client is “redirected” to it, and we are physically connected. Diagrammatically in UNIX, it would look as shown in Figure 2-4.

   


没有评论:

发表评论