ORA-00838: Specified value of MEMORY_TARGET is too small(转)

1. 测试环境
OS: RHEL5U5(32bit)
DB: Oracle 11.2.0.3.0(32bit)

2.   异常原因. 
2.1 oracle 11g默认sga_target为0,如下图, Oracle 10g开始,引入SGA_TARGET初始化参数, 让oracle自动管理SGA中(Buffer cache (DB_CACHE_SIZE),Shared pool (SHARED_POOL_SIZE),Large pool (LARGE_POOL_SIZE),Java pool (JAVA_POOL_SIZE),Streams pool (STREAMS_POOL_SIZE))的内存自动分配,即ASSM(Automatic Shared Memory Management). 如下为引自oracle官方文档解释.如下.

SYS> show parameter sga;

NAME                                 TYPE           VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean        FALSE
pre_page_sga                     boolean       FALSE
sga_max_size                      big integer   632M
sga_target                           big integer    0
SYS>

SGA_TARGET官方解释.

SGA_TARGET

Property Description
Parameter type Big integer
Syntax SGA_TARGET = integer [K | M | G]
Default value 0 (SGA autotuning is disabled for DEFERRED mode autotuning requests, but allowed for IMMEDIATE mode autotuning requests)
Modifiable ALTER SYSTEM
Range of values 64 MB to operating system-dependent
Basic Yes

SGA_TARGET specifies the total size of all SGA components. If SGA_TARGET is specified, then the following memory pools are automatically sized:

  • Buffer cache (DB_CACHE_SIZE)
  • Shared pool (SHARED_POOL_SIZE)
  • Large pool (LARGE_POOL_SIZE)
  • Java pool (JAVA_POOL_SIZE)
  • Streams pool (STREAMS_POOL_SIZE)

If these automatically tuned memory pools are set to nonzero values, then those values are used as minimum levels by Automatic Shared Memory Management. You would set minimum values if an application component needs a minimum amount of memory to function properly.

The following pools are manually sized components and are not affected by Automatic Shared Memory Management:

  • Log buffer
  • Other buffer caches, such as KEEP, RECYCLE, and other block sizes
  • Fixed SGA and other internal allocations

2.2 给SGA_TARGET设置与SGA_MAX_SIZE(632M)相册的值,打开ASSM功能.
SYS> alter system set sga_target=632M SCOPE=SPFILE;
System altered.

3 重启DB
3.1  SYS> startup force
ORA-00838: Specified value of MEMORY_TARGET is too small, needs to be at least 644M
SYS> show parameter pga;
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 54 Serial number: 5

3.2 根据如上报错信息.可以看出SGA设置大了. 导致PGA小了, 故报错. MEMORY_TARGET=PGA+SGA.   SGA的最少值为10M,最大值为 4096 GB - 1, 见官方文档.

PGA_AGGREGATE_TARGET

Property Description
Parameter type Big integer
Syntax PGA_AGGREGATE_TARGET = integer [K | M | G]
Default value 10 MB or 20% of the size of the SGA, whichever is greater
Modifiable ALTER SYSTEM
Range of values Minimum: 10 MB

Maximum: 4096 GB - 1

Basic Yes

PGA_AGGREGATE_TARGET specifies the target aggregate PGA memory available to all server processes attached to the instance.

3.3 查看ORA-00838 报错, ORACLE解释.

jietestdb<*test11g*/u01/product/oracle/dbs>$oerr ora 00838
00838, 00000, "Specified value of MEMORY_TARGET is too small, needs to be at least %sM"
// *Cause: The specified value of MEMORY_TARGET was less than the sum of the 
//         specified values for SGA_TARGET and PGA_AGGREGATE_TARGET.
// *Action: Set MEMORY_TARGET to at least the recommended value.

由上ORA-00838,ORACLE解释可以看出, 减少SGA值,或增大MEMORY_TARGET值, 或还原修改前状态即可解决问题.
3.1 第一种解决方法: 还原先前状态,不做SGA_TARGET或MEMORY_TARGET值改变.
     3.1.1 此DB已经被shutdown了, 直接startup DB无法启动, 如下报错.
