这个新特性算不上惊人,但是却是Oracle在内存管理上的又一重要增强。
如果这个参数设置过高,在实例启动时可能会出现如下错误提示:
SQL*Plus: Release 11.1.0.5.0 - Beta on Sun Jul 29 08:35:28 2007
Copyright (c) 1982, 2007, Oracle. All rights reserved.Connected to an idle instance.
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
这一提示不是指特性不支持,而是你需要去调整内存设置。
在设置了这个参数后,自动内存调整启用:
SQL> show parameter memoryNAME TYPE VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address integer 0
memory_max_target big integer 416M
memory_target big integer 416M
shared_memory_address integer 0
类似SGA_MAX_SIZE与SGA_TARGET一样,MEMORY_MAX_TARGET与MEMORY_TARGET成对出现,这一特性的出现使得PGA+SGA作为整体内存使用被一致的纳入自动管理范畴。
而同样与Oracle10g类似,设置了自动内存管理之后,PGA_AGGREGATE_TARGET参数不再需要设置,代之发挥作用的参数是带有2个下划线的__PGA_AGGREGATE_TARGET参数,我们可以来看一下这几个参数的解释:
SQL> select ksppinm,ksppdesc from x$ksppi
2 where ksppinm like '%pga%';KSPPINM KSPPDESC
----------------------- --------------------------------------------------
_pga_large_extent_size PGA large extent size
_use_ism_for_pga Use ISM for allocating large extents
_kdli_sio_pga use PGA allocations for direct IO
_kdli_sio_pga_top PGA allocations come from toplevel PGA heap
pga_aggregate_target Target size for the aggregate PGA memory consumed by the instance
__pga_aggregate_target Current target size for the aggregate PGA memory consumed
_pga_max_size Maximum size of the PGA memory for one process
Oracle 11g sga_target 参数设置
今天在一台linux测试机上装了Oracle 11g,安装好以后按照惯例调整sga_target 1G,pga_aggregate_target 200M
(这2个参数在11g里面默认是0),然后重启数据库
结果报错
ORA-00844: Parameter not taking MEMORY_TARGET into account, see alert log for more information
MEMORY_TARGET?新参数?虽然在安装过程中瞟过一眼,但是也没太多注意,后来理解MEMORY_TARGET就是原来10g的
sga_target + pga_aggregate_target的总和,越来越智能了。
再看导致错误原因:
由于设置了Oracle的MEMORY_TARGET参数的值小于了SGA_TARGET和PGA_TARGET的总和,因此报错。
但是此时数据库已经启不来了,在数据库不能更改spfile的情况下,我们可以更改pfile,再用pfile启动
SQL> create pfile ='/home/oracle/initora11g.ora' from spfile;
SQL> !echo '*.memory_target=1024m' >>'/home/oracle/initora11g.ora';
将pfile里面的memory_target设置成1G
报错,再次验证memory_target>= sga_target + pga_aggregate_target
ORA-00838: Specified value of MEMORY_TARGET is too small, needs to be at least 1224M
ORA-01078: failure in processing system parameters
再改
SQL> !echo '*.memory_target=1224m' >>'/home/oracle/initora11g.ora';
SQL> !echo '*.sga_target=0' >>'/home/oracle/initora11g.ora';
报新错误了又
ORA-00845: MEMORY_TARGET not supported on this system
这个问题是由于设置SGA的大小超过了操作系统/dev/shm的大小
解决办法:http://yangtingkun.itpub.net/post/468/408235
最终启动成功
启动后再改回从spfile启动
SQL>create spfile from pfile = '/home/oracle/initora11g.ora';
然后再启动一次
SQL> startup
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2151248 bytes
Variable Size 511708336 bytes
Database Buffers 549453824 bytes
Redo Buffers 5623808 bytes
Database mounted.
Database opened.
最后
SQL> show parameter target;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target integer 0
db_flashback_retention_target integer 1440
fast_start_io_target integer 0
fast_start_mttr_target integer 0
memory_max_target big integer 1300M
memory_target big integer 1224M
pga_aggregate_target big integer 0
sga_target big integer 0
以下是http://yangtingkun.itpub.net/post/468/408235 正文内容
Oracle 11g的Linux版本在修改了MEMORY_TARGET或者SGA_TARGET后启动可能会报错:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
这个问题是由于设置SGA的大小超过了操作系统/dev/shm的大小:
[root@enterprice64 ~]# df -k /dev/shm
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 4089416 0 4089416 0% /dev/shm
Oracle在metalink的文档:Doc ID: Note:460506.1中进行了说明。解决这个问题只有两个方法,一种是修改初始化参数,使得初始化参数中SGA的设置小于/dev/shm的大小,另一种方法就是调整/dev/shm的大小。
修改/dev/shm的大小可以通过修改/etc/fstab来实现:
[root@enterprice64 ~]# vi /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
LABEL=/data /data ext3 defaults 1 2
devpts /dev/pts devpts gid=5,mode=620 0 0
#tmpfs /dev/shm tmpfs defaults 0 0
tmpfs /dev/shm tmpfs defaults,size=10240M 0 0
LABEL=/home /home ext3 defaults 1 2
LABEL=/opt /opt ext3 defaults 1 2
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
LABEL=/usr /usr ext3 defaults 1 2
LABEL=/var /var ext3 defaults 1 2
LABEL=SWAP-sda8 swap swap defaults 0 0
~
~
"/etc/fstab" 13L, 965C written
[root@enterprice64 ~]# umount /dev/shm
[root@enterprice64 ~]# mount /dev/shm
[root@enterprice64 ~]# df -k /dev/shm
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 10485760 0 10485760 0% /dev/shm
[root@enterprice64 ~]# su - oracle
[oracle@enterprice64 ~]$ sqlplus "/ as sysdba"
SQL*Plus: Release 11.1.0.6.0 - Production on Tue Oct 23 15:42:42 2007
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 4743446528 bytes
Fixed Size 2143824 bytes
Variable Size 3892316592 bytes
Database Buffers 805306368 bytes
Redo Buffers 43679744 bytes
Database mounted.
Database opened.
修改/etc/fstab,重新mount /dev/shm,然后就可以启动数据库