Graphical Oracle Database (i)

Source: Internet
Author: User
Tags data structures rollback dedicated server oracle database
Original works, allow reprint, reprint, please be sure to hyperlink form to indicate the original source of the article, author information and this statement. Otherwise, legal liability will be held. http://linuxtro.blog.51cto.com/1239505/289197 -------statement: This article refers to the Oracle official documents and the vast amount of information on the Internet, and summed up.   If there is any mistake, please do not hesitate to enlighten me. Oracle server is a database management system that provides an open, comprehensive, and integrated way to manage information. The key to Oracle servers is managing information. Its main performance has the following aspects: Open join, development tool, space management, backup and restore, massive data management, secrecy mechanism, decision support system Oracle Database Architecture Oracle servers are made up of Oracle instances and Oracle databases.As shown in the figure: a simple representation is shown in the following illustration: Each Oracle database is associated with an Oracle instance. After the database is started on the database server, Oracle software assigns a shared memory area called the system Global Area (SGA), and several Oracle background processes are started.        This combination of SGA and Oracle processes is called an Oracle instance. When an instance is started, Oracle Software associates the instance with a particular database. This process is called loading the database. You can then open the database. Multiple instances can be executed concurrently on the same Oracle server, and each instance accesses only its own physical database. Oracle databases use memory structures and processes to manage and Access databases. All memory structures exist in main memory of the computer that makes up the database server. A process is a job that runs in the memory of these computers. A process is defined as a "control thread" or a mechanism in the operating system that can run a series of steps. Oracle database architectures can be viewed as many different, interrelated, structured components. Next, let's take a look at the relevant content of the example: Oracle instances have processes and memory components. To start with the process structure, the following figure is the Oracle process structure. The Oracle process can be grouped into the following three types: background processes: Booting when an Oracle instance is started. In order to make the best performance and coordinate multiple users, the system uses some additional processes in a multi-process system, collectively known as background processes.          In many operating systems, an Oracle instance can have many background processes, but they do not always exist. User process: Starts when a database user requests a connection to an Oracle server.         Responsible for delivering the client user's SQL statements to the service process and getting the query data back from the server side. Server process: You can connect to an Oracle instance, which starts when a user establishes a session. The server process is used to process requests for user processes connected to the instance. There are two cases: 1, when the user and the Oracele database is running on the same machine, and no longer over the network, the user process and its corresponding server processes are generally combined into a single process, can reduce system overhead. 2. When users and Oracle databases are running on different machines, the user process communicates with Oracle through a separate server process. It performs the following tasks: parsing and executing the SQL statements that are emitted by the application. Reads the necessary block of data from the disk (data file) into the shared database buffer of the SGA (the block is not in the buffer). Returns the result to the application processing. Oracle's background process:Some of the more important aspects of Oracle's background processes include the following: Smon pmon Dbwrn lgwr archn CKPT on Linux You can view background processes in the following ways: The command is: PS -ef | grep Ora_ Smon (System Guardianship process):Performs an instance recovery when the instance is started and cleans up temporary segments that are no longer in use. The Smon process completes all system-level tasks. Pmon is interested in a single process, and Smon, which is a system-level starting point, is a database "garbage collector." Smon's work includes: • Cleaning up temporary space • Merging free space • Recovering active transactions against previously unavailable files • Performing instance recovery of failed nodes in the RAC • Cleaning up obj$ shrink rollback segment · " Offline "rollback segment" Pmon (User process monitoring process):The background process clears the failed user's process and frees the resource that the user was using. Pmon is responsible for releasing the lock and making it available to other users. Like Smon, Pmon periodically wakes to detect whether it needs to be used. is responsible for completing cleanup-freeing resources and rolling back uncommitted transactions after a connection with an exception abort has occurred. It is also responsible for monitoring other Oracle background processes and restarting these background processes if necessary. In addition, Pmon will do another thing for the instance, which is to register this instance with the Oracle TNS Listener. DBWR (data file write process):The responsibility for writing changed data from the database buffer cache to the data file is an Oracle background process that is responsible for buffering the storage area management. When a buffer in the buffer is modified and it is marked as "dirty," the main task of DBWR is to write "dirty" buffers to disk, keeping the buffer "clean". The number of unused buffers is reduced because the buffers in the buffer store are filled into the database or dirty by the user process. When the unused buffer is dropped to a minimum so that the user process cannot find the unused buffer when it reads from the disk into the block to the memory store, DBWR manages the buffer store so that the user process can always get the unused buffer. Oracle uses the LRU (least recently USED) algorithm (the least recently used algorithm) to keep the block of data in memory in the most recent use, minimizing I/O. The following conditions indicate DBWR to write a dirty buffer to disk:
1. When a server process moves a buffer into the dirty table, which is expressed to a critical length, the service process notifies the DBWR to write. The critical length is half the value of the parameter Db-block-write-batch.
2. When a server process looks for a db-block-max-scan-cnt buffer in the LRU table, it does not find an unused buffer, stops looking and notifies DBWR to write.
3, the timeout (3 seconds each), DBWR will notify itself.
4. When the checkpoint appears, LGWR will notify DBWR
In the first two cases, DBWR writes a chunk of the dirty table to disk, and the number of blocks per writable is specified by the initialization parameter Db-block-write-batch. If there is no buffer in the dirty table that specifies the number of blocks, DB WR looks for another dirty buffer from the Lur table.
If the DBWR is inactive within three seconds, a timeout occurs. In this case, DBWR a specified number of buffers to the LRU table and writes any dirty buffers found to the disk. Whenever a timeout occurs, DBWR looks for a new buffer group. The number of buffers found by DBWR each time is twice times the value of the Db-block-write-batch parameter. If the database runs empty, DBWR eventually writes all the buffer stores to disk. When a checkpoint occurs, LGWR specifies that the Modify buffer table must be written to disk.
LGWR (log file write process):The process writes the log buffer to a log file on disk, which is an Oracle background process that manages the log buffers. The LGWR process will output all log entries since the last time it was written to disk, LGWR output: 1, write a commit record when a user process submits a transaction.
2, every three seconds the log buffer output.
3. The log buffer is output when 1/3 of the day log buffer is full. 4, there are more than 1M redo log buffers not written to disk 5, timeout LGWR process is written synchronously to the active online from do log filegroup. If one of the files in the group is deleted or unavailable, LGWR can continue to write to other files in the group. Because the log buffer is a circular buffer. When LGWR writes a log entry for a log buffer to a log file, the server process can write a new log entry to the log buffer. LGWR is usually written very quickly to ensure that there is always room for log buffers to write new log entries.
"Note:" Sometimes when more log buffers are needed, LWGR writes out the log entries before a transaction is committed, which is only permanent after the transaction is committed later. Oracle uses the quick submit mechanism where a commit record is immediately put into the log buffer when a user issues a commit statement, but the corresponding data buffer changes are deferred until they are written to the data file more efficiently. When a transaction commits, it is assigned a system modification number (SCN), which is the same as the transaction log entry
Record in the log. Because the SCN is logged in the log, the recovery operation can be synchronized in the context of the parallel server Option configuration. CKPT (checkpoint process, sync data file, log file, control file):The process changes the title of all data files to indicate the checkpoint when the checkpoint appears. In the usual case, the task is performed by LGWR. However, if the checkpoint significantly reduces system performance, the CKPT process can be run, separating the work of the checkpoint originally performed by the LGWR process and being implemented by the CKPT process. For many applications, the CKPT process is unnecessary. Only when the database has many data files does the LGWR significantly degrade performance at checkpoints to make ckpt run. The CKPT process does not write blocks to disk, which is done by DBWR. Initialization parameters Checkpoint-process control of the CKPT process to enable or render impossible. The default is False. ARCH (archive process):This process copies the filled online log files to the specified storage device. The journal is an arch process that is available for Archivelog use and automatically archived. Lckn (Blockade process):Used in the context of a parallel server option, up to 10 processes (Lck0,lck1 ..., LCK9) are used for blocking between instances. Others are not very important processes: reco recovery
DNNN Scheduling process
SNNN Server
However, each background process interacts with different parts of the Oracle database. Service Processes Server processCan be divided into dedicated server processes and shared server processes.          Dedicated service processes (dedicated server process): A service process that corresponds to a user process Shared service process (multitreaded server process): A service processing corresponds to multiple user processes and takes turns serving the user process. The dedicated server mode means that each time the Oracle server is accessed, the listener of the system receives the access request and then creates a new process for the access to service. So, for each client access, will generate a new process for service, is a similar one-to-one mapping relationship.          An important feature of this connection pattern is that the UGA (user global area) is stored in the PGA (Process global domain), which is also a good indication that the current user's memory space is allocated according to the process. A shared server connection is the process of creating a batch of server connections when the database is initialized, and then putting these connection processes into a pool of connections for management. The number of processes in the initialized pool can be set manually when the database initialization is established. When the connection is established, listener first accepts the client's request to establish a connection, and then listener to generate a process called the Scheduler (Dipatcher) to connect to the client. Next, the memory structure, the following figure is the Oracle memory structure. The basic memory structure associated with an Oracle instance includes: System global Area (SGA): All server processes and background process shared program Global Zone (PGA): dedicated to each server process or background process. Each process uses a PGA system global shared area (SGA) The SGA is a huge area of shared memory, a memory area that contains the data and control information for the instance. He is seen as a large buffer pool for Oracle databases, where data can be shared by Oracle's processes. The size can be viewed through the following statements:   sql> SELECT * from V$SGA; NAME VALUE---------------------------------------------------Fixed size 1218992 Variable size 96470608 Database Buffer s 184549376 Redo buffers 2973696 sql> SELECT * from V$sgastat; ............ Pool NAME BYTES--------------------------------------------------------------------------Large pool PX msg pool 20620 8 Large pool free memory 3988096 java pool free memory 4194304 608 rows selected. The   SGA contains the following data structures: Database buffer Cache Caching: Caching data blocks retrieved from the database. These buffers correspond to some of the data blocks that are used in all data files. Allow them to operate in memory. At this level there is no system file, user data file, temporary data file, rollback section file. That is, the data blocks of any file are likely to be buffered. Any modifications to the database are done in the buffer, and the modified data is written to disk by the DBWR process.   Redo Log buffers (Redo log buffer): Cache redo information (for instance recovery) until it can be written to a physical redo log file that is stored on the disk. Any modifications to the database are recorded sequentially in the buffer, which is then written to disk by the LGWR process. These modification information may be DML statements, such as (Insert,update,delete), or DDL statements, such as (Create,alter,drop, etc.). Redo log buffers exist because memory to memory operations compare memory to hard disk faster, so redo log buffers can speed up the operation of the database, but consider the consistency and recoverability of the database, the data in the redo log bufferThe detention time is not very long. So redo log buffers are generally small, and a redo log buffer greater than 3M is not much of a practical significance. Shared pool: A cache of structures that can be shared among users. A shared pool is the most critical memory fragment in the SGA, especially in performance and scalability. A shared pool that is too small can kill performance, stop the system, and too large a shared pool will have the same effect, consuming a lot of CPU to manage the shared pool. Improper use of shared pools can only bring disaster. Dachi (Large Pool): An optional area that provides a large amount of memory allocation for some large processes, such as Oracle backup and recovery operations, I/O server processes. A large pool is not named because it is large, but because it is used to allocate larger memory and handle larger memory than the shared pool. Start the reference from Oracle8i. Java pool: All Java code and data for a particular session in the Java Virtual Machine (JVM). Oracle 8I In the future, Oracle has added Java support to the kernel. The program buffer is reserved for Java programs. It is not necessary to change the default size of the buffer without using a Java program. Streams pool: Used by Oracle Streams to display the amount of memory allocated for the SGA by using the Enterprise Manager or Sql*plus boot instance. The   program Global Area (PGA) is a memory area that contains data and control information for each server process. The Oracle server process serves the client's request. Each server process has its own dedicated PGA, which was created when the server process was started. Exclusive access to the PGA by this server process can only be read and written to the PGA through Oracle code that performs operations on the PGA. When using the dynamic SGA infrastructure, you can change the size of the database buffer cache, shared pools, large pools, and Java pools, and the streams pool without closing the instance. The Oracle database uses initialization parameters to create and configure the memory structure. For example, the Sga_target parameter can specify the total size of the SGA. If Sga_target is set to 0, automatic shared memory management is disabled.

This article is from the Linux on the way blog, make sure to keep this source http://linuxtro.blog.51cto.com/1239505/289197

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.