SYS> startup
ORA-00838: Specified value of MEMORY_TARGET is too small, needs to be at least 644M
      3.1.2 因DB在关闭状态下,也可以由spfile创建pfile,或由pfile 创建spfile. 此时我们测试DB spfiletest11g.ora中,已经包含sga_target值,如下图.

jietestdb<*test11g*/u01/product/oracle/dbs>$
jietestdb<*test11g*/u01/product/oracle/dbs>$strings spfiletest11g.ora 
test11g.__db_cache_size=155189248
test11g.__java_pool_size=4194304
test11g.__large_pool_size=4194304
test11g.__oracle_base=‘/u01/product‘#ORACLE_BASE set from environment
test11g.__pga_aggregate_target=230686720
test11g.__sga_target=432013312
test11g.__shared_io_pool_size=0
test11g.__shared_pool_size=251658240
test11g.__streams_pool_size=8388608
*.audit_file_dest=‘/u01/product/admin/test11g/adump‘
*.audit_trail=‘db‘
*.compatible=‘11.2.0.0.0‘
*.control_files=‘/u01/product/oradata/test
11g/control01.ctl‘,‘/u01/product/oradata/test11g/control02.ctl‘,‘/data/test11g/control03.ctl‘
*.db_block_size=8192
*.db_domain=‘‘
*.db_name=‘test11g‘
*.db_recovery_file_dest=‘/u01/product/fast_recovery_area‘
*.db_recovery_file_dest_size=5218762752
*.diagnostic_dest=‘/u01/product‘
*.dispatchers=‘(PROTOCOL=TCP) (SERVICE=test11gXDB)‘
*.fast_start_mttr_target=0
*.local_listener=‘LISTENER_TEST11G‘
*.log_archive_dest_1=‘LOCATION=/data/test11g/arch/‘
*.log_archive_format=‘%t_%s_%r.arc‘
*.memory_target=661651456
*.open_cursors=1000
*.processes=1000
*.remote_login_passwordfile=‘EXCLUSIVE‘
*.sec_case_sensitive_logon=FALSE
*.sessions=1105
*.sga_target=662700032
*.undo_tablespace=‘UNDOTBS1‘

3.1.3 此时由 SPFILETEST11G.ORA创建INITTEST11G.ORA
SYS> create pfile from spfile;
File created.
     3.1.4 VIM修改创建的inittest11g.ora文件,删除*.sga_target=662700032的值 (因为spfiletest11g.ora为二进制文件,不能用VI/VIM命令直接修改),  重新创建spfiletest11g.ora,此时spfiletest11g.ora中就不会包含sga_target的值.
SYS> create spfile from pfile;
File created.
    3.1.5 启动DB OK
SYS> startup
ORACLE instance started.
Total System Global Area  661209088 bytes
Fixed Size                  1346980 bytes
Variable Size             499122780 bytes
Database Buffers          155189248 bytes
Redo Buffers                5550080 bytes
Database mounted.
Database opened.
  
3.2 第二种方法,由如上方法创建出来的inittest11.ora PFILE初始化文档中, 直接加上*.sga_target=X (X为一个数值, 前提包证SGA的X值,被MEMORY_TARGET的值632M,减去剩余PGA的值大于10M(PGA最小值)),由修改后的PFILE创建SPFILE, 直接启动DB即可.
3.3 第三种方法,与第二种方法类似, 假如不想修改SGA_TARGET的值, 可以在pfile初始化文档中, 修改增大 *.memory_target=Y(Y为一个数值,Y值不能大于物理内存大小)的值. 在由修改后的PFILE,创建SPFILE启动DB.

4. 小结.
4.1 如果是正式库PGA不要设置太小,要根据业务需要, 如果用户进程有大的并发,排序等需要把PGA设置大点. 正常PGA默认值为20%的MEMORY_TARGET值, SGA为80%的MEMORY_TARGET值.
4.2 pfile与spfile如上文设置的新值, sga_target或memory_target在DB启动后,都会覆盖先前DB设置的sga_target或memory_target的值.

