Home Database Mysql Tutorial 认识Oracle数据库System Global Area (SGA)

认识Oracle数据库System Global Area (SGA)

Jun 07, 2016 pm 04:53 PM
oracle

1 概述 Oracle SGA区的监控和管理,是数据库日常维护的重要内容。本文详细介绍SGA的基本概念,SGA运行情况检查,以及SGA的参

 1 概述

  Oracle SGA区的监控和管理,是数据库日常维护的重要内容。本文详细介绍SGA的基本概念,SGA运行情况检查,以及SGA的参数设置原则,希望对大家的有所帮助。

  2 SGA的基本概念

  当启动Oracle数据库时,系统会先在内存内规划一个固定区域,用来储存用户需要的数据,以及Oracle运行时必备的系统信息。我们称此区域为系统全局区(System Global Area),简称SGA。

  SGA 包含数个重要区域,分别是:

  ■ Database Buffer Cache (数据库缓冲区)

  ■ Redo Log Buffer (重做日志缓冲区)

  ■ Shared Pool (共享区)

  ■ 其它,如Java pool, Large pool

  2.1 Database Buffer Cache (数据库缓冲区)

  数据库缓冲区的作用主要是在内存中缓存从数据库中读取的数据块。数据库缓冲区越大,为用户已经在内存里的共享数据提供的内存就越大,这样可以减少所需要的磁盘物理读。

  在9i以前数据库缓冲区的大小是由db_block_buffers*db_block_size 来决定大小的。db_block_size参数是在创建数据库时设置的,OLTP系统的db_block_size一般设置为8k。

  在9i中,数据库缓冲区的大小由db_cache_size决定,8i中的db_block_buffers被取消。db_cache_size的单位是字节,它直接决定了数据库缓冲区的大小,而不再是块的数量。

  2.2 Shared Pool (共享区)

  共享区由三部分组成,分别是Dictionary cache(包括数据字典的定义,如表结构、权限等),Library cache(包括共享的sql游标,sql原代码以及执行计划、存储过程和会话信息)和Control structure。它的大小由初始化参数shared_pool_size控制,它的作用是缓存已经被解析过的SQL,使其能被重用,不用再解析。SQL的解析非常消耗CPU的资源,如果一条SQL在Shared pool中已经存在,则进行的仅是软解析(在Shared pool中寻找相同SQL),这将大大提高数据库的运行效率。当然,这部分内存也并非越大越好,太大的Shared pool,oracle为了维护共享结构,将付出更大的管理开销。建议在150M-500M之间。如果系统内存为1G,该值可设为150M-200M;如果为2G,该值设为250M-300M;每增加1G内存,该值增加100M;但该值最大不应超过500M。

  2.3 Redo Log Buffer (重做日志缓冲区)

  Log_buffer是重做日志缓冲区,对数据库的任何修改都按顺序被记录在该缓冲,然后由LGWR 进程将它写入磁盘。LGWR的写入条件是:用户提交、有1/3 重做日志缓冲区未被写入磁盘、有大于1M 重做日志缓冲区未被写入磁盘、超时、DBWR需要写入的数据的SCN 号大于LGWR 记录的SCN 号,DBWR 触发LGWR写入。

  从中可以看出,,大于1M的log buffer值意义并不大。重做日志缓冲区的大小由初始化参数log_buffer设定。

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1653
14
PHP Tutorial
1251
29
C# Tutorial
1224
24
What to do if the oracle can't be opened What to do if the oracle can't be opened Apr 11, 2025 pm 10:06 PM

Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

How to solve the problem of closing oracle cursor How to solve the problem of closing oracle cursor Apr 11, 2025 pm 10:18 PM

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

How to create cursors in oracle loop How to create cursors in oracle loop Apr 12, 2025 am 06:18 AM

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

What steps are required to configure CentOS in HDFS What steps are required to configure CentOS in HDFS Apr 14, 2025 pm 06:42 PM

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

Oracle's Role in the Business World Oracle's Role in the Business World Apr 23, 2025 am 12:01 AM

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

What to do if the oracle log is full What to do if the oracle log is full Apr 12, 2025 am 06:09 AM

When Oracle log files are full, the following solutions can be adopted: 1) Clean old log files; 2) Increase the log file size; 3) Increase the log file group; 4) Set up automatic log management; 5) Reinitialize the database. Before implementing any solution, it is recommended to back up the database to prevent data loss.

How to stop oracle database How to stop oracle database Apr 12, 2025 am 06:12 AM

To stop an Oracle database, perform the following steps: 1. Connect to the database; 2. Shutdown immediately; 3. Shutdown abort completely.

How to create oracle dynamic sql How to create oracle dynamic sql Apr 12, 2025 am 06:06 AM

SQL statements can be created and executed based on runtime input by using Oracle's dynamic SQL. The steps include: preparing an empty string variable to store dynamically generated SQL statements. Use the EXECUTE IMMEDIATE or PREPARE statement to compile and execute dynamic SQL statements. Use bind variable to pass user input or other dynamic values ​​to dynamic SQL. Use EXECUTE IMMEDIATE or EXECUTE to execute dynamic SQL statements.

See all articles