Study Notes: oracle learning one: server architecture oracle11g architecture, the data dictionary


This series is used as study notes, used to record the learning process, learning to deepen the impression, and revisit their own learning content only, reference books as "oracle 11g from entry to the master (Second Edition)" If further study, please purchase original books, thank you!

1, server architecture

Mainly by Oracle Server instance, a database, a program area and a foreground process global composition, as shown in FIG.

  • Example: That routine, can be further divided into two parts System Global Area (SGA) and background processes (PMON, SMON, etc.)
  • Database: contains a data file (data files), the control file (control files) and redo log files (redo log file)
  • Program Global Area (PGA): is a non-shared memory area for managing user process private resources
  • Foreground process: the process can be further divided into user and server processes

1.1 System Global Area SGA

System Global Area (system global area) is shared by all user processes a memory area. Mainly consists of high-speed data buffer redo log cache, shared pool, large pool and pool JAVA and other memory structures. SGA With the launch of the database instance and loaded into memory, when the database instance is shut down, SGA area will disappear.

1.1.1 data cache (database buffer cache)

Stored in the data cache Oracle system recently accessed data block (cache block). When a user makes a request to the Oracle, if the requested data exists in the cache data, the system reads data directly returned to the user. Otherwise, Oracle system opens the data file read request for a cache data, then returns the data from the buffer to the user. Since the buffer cache is shared by all users, as long as certain data blocks in the data file or other user is currently green hill country, then these blocks will be loaded into the buffer cache, any user access to the same data again so that when when, Oracle oh that is not re-read data from a data file.

Frequently or recently accessed data blocks are placed into the front end of the buffer cache, infrequently accessed data blocks are placed into the rear end of the data cache, data cache when filled, automatically squeezed some non blocks commonly accessed.

High-speed buffer can be further divided into: dirty data to go free zone, reserved area

  • Dirty data area: dirty data stored in the area has been modified data, these data waiting to be written to the data file. When an update or delete statement submitted to the command data to modify some data blocks, these blocks will be marked as "dirty", and then wait through a background process DBWR writes data file.
  • Free area: waiting for data to be written
  • Reserved: Reserved area contains data blocks and expressly reserves are being used by the user as data blocks used in the future (i.e., a cache block)

1.1.2 redo log buffer (redo log buffer cache)

Redo log buffer for storing log information generated during the operation for modifying the database, the log information before writing redo log is first stored in the redo log buffer, then, occurred at a checkpoint or redo when the amount of information in the log buffer reaches a certain peak, the write process by the log LGWR writes redo log files.

Redo log buffer size is determined by the parameters log_buffer. Compared to the data cache, the redo log buffer little effect on the performance of the database, typically large redo log buffer can reduce the number of times of the redo log file I / O read and write, thereby enhancing database performance

1.1.3 shared pool (shared pool)

SGA shared pool of memory area is reserved for caching sql statement, pl / sql statement, data dictionary, resource lock, character set and other control structures. It contains the library buffer cache (library cache) and a dictionary buffer (dictionary cache)

1), high-speed buffer library

It is shared pool, including the two shared areas and private part sql sql region. Library buffer cache to store recently used sql, pl / text plan and execute the sql statement. When executing the same statement again, you can tell directly in the database buffer found before the generated execution plan, no need to repeat resolution, thereby improving efficiency.

2), the dictionary tells buffer (dictionary cache)

Oracle internal management system for storing required data dictionary information, such as user name, a data object and permissions

Shared memory pool size can be changed dynamically determined by the parameters shared_pool_size

alter system set shared_pool_size=30m; -- 修改共享池内存空间为30M
show parameter shared_pool_size; --查看共享池大小

1.1.4 large pool (large pool)

Large pool not be necessary in the SGA memory structure. Only in certain special cases, examples are needed to reduce the large pool Oh that access to a shared pool of pressure:

  • Using the Recovery Manager for backup and restore operations, large pool as I / O buffer
  • When using the I / O simulation asynchronous I / O capabilities, the large pool is used as I / O buffers
  • When performing a large number of sorting operations sql
  • When using parallel query, parallel query process large pool as a place to exchange information with each other

