使用虚拟机时,机器实在太卡,原来虚拟机会把你所分配给它的内存扣死,昨天把虚拟机的内存从1.5G缩小到1G。机器果然顺畅了,不过担心的问题也出现了--oracle的实例启动不了。
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
来自Oracle的官方解析是:
Starting with Oracle Database 11g, the Automatic Memory Management feature requires more shared memory (/dev/shm)and file descriptors. The size of the shared memory should be at least the greater of MEMORY_MAX_TARGET and MEMORY_TARGET for each Oracle instance on the computer. If MEMORY_MAX_TARGET or MEMORY_TARGET is set to a non zero value, and an incorrect size is assigned to the shared memory, it will result in an ORA-00845 error at startup.
简单来说就是 MEMORY_MAX_TARGET 的设置不能超过 /dev/shm 的大小
我不知道怎样调整MEMORY_MAX_TARGET,所以就调整/dev/shm的大小
查看原本大小
[root@Shine2 oracle]# df -h|grep shm
tmpfs 505M 75K 505M 1% /dev/shm
在文件搜索里找到6个initXXX.ora文件,随便打开两个发现memorytarget的值不同。。。
其中有一个是1G,那就1G吧。。。也不知道是什么
[oracle@Shine2 ~]$ gedit /etc/fstab
把文件中
tmpfs /dev/shm tmpfs defaults 0 0
改为
tmpfs /dev/shm tmpfs defaults,size=1G 0 0
[root@Shine2 oracle]# umount /dev/shm
出现错误:/dev/shm is busying,并提示我使用lsof命令。
lsof(list open files)是一个列出当前系统打开文件的工具。
[root@Shine2 oracle]# lsof |grep shm
lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/oracle/.gvfs
Output information may be incomplete.
pulseaudi 2997 oracle mem REG 0,16 67108904 9562 /dev/shm
[root@Shine2 oracle]# kill 2997
[root@Shine2 oracle]# lsof |grep shm
lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/oracle/.gvfs
Output information may be incomplete.
把使用该文件的进程干掉了
[root@Shine2 oracle]# umount /dev/shm
[root@Shine2 oracle]# mount /dev/shm
[root@Shine2 oracle]# df -h|grep shm
tmpfs 1.0G 400M 625M 40% /dev/shm
卸载再重新挂载后,实例终于可以启动了~哈哈
[oracle@Shine2 ~]$ sqlplus
SQL*Plus: Release 11.2.0.1.0 Production on Sat Jul 30 09:34:01 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Enter user-name: / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 640286720 bytes
Fixed Size 1338420 bytes
Variable Size 461374412 bytes
Database Buffers 171966464 bytes
Redo Buffers 5607424 bytes
Database mounted.
Database opened.
评论