http://blog.itpub.net/28569596/viewspace-1172469/

时间: 2024-11-08 19:24:29

ORA-00838: Specified value of MEMORY_TARGET is too small(转)的相关文章

ORACLE数据库 memory_target SGA 大小

修改 memory_target 用oracle用户登录,sqlplus "/as sysdba"SQL> show parameters target;     show parameters spfile;     alter system set memory_max_target=4G scope=spfile;     alter system set memory_max_target=4G scope=both;     tmpfs /dev/shm tmpfs d

redhat6.4中手动创建oracle11g数据库

确定好数据库名和实例名 1.设置环境变量 2.创建需要的目录 mkdir -p $ORACLE_BASE/oradata/DB_NAME mkdir -p $ORACLE_BASE/admin/<sid>/adump mkdir -p $ORACLE_BASE/flash_recovery_area 3.创建参数文件pfile cp $ORACLE_HOME/dbs/init.ora $ORACLE_HOME/dbs/initorcl.ora 内容如下 db_name='ORCL' memor

修改spfile导致oracle无法启动

今天尝试着调整一下数据库的性能,由于疏忽没有做好备份(spfile.ora),直接修改了MEMORY_TARGET参数,alter system set MEMORY_TARGET=4096m;导致重启ORACLE时不能连接ORACLE时报:ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务开始是以为数据库崩溃,因为无法登陆,也不能通过指定pfile启动,都恨不得重装数据库了,后来一想,既然报的是“服务名”,就从这里着手吧,发现未设置对服务名的监听(Oracle10g默认

ORA-00838: Specified value of MEMORY_TARGET is too small

在解决ORA-00020:maximum number of processes (150) exceeded问题时,不小心将processes值设置太大,就会造成这个问题. 但此时DB已经被shutdown了, 直接startup DB无法启动, 如下报错.SYS> startupORA-00838: Specified value of MEMORY_TARGET is too small, needs to be at least 644M 解决方法: 1.创建pfile并修改proces

ORA-00845 : MEMORY_TARGET not supported on this system(调大数据库内存无法启动)

问题描述:调大数据库内存后,启动数据库报 ORA-00845 : MEMORY_TARGET not supported on this system . -- 调大数据库内存后,数据库启动报错[[email protected] bin]# ./srvctl start database -d jcdydbPRCR-1079 : Failed to start resource ora.jcdydb.dbCRS-5017: The resource action "ora.jcdydb.db

oerr ora 000845解决方法是扩大/dev/shm空间

打开虚拟机发现实例起不来 [[email protected] ~]# su - oraclesq[[email protected] ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Tue Aug 2 14:59:54 2016 Copyright (c) 1982, 2013, Oracle.  All rights reserved. Connected to an idle instance. [ema

startup alter.log spfile.ora

SQL> select * from v$version where rownum=1; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production SQL> !cat /etc/issue Enterprise Linux Enterpr

Oracle初始化参数之memory_target

一.引言: Oracle 9i引入pga_aggregate_target,可以自动对PGA进行调整: Oracle 10g引入sga_target,可以自动对SGA进行调整: Oracle 11g则对这两部分进行综合,引入memory_target,可以自动调整所有的内存,这就是新引入的自动内存管理特性. 二.本文说明: 操作系统:rhel 5.4 x32 数据库:oracle 11g r2 三.memory_target的介绍:   3.1.下面通过示例了解一下memory_target的设

oracle启动报错ORA-00845: MEMORY_TARGET not supported on this system解决办法

oracle启动报错ORA-00845: MEMORY_TARGET not supported on this system 原因可能:ORACLE MEMORY_TARGET参数设置超过了oracle服务器本身内存.或超过了现在服务器空闲内存(就是oracle启动时无法获取设置的内存) eg: oracle version:11gR2 OS version:RedHat 6.4企业版 服务器:虚拟机 分析步骤: 1.查看当前 MEMORY_TARGET参数的值为*.memory_target