Home Database Mysql Tutorial Oracle数据库服务器升级内存需要考虑的问题

Oracle数据库服务器升级内存需要考虑的问题

Jun 07, 2016 pm 05:28 PM

原来的Oracle数据库服务器运行在HP DL388G7服务器上面,内存32G,由于业务增长,内存吃紧,加上时不时出现服务器硬件故障,由于是

项目背景:

原来的Oracle数据库服务器运行在HP DL388G7服务器上面,内存32G,由于业务增长,内存吃紧,加上时不时出现服务器硬件故障,由于是单实例单服务器,存在单点发现,于是打算采取一些措施改善一下:

1)升级服务器内存

2)并搭建服务器操作系统级别的双机

3)迁移数据库数据到新服务器

前面已经写过数据迁移相关的文章,题目为“EXP/IMP迁移数据”,链接如下:

前面已经写过数据迁移相关的文章,题目为SUSE Linux HA双机搭建”,链接如下:

————————————————————————————————————————————

如果你的系统业务量加大,数据库服务器的压力加大,需要物理主机加内存,应该加多少,需要如何调整参数?本文教你一步一步做。

  • 1 理论方法
  • 需要调整的参数包括SGA, PGA, process,session数值,还有内核参数中的shmall,shmmax。

  • 1.1 SGA和PGA的计算方法

  • SGA=物理内存总和*50%
    PGA=物理内存总和*20%
    剩下的30%留给操作系统使用。如果内存资源比较紧张,需要考虑成本的系统,如果数据库压力也并不大的话,其实可以将sga和pga的大小都设置得小一些,一点一点做调整。比如将物理内存的20%分配给SGA,将5%分配给PGA,然后根据实际情况做调整即可。

  • 1.2 内核参数设置计算方法
  • 解释一下内核中shmall,shmmax这俩参数的设置方法:
    shmmax

    shmall>=sga(G)*1024*1024*1024/page_size
    这里推荐大家直接使用SGA和PGA的和来计算比较好。

    page_size可以通过如下命令查询:
    getconf PAGE_SIZE

     

    shmmax是指单个共享内存段的最大值,单位为bytes,就是俗称的B. 一般推荐为物理内存的一半,可以稍微大点,我喜欢设置为sga和pga的和的大小。

    shmall=SGA(G)/page_size(bytes)=sga(G)*1024*1024*1024/page_size, 比如sga大小为22G,page_size=4kb=4096bytes,那么shmall=22*1024*1024*1024bytes/4096bytes=5767168
    shmall是指共享内存页面的总数目,共享内存你可以连接为SGA,因为对oracle来说,PGA是不共享的,好吧就当我说的废话。
    页面的大小一般情况下是4KB,单位是bytes,通过命令get page_size查到的数值一般都是4096bytes

    总结:要注意单位,shmmax指的是内存值,有单位,单位是bytes,page_size的单位为bytes,shmall无单位,它只是一个数目,表示页面数量。

     

    单位换算表:
    1 byte (B) = 8 bits (b) 字节=8个二进制位
    1 Kilobyte(K/KB)=2^10 bytes=1,024 bytes 千字节
    1 Megabyte(M/MB)=2^20 bytes=1,048,576 bytes 兆字节
    1 Gigabyte(G/GB)=2^30 bytes=1,073,741,824 bytes 千兆字节
    1 Terabyte(T/TB)=2^40 bytes=1,099,511,627,776 bytes吉字节

     

  • 2 操作实例
  • 2.1收集数据库内存分配现状
  • # free -m
    total used free shared buffers cached
    Mem: 32096 29072 3024 0 49 22406
    -/+ buffers/cache: 6616 25480
    Swap: 32765 847 31918
    su - oracle
    sqlplus / as sysdba

    SQL*Plus: Release 10.2.0.5.0 - Production on Fri Mar 29 16:09:42 2013

    Copyright (c) 1982, 2010, Oracle. All Rights Reserved.


    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

    SQL> show parameter sga

    NAME TYPE VALUE
    ------------------------------------ ----------- ------------------------------
    lock_sga boolean FALSE
    pre_page_sga boolean FALSE
    sga_max_size big integer 8000M
    sga_target big integer 8000M
    SQL> show parameter pga

    NAME TYPE VALUE
    ------------------------------------ ----------- ------------------------------
    pga_aggregate_target big integer 5606M


    SQL> show parameter processes

    NAME TYPE VALUE
    ------------------------------------ ----------- ------------------------------
    aq_tm_processes integer 0
    db_writer_processes integer 8
    gcs_server_processes integer 0
    job_queue_processes integer 10
    log_archive_max_processes integer 2
    processes integer 900

    SQL> show parameter sessions

    NAME TYPE VALUE
    ------------------------------------ ----------- ------------------------------
    java_max_sessionspace_size integer 0
    java_soft_sessionspace_limit integer 0
    license_max_sessions integer 0
    license_sessions_warning integer 0
    logmnr_max_persistent_sessions integer 1
    sessions integer 995
    shared_server_sessions integer

    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

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Article

    R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
    2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    Hello Kitty Island Adventure: How To Get Giant Seeds
    1 months ago By 尊渡假赌尊渡假赌尊渡假赌
    Two Point Museum: All Exhibits And Where To Find Them
    1 months ago By 尊渡假赌尊渡假赌尊渡假赌

    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)

    How do you alter a table in MySQL using the ALTER TABLE statement? How do you alter a table in MySQL using the ALTER TABLE statement? Mar 19, 2025 pm 03:51 PM

    The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

    How do I configure SSL/TLS encryption for MySQL connections? How do I configure SSL/TLS encryption for MySQL connections? Mar 18, 2025 pm 12:01 PM

    Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

    How do you handle large datasets in MySQL? How do you handle large datasets in MySQL? Mar 21, 2025 pm 12:15 PM

    Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

    What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? Mar 21, 2025 pm 06:28 PM

    Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

    How do you drop a table in MySQL using the DROP TABLE statement? How do you drop a table in MySQL using the DROP TABLE statement? Mar 19, 2025 pm 03:52 PM

    The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

    How do you create indexes on JSON columns? How do you create indexes on JSON columns? Mar 21, 2025 pm 12:13 PM

    The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

    How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)? How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)? Mar 18, 2025 pm 12:00 PM

    Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

    How do you represent relationships using foreign keys? How do you represent relationships using foreign keys? Mar 19, 2025 pm 03:48 PM

    Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

    See all articles