修改Oracle的memory_max_target和memory_target
# vim /etc/sysctl.conf
kernel.shmmax = 12884901888
# sysctl -p再修改ORACLE 参数
sql> show parameter target;
sql> alter system set memory_max_target=12288M scope=spfile;
sql> alter system set memory_target=12288M scope=spfile;
sql> startup 时报错:
ORA-00845: MEMORY_TARGET not supported on this system
查找资料后发现在oracle 11g中新增的内存自动管理的参数MEMORY_TARGET,它能自动调整SGA和PGA,
这个特性需要用到/dev/shm共享文件系统,而且要求/dev/shm必须大于MEMORY_TARGET,如果/dev/shm比MEMORY_TARGET小,就会报错。
解决方案:
1.初始化参数MEMORY_TARGET或MEMORY_MAX_TARGET不能大于共享内存(/dev/shm),为了解决这个问题,可以增大/dev/shm
# mount -t tmpfs shmfs -o size=12288M /dev/shm
但如果之前已经mount过了,则执行remount
# mount -o remount,size=12288M /dev/shm2.为了确保操作系统重启之后能生效,需要修改/etc/fstab文件
tmpfs /dev/shm tmpfs defaults,size=12288M 0 03.如果/dev/shm没有挂载也会报上面的错,所认需要确保已经挂载,执行目录查看:
# df -h[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on[root@localhost ~]#
[root@localhost ~]# mount -o remount,size=12288M /dev/shm
[root@localhost ~]#
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on[root@localhost ~]#
[root@localhost ~]# vim /etc/fstab启动数据库还是报错:
$ sqlplus / as sysdba
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
SQL>
网上搜索,发现是/dev/shm还是不够大,/dev/shm必须大于MEMORY_TARGET,等于也会报错。
所以继续调整/dev/shm为13G:# mount -o remount,size=13G /dev/shm
持久化修改
# vim /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=13G 0 0
修改成功,查看:
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
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
12G
memory_target big integer
12G
parallel_servers_target integer
32
pga_aggregate_target big integer
0
sga_target big integer
0
SQL>