参考文档: https://docs.oracle.com/cd/E11882_01/server.112/e10839/appc_linux.htm#UNXAR327
查看/dev/shm ,大小是1.2G
[oracle@test shm]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_test-lv_root
50G 30G 18G 63% /
tmpfs 1.5G 318M 1.2G 22% /dev/shm
/dev/sda1 477M 127M 322M 29% /boot
/dev/mapper/vg_test-lv_home
6.4G 2.9G 3.2G 48% /home
原来的oracle 内存是1G, 现在分配到1.5G。 大于/dev/shm的1.2G
SYS@test>alter system set memory_max_target=1500M scope=spfile;
System altered.
SYS@test>alter system set memory_target=1500M scope=spfile;
System altered.
SYS@test>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
启动Oracle,提示错误
SYS@test>startup
ORA-00845: MEMORY_TARGET not supported on this system
SYS@test>!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.
SYS@test>
查看/dev/shm ,大小是1.5G
[root@test ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_test-lv_root
50G 30G 18G 63% /
tmpfs 1.5G 72K 1.5G 1% /dev/shm
/dev/sda1 477M 127M 322M 29% /boot
/dev/mapper/vg_test-lv_home
6.4G 2.9G 3.2G 48% /home
[root@test ~]#
修正/dev/shm 到2g ,然后启动oracle,可以启动
[root@test ~]# mount -t tmpfs shmfs -o size=2g /dev/shm
SYS@test>startup
ORACLE instance started.
Total System Global Area 1570009088 bytes
Fixed Size 2253584 bytes
Variable Size 939527408 bytes
Database Buffers 620756992 bytes
Redo Buffers 7471104 bytes
Database mounted.
Database opened.
SYS@test>
关闭掉db,重启OS。/dev/shm又恢复到了原来的状态
[root@test ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_test-lv_root
50G 30G 18G 63% /
tmpfs 1.5G 72K 1.5G 1% /dev/shm
/dev/sda1 477M 127M 322M 29% /boot
/dev/mapper/vg_test-lv_home
6.4G 2.9G 3.2G 48% /home
[root@test ~]#
修改/etc/fstab
[root@test ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon Dec 11 15:30:06 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_test-lv_root / ext4 defaults 1 1
UUID=4edfa712-e456-4570-98a9-0035db32f1d5 /boot ext4 defaults 1 2
/dev/mapper/vg_test-lv_home /home ext4 defaults 1 2
/dev/mapper/vg_test-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs size=2g 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
[root@test ~]#
再次启动OS和oracle,/dev/shm 永久性的是2G了
Last login: Fri Feb 16 19:40:51 2018 from 192.168.2.240
[root@test ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_test-lv_root
50G 30G 18G 63% /
tmpfs 2.0G 72K 2.0G 1% /dev/shm
/dev/sda1 477M 127M 322M 29% /boot
/dev/mapper/vg_test-lv_home
6.4G 2.9G 3.2G 48% /home
[root@test ~]#
SYS@test>startup
ORACLE instance started.
Total System Global Area 1570009088 bytes
Fixed Size 2253584 bytes
Variable Size 989859056 bytes
Database Buffers 570425344 bytes
Redo Buffers 7471104 bytes
Database mounted.
Database opened.
SYS@test>show parameter mem
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address integer 0
memory_max_target big integer 1504M
memory_target big integer 1504M
shared_memory_address integer 0
SYS@test>
End
--- 补充
参考文档:
https://docs.oracle.com/cd/E11882_01/server.112/e10839/appc_linux.htm#UNXAR333
B.6 Allocating Shared Resources
To use the MEMORY_TARGET
or MEMORY_MAX_TARGET
feature, the following kernel parameters must be modified.
/dev/shm
mount point should be equal in size or larger than the value ofSGA_MAX_SIZE
, if set, or should be set to be at leastMEMORY_TARGET
orMEMORY_MAX_TARGET
, whichever is larger. For example, withMEMORY_MAX_TARGET=4GB
only set, to create a 4GB system on the/dev/shm
mount point:Run the following command as the
root
user:# mount -t tmpfs shmfs -o size=4g /dev/shm
Ensure that the in-memory file system is mounted when the system restarts, add an entry in the
/etc/fstab
file similar to the following:tmpfs /dev/shm tmpfs size=4g 0