ORA-00845 错误处理
今天蛋疼的我打算调整下memory_max_target 参数.因为我想提高memory_target的值,
进而提升sga_target的值,然后再提高shared_pool_size 的值,因为我发现数据库中
library cache pinhitratio 比较低。因为我知道分配给数据库系统的资源比较紧张所有
我不打算从别的池割出内存来给共享池。
SQL> show parameter memory_max_target;
NAME TYPE VALUE
------------------------------------ ----------- -----------------------
memory_max_target big integer 400M
SQL> show parameter memory_target;
NAME TYPE VALUE
------------------------------------ ----------- -----------------------
memory_target big integer 400M
SQL> alter system set memory_max_target=600M scope=spfile;
System altered.
关闭实例
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
重启实例。
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
本以为一切会好好的,没想到出现了错误。
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@zeng ~]$ oerr ora 00845
00845, 00000, "MEMORY_TARGET not supported on this system"
// *Cause: The MEMORY_TARGET parameter was not supported on this operating system
or /dev/shm was not sized correctly on Linux.
// *Action: Refer to documentation for a list of supported operating systems.
Or, size /dev/shm to be at least the SGA_MAX_SIZE on each Oracle instance
running on the system.
估计是/dev/shm 大小的问题.
[oracle@zeng ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 17G 15G 706M 96% /
tmpfs 590M 0 590M 0% /dev/shm
/dev/sda1 194M 24M 161M 13% /boot
/dev/sdb5 4.6G 76M 4.3G 2% /work
/dev/sdb6 2.8G 69M 2.6G 3% /back
根据上面的错误信息,我脑海中飘过了oracle 11gR2 安装文档里面的一句话。赶紧去找找。
在oracle 11gR2 安装文档(for linux x86)里面有这么一段话:
Starting with Oracle Database 11g, the Automatic Memory Management feature
requires more shared memory (/dev/shm)and file descriptors. The shared memory
should be sized to be at least the greater of MEMORY_MAX_TARGET and MEMORY_TARGET
for each Oracle instance on the computer.
现在问题已经很清楚了,就是那个共享内存不足(/dev/shm).
root@zeng ~]# mount -o remount,size=1G /dev/shm
[root@zeng ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 17G 15G 706M 96% /
tmpfs 1.0G 0 1.0G 0% /dev/shm
/dev/sda1 194M 24M 161M 13% /boot
/dev/sdb5 4.6G 76M 4.3G 2% /work
/dev/sdb6 2.8G 69M 2.6G 3% /back
再来启动数据库。
[oracle@zeng ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue Mar 27 20:52:47 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 627732480 bytes
Fixed Size 1338336 bytes
Variable Size 461374496 bytes
Database Buffers 159383552 bytes
Redo Buffers 5636096 bytes
Database mounted.
Database opened.
在回头来看看那个/dev/shm 的变化
[oracle@zeng ~]$ df -h /dev/shm
Filesystem Size Used Avail Use% Mounted on
tmpfs 1.0G 300M 725M 30% /dev/shm
已经被用掉30%了。
随便来学习一下那个/dev/shm ,查询挂载信息可以知道,设备/dev/shm 对应的文件系统是
tmpfs(temporality file system)。默认的大小是RAM 的一半。我先把数据库关停在进行下面
的操作。
[root@zeng ~]# df -h /dev/shm
Filesystem Size Used Avail Use% Mounted on
tmpfs 1.0G 0 1.0G 0% /dev/shm
/dev/shm 默认使用的是物理内存,并且使用虚拟内存来置换共享内存中存放不下的数据,或者暂时
不需要的数据。所以存储在/dev/shm 中的数据(文件)是临时的,因为实际上是存储在虚拟内存中,
当运用程序关闭以后其中的内容就不复存在了,比如这里当关闭oracle 数据库以后/dev/shm 的占用
率就变成0%了,另外系统重启也会导致/dev/shm 中的数据丢失。这个设备或者文件系统的主要作用是
当一个进程在共享内存中占用了一部分的时候,其他有权限的进程可以访问这部分数据。这样可以提高
系统的性能。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26110315/viewspace-719685/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26110315/viewspace-719685/