Linux 上 安装oracle 的注意点
今天看了 《tuning and optimizing rhel for oracle 9i and 10g databases》这篇文的,感觉讲得不错,对 linux 下的管理有了一定的认识,这里记录下一些内容(主要是一些 安装时需要调整的内核参数,其它还有 一些技术细节可查看这份文档,是个不错的参考)
1、 swap 的设置
RAM Swap Space
--------------------------------------------
1 GB - 2 GB 1.5 times the size of RAM
2 GB - 8 GB Equal to the size of RAM
more than 8GB 0.75 times the size of RAM
一些实时的 内存变化,可查看 /proc/meminfo ,这里包括内存的所有内容(swap,ram,hugepage ……)
2、 Setting SHMMAX Parameter
Shmmax 表示 一个共享内存段的最大值,由于 sga 都是在 共享内存段中,所以,这个值的建议是 等于 sga 的大小。另外,查看 oracle 使用的共享内存段的大小,可通过
Ipcs –m
如果共享内存段不足,有可能会报:
ORA-27123: unable to attach to shared memory segment
修改共享内存段可通过如下途径:
To determine the maximum size of a shared memory segment, run:
# cat /proc/sys/kernel/shmmax
2147483648
The default shared memory limit for SHMMAX can be changed in the proc file system without reboot:
# echo 2147483648 > /proc/sys/kernel/shmmax
Alternatively, you can use sysctl(8) to change it:
# sysctl -w kernel.shmmax=2147483648
To make a change permanent, add the following line to the file /etc/sysctl.conf (your setting may vary). This file is used during the boot process.
# echo "kernel.shmmax=2147483648" >> /etc/sysctl.conf
3、 Setting SHMMNI Parameter
Shmmni 表示 最大的共享内存段的数量,这个值对于 oracle 9i和10g 基本都是 4096(默认值)。
查看和设置 shmmni 的值:
To determine the system wide maximum number of shared memory segments, run:
# cat /proc/sys/kernel/shmmni
4096
The default shared memory limit for SHMMNI can be changed in the proc file system without reboot:
# echo 4096 > /proc/sys/kernel/shmmni
Alternatively, you can use sysctl(8) to change it:
# sysctl -w kernel.shmmni=4096
To make a change permanent, add the following line to the file /etc/sysctl.conf. This file is used during the boot process.
# echo "kernel.shmmni=4096" >> /etc/sysctl.conf
4、 Setting SHMALL Parameter
Shmall表示 所有的共享页(shared segment pages)的数量,这个值通常为 shmmax/PAGE_SIZE
而 一般情况下 ,page_size=4096(4K),如何获得os 的page_size 呢
$ getconf PAGE_SIZE
4096
查看和设置 该值:
To determine the system wide maximum number of shared memory pages, run:
# cat /proc/sys/kernel/shmall
2097152
The default shared memory limit for SHMALL can be changed in the proc file system without reboot:
# echo 2097152 > /proc/sys/kernel/shmall
Alternatively, you can use sysctl(8) to change it:
# sysctl -w kernel.shmall=2097152
To make a change permanent, add the following line to the file /etc/sysctl.conf. This file is used during the boot process.
# echo "kernel.shmall=2097152" >> /etc/sysctl.conf
5、 Removing Shared Memory
有的时候,我们 通过 ipcs –m 观察共享内存段时,会发现如下情况:
$ ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x8f6e2129 98305 oracle 600 77694523 0
0x2f629238 65536 oracle 640 2736783360 35
0x00000000 32768 oracle 640 2736783360 0 dest
Status 为 dest 表示 该 共享内存段是 没用的,但是又不能释放掉,所以,我们需要手工把它给删除掉。
我们可以通过 如下命令查看 status 为 dest 的更为细致的信息:
$ ipcs -m -i 32768
Shared memory Segment shmid=32768
uid=500 gid=501 cuid=500 cgid=501
mode=0640 access_perms=0640
bytes=2736783360 lpid=3688 cpid=3652 nattch=0
att_time=Sat Oct 29 13:36:52 2005
det_time=Sat Oct 29 13:36:52 2005
change_time=Sat Oct 29 11:21:06 2005
删除该共享内存段,需要执行以下命令:
$ ipcrm shm 32768
还有一种办法是使用 oracle的 sysresv 命令,具体参考该文档内容
6、 hugepage
如果 os 的系统内存超过了 64g,那么就可以使用 hugepage了,这样,就能更高效得使用 共享内存,因为 hugepage 不会被 swap out,而且,在 寻址方面,有更高的性能。
下面可查看 hugepage 的一些基本设置
$ grep Huge /proc/meminfo
HugePages_Total:
HugePages_Free:
Hugepagesize: 2048 kB
默认情况下,Hugepagesize 都是 2M,那么如果 我们有充足的 RAM,我们需要怎么配置 Hugepage呢,一般情况下,让它 等于 oracle 的sga 大小就可以了。
设置 vm.nr_hugepages =4096 就可以了,具体,可参考 metalink ID 744769.1
^_^,就到这里了,其它的也不作详细记录了。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14730395/viewspace-683648/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/14730395/viewspace-683648/
本文介绍了在Linux环境下安装和优化Oracle数据库时的关键步骤及注意事项,包括交换空间配置、共享内存参数调整等。
8万+

被折叠的 条评论
为什么被折叠?