alter system set large_pool_size=16m; --修改大型池的缓冲区为16m
show parameter large_pool_size; --查看大型池的大小

1.1.5 Java pond

Providing memory space for JAVA virtual machine to support java package runs in the database, the size is determined by the java_pool_size

1.1.6 Flow pool

Flow cell between Oracle databases and database for information sharing.

1.2 Program Global Area (PGA)

Program Global Area (program global area) also known as Global Area User Process, its memory area in the process private area rather than the shared area. In the PGA, a server process can only access that part of the PGA resource region belong to it, the sum of the PGA of each service process is the size of the instance PGA. PGA usually by the private sql area and conversation area composed.

  • Private SQL areas: memory structures for information storage and variable sql statement runtime, when each user connects to the instance, creates a session instance, these sessions may create a shared SQL area in the SGA, but PGA may create multiple private sql area. To merge the private sql area together and sharing sql area can get a complete cache data sql statements;
  • Session zone: for storing user session information (such as user login name). If the database is shared server connected mode, the conversation area is located in the SGA, instead of the PGA.show parameter pga --显示当前用户进程的PGA信息

1.3 foreground process

Foreground process including user and server processes, does not belong instance. User foreground process to communicate with examples

1.3.1 User Process

User process refers to the ability to generate and execute applications sql statement. It contains two important concepts: connections and sessions

  • Connections: establish channels of communication between the user and the process instance can be achieved through network-related communication mechanism or on the operating system.
  • Interaction between the user and the example of the connection between the user process and the establishment of example, formed of: a session

1.4 daemon

Background process is running on a set of oracle server daemon, mainly SMON, PMON, DBWR, LGWR CKPT and five processes.
As follows:

[](https://img2018.cnblogs.com/blog/1659632/201911/1659632-20191113235422874-284876720.png

1.4.1 Data write process (DBWR)

Data Writer main task is responsible for the dirty data blocks written back to memory in the data file. Refers to the so-called fast-speed dirty data buffer has been modified data block, the data block is inconsistent with the contents of the data file data blocks. DBWR but not any time soon are all dirty data is written to the data file only when certain conditions are met, before write-back operation:

a, a process when the user performs insert or modify, etc., need to write new data to the cache area, using if sufficient free block is not found in the buffer area to store new data, then the system starts DBWR process Oracle fast and dirty data written to data files, while obtaining free data blocks to store the new data

b, after the checkpoint process starts, it will be mandatory for certain DBWR will write dirty data faster data file

c, when the dirty block is stored in the data cache in more than 3 seconds, DBWR process starts automatic quick and dirty data is written some data files

Note: The maximum number of DBWR process is determined by the parameter spfile db_write_processes in. But the number of DBWR process should not exceed the number of processors in the system, otherwise it will reduce system performance

1.4.2 checkpoint process (CKPT)

The checkpoint process can be seen as an event, the time when the checkpoint occurs, CKPT DBWR will be asked some dirty data blocks written back to the data file.

When the user operation data, Oracle system reads data from the buffer cache to the data files, and a large amount of log information is stored in the redo log buffer, Oracle system when certain conditions are met, the log write process (the LGWR) will log information redo log buffer to write the redo log file group, will automatically switch to another log group after group filled a log, then it will start the checkpoint process

1.4.3 Log Writer Process (LGWR)

Oh, the log write process and the log information redo log buffer to write the redo log files. Oracle system first made changes to this log information is written to the log file, and then modify the result is written to the data file.

Oracle instance will generate a lot of log information on the fly, these log information is first recorded in the SGA redo log buffer when submitting the occurrence of command, or redo log buffer 1/3 full or log information is stored more than 3 seconds, LGWR process will log information from the redo log buffer is read and written to a log file group number of smaller files, when a log group will be filled automatically switch to another group continued to write into. When LGWR process all log files are written again, it will turn again overwriting the first log group, as shown below

1.4.4 archiving process (ARCH)

Archiving process is an optional process, only Oracle is in archive mode, the process to work.

Before the process of archiving the role each group are filled log file about to be covered, the log information is read is about to be covered, and the "read out the log information" is written to the archive log file, as shown in FIG.

The process is determined by the number of archive log log_archive_max_processes parameters, you can turn up the parameters, in order to increase the speed of the archive to reduce LGWR process waiting time, to improve the archive disk write speed.

1.4.5 System Monitor process (SMON)

System monitoring process is the process of implementation of the mandatory return to work when the database system startup. For example, in parallel server mode, SMON can reply in another database failure, the system switches to normal on another server.

1.4.6 Process monitoring process (PMON)

Process monitoring process for monitoring the status of the other processes, the process starts when there is a failure, PMON process fails the user clears, release the resources used by the user process.

1.4.7 Lock process (LCKN)

Lock process is an optional process, the process can occur a plurality of lock mode Parallel Server database to facilitate communication

1.4.8 recovery process (RECO)

Is an optional process used in distributed database mode, return to work for inconsistent data

1.4.9 scheduling process (DNNN)

Scheduling process is an optional process, used in shared server mode, you can start multiple scheduling process.

1.4.10 snapshot process (SNPN)

Process for handling database snapshot snapshot automatically refresh, and is scheduled to run through DBMS_JOB package of database stored procedures

Can query the current instance from v $ bgprocess process the data dictionary information, as follows:


set pagesize 50;
select name,description from v$bgprocess;

2, data dictionary

Oracle data dictionary is an internal database to store information about where to describe the operation of the internal database and management. As the owner of the data tables, creation time, your table space, user access permissions.

About 2.1 Oracle data dictionary

Name of the Oracle data dictionary consists of a prefix and a suffix, use an underscore "_" connected, on behalf of significance as follows:

  • DBA_: represents all information objects contained in the database instance;
  • V $ _: Dynamic view showing an example of the current, and a management system comprising a system optimization view used;
  • USER_: recording object information of the user;
  • GV_: all dynamic view of an example distributed environment, including system management and enhancement view used;
  • ALL_: Record object information and user information are authorized to access the object;

2.2 Oracle data dictionary used

2.2.1 Basic Data Dictionary

Basic data dictionary includes data structures described logical storage and physical storage structure, also includes other database objects that describe information table, such as dba_views, dba_triggers, dba_users the like, as shown in FIG.

Data Dictionary Name Explanation
dba_tablespaces Information about table spaces
dba_ts_quotas All user table space quota
dba_free_space All table space in free space
dba_segments Description database storage of all segments
dba_extents Information database of all data areas
dba_tables Database information for all data tables
dba_tab_columns All tables, views, clusters of columns
dba_views All information in the database view
dba_synoyms Query information about synonyms
dba_sequences Sequence information for all users
dba_constraints All user information table constraints
dba_indexs About database describing all indexes
dba_ind_columns Compressed indexes on all tables and clusters column
dba_triggers All users of the trigger information
dba_source All user information stored procedure
dba_data_files Database file information
dba_tab_grants/privs Licensing information about the object
dba_objects All objects in the database
dba_users Database information for all users

2.2 Common dynamic performance views

Internal Oracle system provides a large number of dynamic performance views, the reason that is dynamic, because these views will continue to update the information in the database during operation. Dynamic view as the name prefixed with v $, these views provide information on the operation of memory and disk, users can only access but can not modify them, commonly used dynamic view as follows:

Data Dictionary Name Explanation
v$database Description information about the database
v$datafile Database using the data files
v$log Extract information about redo log files from the control group
the $ logfile Examples of the group related to reset the log file name and log information
v$archived_log Basic information recording archive log files
v$archived_dest Path information recorded archive log files
v$controlfile Description of the control information file
v$instance Basic example of the information recording
v$system_parameter 显示实例当前有效的参数信息
v$sga 显示实例的SGA大小
v$sgastat 统计SGA使用情况信息
v$parameter 记录初始化参数文件中所有项的值
v$lock 通过访问数据库会话,设置对象锁的所有信息
v$session 有关会话的信息
v$sql 记录sql语句的详细信息
v$sqltext 记录sql语句的语句信息
v$bgprocess 显示后台进程信息
v$process 当前进程信息

Guess you like

Origin www.cnblogs.com/yj411511/p/11846382.html