Oracle数据库服务器升级内存需要考虑的问题
原来的Oracle数据库服务器运行在HP DL388G7服务器上面,内存32G,由于业务增长,内存吃紧,加上时不时出现服务器硬件故障,由于是
项目背景:
原来的Oracle数据库服务器运行在HP DL388G7服务器上面,内存32G,由于业务增长,内存吃紧,加上时不时出现服务器硬件故障,由于是单实例单服务器,存在单点发现,于是打算采取一些措施改善一下:
1)升级服务器内存
2)并搭建服务器操作系统级别的双机
3)迁移数据库数据到新服务器
前面已经写过数据迁移相关的文章,题目为“EXP/IMP迁移数据”,链接如下:
前面已经写过数据迁移相关的文章,题目为“SUSE Linux HA双机搭建”,链接如下:
————————————————————————————————————————————
如果你的系统业务量加大,数据库服务器的压力加大,需要物理主机加内存,应该加多少,需要如何调整参数?本文教你一步一步做。
需要调整的参数包括SGA, PGA, process,session数值,还有内核参数中的shmall,shmmax。
SGA=物理内存总和*50%
PGA=物理内存总和*20%
剩下的30%留给操作系统使用。如果内存资源比较紧张,需要考虑成本的系统,如果数据库压力也并不大的话,其实可以将sga和pga的大小都设置得小一些,一点一点做调整。比如将物理内存的20%分配给SGA,将5%分配给PGA,然后根据实际情况做调整即可。
解释一下内核中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吉字节
# 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

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is suitable for small and large enterprises. 1) Small businesses can use MySQL for basic data management, such as storing customer information. 2) Large enterprises can use MySQL to process massive data and complex business logic to optimize query performance and transaction processing.

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.
