原来的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

Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.

ToaddauserremotelytoMySQL,followthesesteps:1)ConnecttoMySQLasroot,2)Createanewuserwithremoteaccess,3)Grantnecessaryprivileges,and4)Flushprivileges.BecautiousofsecurityrisksbylimitingprivilegesandaccesstospecificIPs,ensuringstrongpasswords,andmonitori

TostorestringsefficientlyinMySQL,choosetherightdatatypebasedonyourneeds:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseTEXTforlong-formtextcontent.4)UseBLOBforbinarydatalikeimages.Considerstorageov

When selecting MySQL's BLOB and TEXT data types, BLOB is suitable for storing binary data, and TEXT is suitable for storing text data. 1) BLOB is suitable for binary data such as pictures and audio, 2) TEXT is suitable for text data such as articles and comments. When choosing, data properties and performance optimization must be considered.

No,youshouldnotusetherootuserinMySQLforyourproduct.Instead,createspecificuserswithlimitedprivilegestoenhancesecurityandperformance:1)Createanewuserwithastrongpassword,2)Grantonlynecessarypermissionstothisuser,3)Regularlyreviewandupdateuserpermissions

MySQLstringdatatypesshouldbechosenbasedondatacharacteristicsandusecases:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseBINARYorVARBINARYforbinarydatalikecryptographickeys.4)UseBLOBorTEXTforlargeuns


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

SublimeText3 English version
Recommended: Win version, supports code prompts!

Zend Studio 13.0.1
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
