Oracle11g ORA-00845 错误(转)

转自老杨博客:http://yangtingkun.itpub.net/post/468/408235

曾经遇到过这个错误,那时萌懂,搞不定重装。今天再次遇到,根据老杨的方法成功搞定。Memory Target即使大于物理内存,只要小于/dev/shm大小,数据库便可启动。(测试库物理内存4G,RHEL,Oracle11g,设置Memory Target大小为5G)

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的大小:

[[email protected] ~]# 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来实现:

[[email protected] ~]# 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
 [[email protected] ~]# umount /dev/shm
 [[email protected] ~]# mount /dev/shm
 [[email protected] ~]# df -k /dev/shm
 Filesystem 1K-blocks Used Available Use% Mounted on
 tmpfs 10485760 0 10485760 0% /dev/shm
 [[email protected] ~]# su - oracle
 [[email protected] ~]$ 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,然后就可以启动数据库了。

总结:老杨的博客救了我滴命啊。不过在改参数文件前,一定要备份参数文件:create pfile from spfile;

11g的自动管理会方便,但是会遇到这种问题,对于我来说,不是第一次了,但希望是最后一次。

普人特福的博客cnzz&51la for wordpress,cnzz for wordpress,51la for wordpress