Chinaunix首页 | 论坛 | 博客
  • 博客访问: 487292
  • 博文数量: 80
  • 博客积分: 2393
  • 博客等级: 大尉
  • 技术积分: 1434
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-03 21:46
个人简介

己所不欲勿施于人!

文章分类

全部博文(80)

文章存档

2017年(1)

2016年(9)

2014年(1)

2013年(17)

2012年(5)

2011年(13)

2010年(9)

2009年(8)

2008年(17)

分类: Oracle

2016-03-31 10:09:27

网上很多关于这个错误的文章,有些还引用了Oracle文档中的说明。

Setting Memory Target at Instance Startup on Linux
Starting with Oracle Database 11g Release 1 (11.1), Oracle provides the option of automatically managing SGA and PGA with a combined MEMORY_TARGETparameter without having to set SGA_TARGET and PGA_AGGREGATE_TARGET explicitly. This is supported on Linux, Windows, Solaris, HPUX, and AIX (reference Bug 7258378).
If you see the ORA-00845 error reported on Linux machines at Oracle instance startup when using the MEMORY_TARGET parameter, then check the size of /dev/shm. If /dev/shm is not configured, then mount it sized to be at least the value of MEMORY_TARGET. If /dev/shm is configured but the amount of available space reported (through df -k /dev/shm) is less than MEMORY_TARGET, then free the space or mount a larger /dev/shm to satisfy the MEMORY_TARGET size. Note that if you set theMEMORY_MAX_TARGET parameter greater than MEMORY_TARGET, then ensure that /dev/shm is sized to be at least the value of MEMORY_MAX_TARGET.
Memory Target for Oracle Database InstancesRunning Database Configuration Assistant (DBCA) defaults to this Automatic Memory Management option. In the case of upgrade or manual database creation,MEMORY_TARGET can be specified in the initialization parameter file.

 

大部分人理解为,要求/dev/shm至少必须不小于MEMORY_MAX_TARGET的大小。

但是根据测试的实际情况,必须是/dev/shm的可用空间不小于MEMORY_MAX_TARGET的大小。

例如

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 6336M
memory_target                        big integer 6336M
parallel_servers_target              integer     16
pga_aggregate_target                 big integer 0
sga_target                           big integer 0

 

根据参数,memory_max_target 参数为6.18G

[root@oracledb ~]# mount -o remount,size=10G /dev/shm
[root@oracledb ~]# df -h
Filesystem                        Size  Used Avail Use% Mounted on
/dev/mapper/vg_centosdbo-lv_root   50G   42G  5.3G  89% /
tmpfs                              10G  9.9G 144M  99% /dev/shm
/dev/sda2                         485M   39M  421M   9% /boot
/dev/sda1                         200M  260K  200M   1% /boot/efi
/dev/mapper/vg_centosdbo-lv_home  1.3T  504G  744G  41% /home
[root@oracledb ~]# su – oracle

 

 

 

即便这里我设置size大小为10G。但是可用空间只有144M.

这时我启动数据库:

SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 30 14:29:21 2016

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system

仍然会报错。

如下所示,如果保证可用空间大于memory_max_target,则数据库正常启动。

[root@oracledb ~]# mount -o remount,size=16G /dev/shm
[root@oracledb ~]# df -h
Filesystem                        Size  Used Avail Use% Mounted on
/dev/mapper/vg_centosdbo-lv_root   50G   42G  5.3G  89% /
tmpfs                              16G  6.2G  9.9G  39% /dev/shm
/dev/sda2                         485M   39M  421M   9% /boot
/dev/sda1                         200M  260K  200M   1% /boot/efi
/dev/mapper/vg_centosdbo-lv_home  1.3T  504G  744G  41% /home
[root@oracledb ~]# sqlplus /nolog
-bash: sqlplus: command not found
[root@oracledb ~]# su - oracle
[oracle@oracledb ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 30 14:30:41 2016

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area 6614106112 bytes
Fixed Size                  2213896 bytes
Variable Size            3556771832 bytes
Database Buffers         3019898880 bytes
Redo Buffers               35221504 bytes
Database mounted.
Database opened.
SQL>  

 

由此可能的情况是,/dev/shm默认为系统内存的一半,虽然理论上可能已经大于MEMORY_TARGET,但数据库启动是可能仍然会报错。

比如我所用的测试库,MEMORY_TARGET是6.18G. 默认/dev/shm为内存的一半,即7.7G左右。但数据库启动时仍然报错。

单纯在/etc/fstab中设置大小,在系统启动时,可用空间仍然会小于MEMORY_TARGET,可能设置的足够大,就会解决该问题吧!

阅读(876) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~