memory_target和/dev/shm的关系

来源:互联网 发布:maven 指定java版本 编辑:程序博客网 时间:2024/05/17 00:56

memory_target是oracle11g新出的内存自动管理工具,可以自动管理sga和pga的内存,不需要在像以前一样去手动设置了

/dev/shm和swap有很大的区别,shm是内存划分的大小,但是shm存放的东西不会被内存回收,同时shm剩余的内存可以被共享使用

现在模拟一下memory_targt和shm的关系

[oracle@oracle1 ~]$ df -ha
Filesystem                     Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-LogVol00   20G   11G  8.4G  56% /
proc                              0     0     0    - /proc
sysfs                             0     0     0    - /sys
devpts                            0     0     0    - /dev/pts
tmpfs                          996M  519M  478M  53% /dev/shm
/dev/sda1                      194M   35M  150M  19% /boot
/dev/mapper/VolGroup-LogVol02   49G  181M   46G   1% /home
/dev/mapper/VolGroup-LogVol03  106G   13G   88G  13% /u01
/dev/mapper/VolGroup-LogVol01   20G  275M   19G   2% /var
none                              0     0     0    - /proc/sys/fs/binfmt_misc

1000m左右的shm,我们把memory_target=600m调整到1024M,然后重启数据库




修改后的


出现错误,查看告警日志提示shm过小

[oracle@oracle2 trace]$ tail -f  alert_pu.log 
Stopping background process VKTM
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
Mon May 23 11:43:01 2016
Instance shutdown complete
Mon May 23 11:43:04 2016
Starting ORACLE instance (normal)
WARNING: You are trying to use the MEMORY_TARGET feature. This feature requires the /dev/shm file system to be mounted for at least 1073741824 bytes. /dev/shm is either not mounted or is mounted with available space less than this size. Please fix this so that MEMORY_TARGET can work as expected. Current available is 1043705856 and used is 81920 bytes. Ensure that the mount point is /dev/shm for this directory.
memory_target needs larger /dev/shm
Mon May 23 11:57:36 2016


解决办法增加shm或者减少memory_target的值

只演示shm增大的例子:

[root@oracle2 ~]# vim /etc/fstab 


#
# /etc/fstab
# Created by anaconda on Fri May 13 16:56:32 2016
#
# 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/VolGroup-LogVol00 /                       ext4    defaults        1 1
UUID=8a236f27-469b-4836-9025-45ee5c0f3f5d /boot                   ext4    defaults        1 2
/dev/mapper/VolGroup-LogVol02 /home                   ext4    defaults        1 2
/dev/mapper/VolGroup-LogVol03 /u01                    ext4    defaults        1 2
/dev/mapper/VolGroup-LogVol01 /var                    ext4    defaults        1 2
UUID=a43716ec-317e-401b-bbd5-27a2f3d3aac3 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
"/etc/fstab" 18L, 1038C written                               
[root@oracle2 ~]# mount -o remount /dev/shm/
[root@oracle2 ~]# df -ha
Filesystem                     Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-LogVol00   20G   11G  8.7G  54% /
proc                              0     0     0    - /proc
sysfs                             0     0     0    - /sys
devpts                            0     0     0    - /dev/pts
tmpfs                          2.0G   80K  2.0G   1% /dev/shm
/dev/sda1                      194M   35M  150M  19% /boot
/dev/mapper/VolGroup-LogVol02   49G  180M   46G   1% /home
/dev/mapper/VolGroup-LogVol03  106G   18G   83G  18% /u01
/dev/mapper/VolGroup-LogVol01   20G  443M   19G   3% /var
none                              0     0     0    - /proc/sys/fs/binfmt_misc
gvfs-fuse-daemon                  0     0     0    - /root/.gvfs
/dev/sr0                       4.2G  4.2G     0 100% /media/CentOS_6.5_Final
/dev/sr0                       4.2G  4.2G     0 100% /iso
[root@oracle2 ~]# su - oracle
[oracle@oracle2 ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.3.0 Production on Mon May 23 11:57:33 2016


Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to an idle instance.


SQL> startup
ORACLE instance started.


Total System Global Area 1068937216 bytes
Fixed Size                  2235208 bytes
Variable Size             935331000 bytes
Database Buffers          125829120 bytes
Redo Buffers                5541888 bytes
Database mounted.
Database opened.
SQL> 

0 0
原创粉丝点击