ORA-27102及ORA-00845故障处理
操作系统版本:Oracle Linux Server release 5.8
数据库版本:11.2.0.3.0
1.ORA-270102故障处理
1.1 故障现象
1.2 故障原因
是因为操作参数没有设置为允许sga所指定大小的内存可以被锁定,操作系统参数max locked memory设置为unlimited
1.3 检查操作系统参数并做修改
1.3.1检查操作系统参数
oracle@devpddb $ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 63943
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 65536
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 32768
cpu time (seconds, -t) unlimited
max user processes (-u) 65536
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
1.3.2修改操作系统参数
修改/etc/security/limits.conf加入以下信息
oracle soft memlock 65536
oracle hard memlock 65536
2.ORA-00845故障处理
再次登录数据库出现ORA-00845
2.1 检查/dev/shm设置
默认为物理内存的50%
该系统的物理内存为8GB,说明/dev/shm已经为物理内存
2.2 检查数据库内存参数
方法一:登录数据库,使用show parameter检查
方法二:登录数据库,生成pfile进行查看
sqlplus / as sysdba
create pfile='/home/oracle/initpfile_12.2.ora' from spfile;
说明:由于此处数据库实例不可用,所以采用方法二查看
2.3 调整数据库内存参数
2.3.1 减小memory_target
vi pfile20180713.ora
*db*.__db_cache_size=1828716544
*db*.__java_pool_size=16777216
*db*.__large_pool_size=16777216
*db*.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
*db*.__pga_aggregate_target=2030043136
*db*.__sga_target=3808428032
*db*.__shared_io_pool_size=0
*db*.__shared_pool_size=1895825408
*db*.__streams_pool_size=16777216
*.audit_file_dest='/u01/app/oracle/admin/***/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/***/control01.ctl','/u01/app/oracle/oradata/***/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='***'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=***XDB)'
*.memory_target=4294967296 #5829033984
*.nls_language='SIMPLIFIED CHINESE'
*.nls_territory='CHINA'
*.open_cursors=300
*.processes=3000
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=3305
*.undo_tablespace='UNDOTBS1'
报错如下:
startup pfile='/home/oracle/pfile20180713.ora';
ORA-27100: shared memory realm already exists
Linux-x86_64 Error: 17: File exists
2.3.2 再次调整参数
再次显式关库
shutdown abort
修改参数文件
vi pfile20180713.ora
*db*.__db_cache_size=1828716544
*db*.__java_pool_size=16777216
*db*.__large_pool_size=16777216
*db*.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
*db*.__pga_aggregate_target=2030043136
*db*.__sga_target=2576980377 #3808428032
*db*.__shared_io_pool_size=0
*db*.__shared_pool_size=1895825408
*db*.__streams_pool_size=16777216
*.audit_file_dest='/u01/app/oracle/admin/***/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/***/control01.ctl','/u01/app/oracle/oradata/***/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='***'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=devpddbXDB)'
*.sga_max_size=524288000 #add
*.memory_target=4294967296 #5829033984
*.nls_language='SIMPLIFIED CHINESE'
*.nls_territory='CHINA'
*.open_cursors=300
*.processes=3000
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=3305
*.undo_tablespace='UNDOTBS1'
2.3.3 使用pfile启动数据库
startup pfile='/home/oracle/pfile20180713.ora';
问题解决,接下来重启数据库
2.3.4 重启数据库
create spfile from pfile='/home/oracle/pfile20180713.ora';
shutdown immediate
startup
3.知识补充
3.1SGA和PGA关系梳理
SGA_TARGET始终要 <= sga_max_size
3.1.1memory_target=非0
- sga_target ≤ memory_target ≤ memory_max_target
- sga_max_size ≤ memory_target
- memory_target ≥ sga_target+pga_aggregate_target
3.1.2memory_target=0
- sga_target < memory_max_target
- sga_target≤sga_max_size≤memory_target
3.2memory_target相关
- memory_target为总内存的80%
- sga_max_size和__sga_target为memory_target的60%
3.3内存有关的视图
select * from v$sga_dynamic_components
select * from v$sga_dynamic_free_memory
select * from v$pgastat
select * from v$sga
select * from v$sgastat
SELECT NAME, PHYSICAL_READS, DB_BLOCK_GETS, CONSISTENT_GETS,
1 - (PHYSICAL_READS / (DB_BLOCK_GETS + CONSISTENT_GETS)) "Hit Ratio" FROM V$BUFFER_POOL_STATISTICS;
3.4SGA参数值
SQL> select * from v$sga;
NAME VALUE
---------- --------------------
Fixed Size 454032
Variable Size 109051904
Database Buffers 385875968
Redo Buffers 667648
Fixed Size:
oracle 的不同平台和不同版本下可能不一样,但对于确定环境是一个固定的值,里面存储了 SGA 各部分组件的信息,可以看作引导建立 SGA 的区域。
Variable Size :
包含了 shared_pool_size、java_pool_size、large_pool_size 等内存设置
Database Buffers :
指数 据缓 冲区:
在 8i 中包 含 db_block_buffer×db_block_size、buffer_pool_keep、buffer_pool_recycle 三 部 分内 存 。
在 9i 中 包 含 db_cache_size 、db_keep_cache_size、db_recycle_cache_size、db_nk_cache_size。
Redo Buffers :
指日志缓冲区,log_buffer
3.5ORACLE内存参数关系梳理
参考链接:
1.ORA-27102:out of memory Linux-x86_64 Error: 12: Cannot allocate memory的处理
2.实例启动时报ORA-00845的解决方法
3.Oracle基础知识–内存参数设置
4.oracle三对内存参数间关系之4sga_参数和memory_参数这两类上下级层次参数间的关系
5.ORACLE内存分配和调优总结