1.修改memory_target
SQL> alter system set memory_target=6g scope=spfile;
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost myshell]$ echo $ORACLE_SID
slnngk
[oracle@localhost myshell]$
[oracle@localhost myshell]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 29 15:33:47 2018
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
官方解释:
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 的大小:
[oracle@localhost ]$ df -h | grep shm
tmpfs 5.8G 0 5.8G 0% /dev/shm
2.修改/etc/fstab文件
[root@localhost ~]# cat /etc/fstab | grep tmpfs
tmpfs /dev/shm tmpfs defaults,size=8G 0 0
现在可以通过重启使这个配置生效,也可以通过重新挂载来修改其大小:
[root@localhost ~]# mount -o remount,size=8G /dev/shm
[root@localhost ~]# df -h | grep shm
tmpfs 4.0G 0 4.0G 0% /dev/shm
3.再次启动
SQL> startup
ORACLE instance started.
Total System Global Area 6413680640 bytes
Fixed Size 2265224 bytes
Variable Size 3489664888 bytes
Database Buffers 2902458368 bytes
Redo Buffers 19292160 bytes
Database mounted.
Database opened.
-- The End --